Skip to main content

A Python library to simplify data-analytics tasks

Project description

l4v1

l4v1 is a Python library designed to simplify data analytics tasks through data manipulation and visualization techniques. Built on top of Polars and Plotly, it offers a straightforward API for quickly creating detailed summaries. This project is a work in progress, and more functionality will be added in the future.

Installation

You can install the l4v1 package directly from PyPI:

pip install l4v1

Usage

Calculate price, volume, and mix effects conveniently, and visualize them in an Excel heatmap or a Plotly waterfall chart.

Start by importing Polars to load the data:

import polars as pl

# Load your datasets
sales_week_1 = pl.read_csv("data/sales_week1.csv")
sales_week_2 = pl.read_csv("data/sales_week2.csv")

Once you have the data, import the PVM module:

from l4v1.price_volume_mix import PVM

# Initialize the class with your data and desired dimensions
pvm = PVM(
    df_primary=sales_week_2, # Data to analyse
    df_comparison=sales_week_1, # Data to compare against
    group_by_columns=["Product line", "Customer type"] # Dimension(s) to use
    volume_column_name="Quantity", # Column name containing volume (e.g. quantity)
    outcome_column_name="Total", # Column name containing outcome (e.g. revenue or cost)
)

Once the class is initialized, you can decide whether to create an Excel table, a Plotly waterfall chart, or continue working with the data in a Polars DataFrame.

To create a waterfall chart:

pvm.waterfall_plot(
    primary_total_label="Week 2 Sales", # Optional label
    comparison_total_label="Week 1 Sales", # Optional label
    title="Sales Week 2 vs 1", # Optional title,
    color_total = "#F1F1F1", # Optional color for totals
    # etc.
)

Waterfall Plot Example

In Excel, it is easier to visualize if there are many dimensions used:

pvm.write_xlsx_table("your/path/file_name.xlsx") # Must end to .xlsx file extensions

Heatmap Example

For large datasets, it might be most convenient to continue exploring directly in Polars. In that case, simply call get_table:

pvm.get_table()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

l4v1-0.2.1.tar.gz (303.4 kB view details)

Uploaded Source

Built Distribution

l4v1-0.2.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file l4v1-0.2.1.tar.gz.

File metadata

  • Download URL: l4v1-0.2.1.tar.gz
  • Upload date:
  • Size: 303.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for l4v1-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0b6a6d89a0b2054e3cd0ff9e84fbc89e79922b24bd5258e773e11aee76df64a0
MD5 f056a69c69df284cc1da6ef9bb69bf73
BLAKE2b-256 a30cc4360992ddb17353d49470fc3948faae0a2db7646ccabdbae7be5914833b

See more details on using hashes here.

File details

Details for the file l4v1-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: l4v1-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for l4v1-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4038cc01139d057af2ab54ac4fa5fec8219135ce0f8845e0d68501daedf73082
MD5 64ac81bcd99eca13d9e1b6daaa4c904b
BLAKE2b-256 b74f14a0edd46f6233eb1c2901b66099714567d5a4bcd7e532843d9fe757f3a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page