mis_analytics
mis_analytics helps prepare supply chain and manufacturing data. Clean columns and resample time series, inspect pandas and eager Polars pipelines, and use deSAPher to look up SAP fields and convert SAP extracts.
Installation
Requires Python 3.11 or later. Install the DataFrame utilities and pipeline tracking:
pip install mis_analytics
For SAP functionality, install the desapher extra:
pip install "mis_analytics[desapher]"
The extra adds httpx, beautifulsoup4, and lxml. The base package includes pandas, NumPy, and Polars. Import mis_analytics.desapher only when its extra dependencies are installed.
To install the latest code from GitHub, including the extra:
pip install "mis_analytics[desapher] @ git+https://github.com/MIS-Analytics/mis_analytics.git"
Omit [desapher] for the base package.
DataFrame utilities
import pandas as pd
import polars as pl
from mis_analytics.core import clean_col_names
from mis_analytics.etl import track
orders = pd.DataFrame({'Order ID': [101, 102, 103], 'Quantity': [5, 10, 15]})
orders = clean_col_names(orders)
orders
| order_id | product | quantity | defects | production_time | |
|---|---|---|---|---|---|
| 0 | 101 | Widget A | 50 | 2 | 120 |
| 1 | 102 | Widget B | 30 | 1 | 95 |
| 2 | 103 | Widget A | 75 | 3 | 150 |
| 3 | 104 | Widget C | 20 | 0 | 80 |
| 4 | 105 | Widget B | 45 | 2 | 110 |
Pipeline tracking
Decorate a function with @track and chain it with .pipe(). Set vrbs=True on each step to print its name, docstring, elapsed time, shape changes, and input/output samples. Logging is off by default. Both pandas and eager Polars DataFrames are supported; each transformation must support the DataFrame it receives.
@track
def take_rows(df, n):
"""Keep the first n rows."""
return df.head(n)
pandas_preview = orders.pipe(take_rows, 2, vrbs=True).pipe(take_rows, 1, vrbs=True)
polars_orders = pl.DataFrame({'order_id': [101, 102, 103], 'quantity': [5, 10, 15]})
polars_preview = polars_orders.pipe(take_rows, 2, vrbs=True).pipe(take_rows, 1, vrbs=True)
SAP helpers with deSAPher
With the desapher extra installed, fetch SAP table metadata from sapdatasheet.org and use it to convert types and rename fields in pandas extracts. Fetching metadata requires internet access.
from mis_analytics.desapher import get_sap_tables_structure, convert_sap_types, rename_sap_columns
sap_sheet = get_sap_tables_structure(['MARA'])
materials = pd.DataFrame({'MATNR': ['000000000000000101']})
if sap_sheet is not None:
materials = materials.pipe(convert_sap_types, sap_sheet).pipe(rename_sap_columns, sap_sheet)
get_sap_table_description also retrieves a table’s description.
Development
From a local checkout, install the development group and SAP extra:
uv sync --group dev --extra desapher
Edit the source notebooks under nbs/, then export the modules. Regenerate the README after editing nbs/index.ipynb:
uv run nbdev-export
uv run nbdev-test --path nbs/index.ipynb
uv run nbdev-readme
Metadata
Release files for mis-analytics 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mis_analytics-0.0.6.tar.gz | 15.8 kB | Without provenance | Details for mis_analytics-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mis_analytics-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for mis_analytics-0.0.6-py3-none-any.whl |
Total release size: 31.1 kB
Release files / mis_analytics-0.0.6.tar.gz
| Download URL | mis_analytics-0.0.6.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a05997a30cf9b7750d51ad05242e466fc150e349896fae93a2a4c803d8e8999b
|
|
BLAKE2b-256 checksum How to use checksums |
a4e9a35282c5326baf24fbed6f734d724681b62ccf477bdb9aa2d9f19fce666b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / mis_analytics-0.0.6-py3-none-any.whl
| Download URL | mis_analytics-0.0.6-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89ebad15250c2b1ff31a35e4bcd7d1c5fb20b91caa35a82d17334d71ba31a9ad
|
|
BLAKE2b-256 checksum How to use checksums |
1bdc469cb632450994375c6e8a711f6aa3cafd0f9275337675b9f9aea103259d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Security for mis-analytics 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.