Skip to main content

The Ultimate Metric Library

Project description

Metric Forge

Description of the image

Metric Forge is your ultimate toolkit for measuring and evaluating performance across various business domains.

Disclaimer

Metric Forge provides a collection of calculations across various domains, including finance, mortgage, marketing, and more. While every effort has been made to ensure the accuracy and reliability of the calculations and methods provided, Metric Forge is intended for informational and educational purposes only.

Important Notice:

No Warranty: The calculations and methods provided in this package are offered "as-is" without any guarantees or warranties of any kind, either express or implied. The package's creators do not assume any responsibility for errors or omissions or for any damages resulting from the use of the package.

Not Professional Advice: The results produced by the package should not be considered as professional financial, investment, legal, or any other type of advice. Users should consult with qualified professionals before making any decisions based on the outputs generated by this package.

Use at Your Own Risk: Users of Metric Forge assume full responsibility for the use of the package and its results. The creators of the package shall not be held liable for any decisions made based on the information provided or for any consequences arising from the use of the package.

By using this package, you acknowledge and agree to this disclaimer. If you do not agree, please refrain from using the Metric Forge package.

Getting Started

install the package via pip

pip install metric-forge

Ecommerce

You can use Ecommerce Metrics in two different ways:

  • With Polars
  • As a Single Value Function (SVF)

Metric Forge extends the Polars expression library; making it possible to perform row-wise-calculations for various metrics. In addition to mass calculations, you can also perform single value calculations that return just one value.

from metric_forge.ecommerce import * 
import polars as pl
data = pl.read_csv('datasets/ecommerce_metrics.csv')
data.head()
<style> .dataframe > thead > tr, .dataframe > tbody > tr { text-align: right; white-space: pre-wrap; } </style> shape: (5, 15)
monthtotal_revenuenumber_of_orderscost_of_acquisitionnew_customerscarts_createdcompleted_purchasesrevenue_from_adsadvertising_spendnum_conversionsnum_visitorsrevenue_per_customeraverage_customer_lifetimenum_customers_losttotal_customers_beginning
strf64i64f64i64i64i64f64f64i64i64f64f64i64i64
"2023-01"87454.01188599122958.3505594061969142581339.9576965390.91016930013154202.4273293.1593642393306
"2023-02"145071.43064191318736.8742062341506142176875.08340215585.03701842714762116.1734361.8122451244680
"2023-03"123199.394181130528355.5868421201497965116505.48219114872.03795436710056384.2651564.7714141774675
"2023-04"109865.8484288514184.8158242819631102106008.04638112337.20436813219948144.3563283.3954622992972
"2023-05"65601.86404469118764.339456266100980197258.8099125351.99556814713110275.7346013.779142963768

Customer Acquisition Cost

data.select(pl.col('cost_of_acquisition'),
            pl.col('new_customers'),
            pl.col('*').forge_ecommerce.customer_acquisition_cost('cost_of_acquisition', 'new_customers'))

Average Order Value

data.select(pl.col('total_revenue'),
            pl.col('new_customers'),
            pl.col('*').forge_ecommerce.average_order_value('total_revenue', 'number_of_orders'))

Cart Abandonment Rate

data.select(pl.col('carts_created'),
            pl.col('completed_purchases'),
            pl.col('*').forge_ecommerce.cart_abandonment_rate('carts_created', 'completed_purchases'))

Return on Advertising Spend

data.select(pl.col('revenue_from_ads'),
            pl.col('advertising_spend'),
            pl.col('*').forge_ecommerce.return_on_advertising_spend('revenue_from_ads', 'advertising_spend'))

Conversion Rate

data.select(pl.col('num_conversions'),
            pl.col('num_visitors'),
            pl.col('*').forge_ecommerce.conversion_rate('num_conversions', 'num_visitors'))

Customer Lifetime Value

data.select(pl.col('revenue_per_customer'),
            pl.col('average_customer_lifetime'),
            pl.col('*').forge_ecommerce.customer_lifetime_value(revenue_per_customer_column='revenue_per_customer',average_customer_lifetime_column='average_customer_lifetime',method='basic'))
<style> .dataframe > thead > tr, .dataframe > tbody > tr { text-align: right; white-space: pre-wrap; } </style> shape: (12, 3)
revenue_per_customeraverage_customer_lifetimecustomer_lifetime_value
f64f64f64
202.4273293.159364639.54169
116.1734361.812245210.534716
384.2651564.7714141833.488253
144.3563283.395462490.156408
275.7346013.779141042.039585
290.1480892.182535633.258286
325.3102291.421977462.583676
378.2064352.8261381068.863683
155.7325821.873762291.805755
341.7669522.66604911.164293

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

metric_forge-0.4.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

metric_forge-0.4.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file metric_forge-0.4.0.tar.gz.

File metadata

  • Download URL: metric_forge-0.4.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for metric_forge-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8fca555ae32961220ea66e18a2fa215b83858eab0ddc68cd2a45a8904d45edcc
MD5 cdd2c4568854f7d319cd10e6ee2cadc3
BLAKE2b-256 45f2be0bd91915e9a9a8dd2d3eb74436f3452f5767c156b5f0003d4468ba0e55

See more details on using hashes here.

File details

Details for the file metric_forge-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: metric_forge-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for metric_forge-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1038f4e25614c1b2284d7acb24248fbce014aedaea5c6013ef30ea336f483ad
MD5 ddea511f522fcfb1325a26fb345c9c3b
BLAKE2b-256 2eb65fe867d1a984f5986a2b4a94193e7c1b62ec4bf1674b751c37447d0b892d

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