A small package used to find data variances
Project description
Effulge
Use Case
- When we have two pyspark dataframes with valid Primary Key
- and we need to find the attributes that are mismatching between the two dataframes.
Example
Lets consider two dataframes "expectation" and "reality".
Inputs
If Primary Key is (ProductID, Colour) and if the contents of "expectation" are -
| ProductID | ProductName | Colour | UnitPrice | Quantity | Fragile | Gift |
|---|---|---|---|---|---|---|
| 1001 | GelPen | Blue | 10 | 2 | 0 | 0 |
| 1001 | GelPen | Black | 10 | 1 | 0 | 0 |
| 1001 | GelPen | Red | 10 | 1 | 0 | 0 |
| 1002 | InkPen | Blue | 50 | 1 | 0 | 1 |
| 1003 | InkBottle | Blue | 35 | 1 | 1 | 1 |
| 1004 | Pencil | Grey | 3 | 5 | 0 | 0 |
| 1005 | Eraser | White | 2 | 2 | 0 | 0 |
| 1006 | Sharpner | Orange | 3 | 1 | 0 | 0 |
| 1006 | Sharpner | Steel | 5 | 1 | 0 | 0 |
| 1007 | GeometryBox | Green | 40 | 0 | 0 |
And if contents of "reality" are -
| ProductID | ProductName | Colour | UnitPrice | Quantity | Fragile | Gift |
|---|---|---|---|---|---|---|
| 1001 | GelPen | Blue | 10 | 2 | 0 | 0 |
| 1001 | GelPen | Black | 10 | 7 | 0 | 0 |
| 1001 | GelPen | Red | 10 | 1 | 0 | 0 |
| 1002 | InkPen | Blue | 50 | 1 | 0 | 1 |
| 1003 | InkBottle | Blue | 3 | 1 | 1 | 0 |
| 1003 | WaterBottle | Blue | 20 | 2 | 0 | 0 |
| 1004 | Pencil | Grey | 3 | 5 | 0 | 0 |
| 1005 | Eraser | Whiteee | 2 | 2 | 0 | 0 |
| 1006 | Sharpner | Orange | 3 | 1 | 0 | 0 |
| 1006 | Sharpner | Steel | 5 | 1 | 0 | 0 |
| 1007 | GeometryBox | Green | 40 | 0 | 1 |
Output
Then, Effulge will produce an output dataframe with following contents -
| productid | colour | EFFULGE_VARIANCE_PROVOKER |
|---|---|---|
| 1007 | Green | [fragile] |
| 1001 | Black | [quantity] |
| 1003 | Blue | [fragile, gift, productname, quantity, unitprice] |
| 1003 | Blue | [gift, unitprice] |
| 1005 | White | [MISSING_PRIMARY_KEY] |
| 1003 | Blue | [DUPLICATE_PRIMARY_KEY] |
Usage:
from effulge import spot_variance
# Initialize SparkSession
# Load data into dataframes, let's say they are called "df_expectation" and "df_reality"
# Declare a tuple with valid primary key, let's say it is called "primary_key"
output = spot_variance(df_expectation, df_reality, primary_key)
output.show()
# to generate variance report
from effulge import save_variance_report
save_variance_report(
variance_df=output, source_df=df_expectation, target_df=df_reality,
super_key=primary_key, file_name="effulge_variance_report",
src_prefix='SRC', tgt_prefix='TGT'
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Effulge-0.0.1.tar.gz
(12.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
Effulge-0.0.1-py3-none-any.whl
(14.3 kB
view details)
File details
Details for the file Effulge-0.0.1.tar.gz.
File metadata
- Download URL: Effulge-0.0.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59b0e098aae248e07cc3178214efe459680fb004db727abd876a611133b866fe
|
|
| MD5 |
96ab3f2618d92bdcb5871259bfe8d6cf
|
|
| BLAKE2b-256 |
fc04ce7a5650b784fe5492422efc89c2c0b8a4ee42604ddcaff5a7562b597b9c
|
File details
Details for the file Effulge-0.0.1-py3-none-any.whl.
File metadata
- Download URL: Effulge-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f914574dca24b6c024698fe3c9851b20de58ae9935b4dfb4718d9d3dabb46f63
|
|
| MD5 |
c48cb6584d0716d7f8c2c9af6fc218ea
|
|
| BLAKE2b-256 |
8c2a6d1e614361fdc4a06cb74fc9483cab90da4e1d0c20f48f462ef109d94c5a
|