Datamazing
The Datamazing package provides an interface for various transformations of data (filtering, aggregation, merging, etc.)
Interface
The interface is very similar to those of most DataFrame libraries (pandas, pyspark, SQL, etc.). For example, a group-by is implemented as group(df, by=["..."]), and a merge is implemented as merge([df1, df2], on=["..."], how="inner"). So, why not just use native pandas, pyspark, etc.?
- The native libraries have some parts, with a little annoying interface (such as pandas inconsistent use of indexing)
- Ability to add custom operations, used specifically for the Energinet domain.
Backends
The package contains methods with the same interface, but for different backends. Currently, 2 backends are supported: pandas and pyspark (though not all methods are available for both). For example, when working with pandas DataFrames, one would use
import pandas as pd
import datamazing.pandas as pdz
df = pd.DataFrame([
{"animal": "cat", "time": pd.Timestamp("2020-01-01"), "age": 1.0},
{"animal": "cat", "time": pd.Timestamp("2020-01-02"), "age": 3.0},
{"animal": "dog", "time": pd.Timestamp("2020-01-01"), "age": 5.0},
])
pdz.group(df, by="animal") \
.resample(on="time", resolution=pd.Timedelta(hours=12)) \
.agg("interpolate")
whereas, when working with pyspark DataFrame, one would instead use
import datetime as dt
import pyspark.sql as ps
import datamazing.pyspark as psz
spark = ps.SparkSession.getActiveSession()
df = spark.createDataFrame([
{"animal": "cat", "time": dt.datetime(2020, 1, 1), "age": 1.0},
{"animal": "cat", "time": dt.datetime(2020, 1, 2), "age": 3.0},
{"animal": "dog", "time": dt.datetime(2020, 1, 1), "age": 5.0},
])
psz.group(df, by="animal") \
.resample(on="time", resolution=pd.Timedelta(hours=12)) \
.agg("interpolate")
Development
To setup the Python environment, run
$ pip install poetry
$ poetry install
To run test locally one needs java. This can be installed using the following:
$ sudo apt install default-jdk
To execute unit tests, run
$ pytest .
Metadata
Release files for datamazing 9.0.4
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 |
|---|---|---|---|---|
| datamazing-9.0.4.tar.gz | 18.5 kB | Without provenance | Details for datamazing-9.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datamazing-9.0.4-py3-none-any.whl | Python 3 | none | any | Details for datamazing-9.0.4-py3-none-any.whl |
Total release size: 47.6 kB
Release files / datamazing-9.0.4.tar.gz
| Download URL | datamazing-9.0.4.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a1dd23eee55ac0384f8f5231bb444f4387e21e76b1f7080dfa3add50618316b
|
|
BLAKE2b-256 checksum How to use checksums |
111be1d7a653216339826a1a616d6366d996d2e5e34ed2a6d173b831420fec8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1015-azure
|
Release files / datamazing-9.0.4-py3-none-any.whl
| Download URL | datamazing-9.0.4-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5f6bca09b5090ed591ecb53e0fb24714088bda58dd97ca18fde39182e2ff212
|
|
BLAKE2b-256 checksum How to use checksums |
150167a28324087fbecbd13595e7f8ceae7f62cdee09e2760518f2368594bdc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1015-azure
|
Security for datamazing 9.0.4
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.