Skip to main content

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
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
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

API documentation · Source code

Metadata

Release files for mis-analytics 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mis-analytics 0.0.5
File Size Uploaded Provenance Actions
mis_analytics-0.0.5.tar.gz 15.8 kB Without provenance Details for mis_analytics-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mis-analytics 0.0.5
File Interpreter ABI Platform Actions
mis_analytics-0.0.5-py3-none-any.whl Python 3 none any Details for mis_analytics-0.0.5-py3-none-any.whl

Total release size: 31.1 kB

Release files / mis_analytics-0.0.5.tar.gz

Download URL mis_analytics-0.0.5.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eeee2fbb0174fcc2f7f6eda5d542db74e14fd338689a24efe34fe620c4af26c3
BLAKE2b-256 checksum
How to use checksums
f8a5d0d7d788ba11dba74127cafbef53f1519db6b35d5883c5c4c56bfd24858d
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.5-py3-none-any.whl

Download URL mis_analytics-0.0.5-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf6d489350141c896eb4eb346cc9e44bea643a8c589ad1fedf4191e91a485fdb
BLAKE2b-256 checksum
How to use checksums
36946ad855f7b2612a14f2b805210b42b71aabdce05b50d3549e0c52de691346
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.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page