metric forge
Metric
公制Forge是您的最終工具包,用於衡量和評估各個業務領域的性能。
Metric Forge提供了各個領域的計算集合,包括財務,抵押,營銷等。儘管已竭盡全力確保所提供的計算和方法的準確性和可靠性,但指標鍛造僅用於信息和教育目的。
重要注意:
無保修:本軟件包中提供的計算和方法是“ as-is”提供的,無明示或暗示的任何保證或任何形式的保證。軟件包的創建者對錯誤或遺漏或因使用軟件包而造成的任何損害不承擔任何責任。
不是專業的建議:包裝產生的結果不應被視為專業的財務,投資,法律或任何其他類型的建議。用戶應根據此軟件包產生的輸出做出任何決定,然後諮詢合格的專業人員。
出於您自己的風險使用:公制鍛造的用戶對軟件包及其結果的使用承擔全部責任。包裝的創建者不得對根據提供的信息或包裹使用帶來的任何後果做出的任何決定承擔責任。
通過使用此軟件包,您可以承認並同意此免責聲明。如果您不同意,請避免使用公制鍛件包。
通過PIP安裝軟件包
pip install metric - forge 您可以通過兩種不同的方式使用電子商務指標:
公制鍛造擴展了Polars表達式庫;使得可以為各種指標執行行劃分。除質量計算外,您還可以執行僅返回一個值的單個值計算。
from metric_forge . ecommerce import *
import polars as pl
data = pl . read_csv ( 'datasets/ecommerce_metrics.csv' )
data . head ()| 月 | total_revenue | number_of_orders | cost_of_acquisition | new_customers | CARTS_創建 | 填寫 | Revenue_from_ads | Advertising_spend | num_conversions | num_visitors | Revenue_per_customer | 平均_customer_lifetime | num_customers_lost | total_customers_beginning |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| str | F64 | i64 | F64 | i64 | i64 | i64 | F64 | F64 | i64 | i64 | F64 | F64 | i64 | i64 |
| “ 2023-01” | 87454.011885 | 991 | 22958.350559 | 406 | 1969年 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 |
| “ 2023-02” | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 |
| “ 2023-03” | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 |
| “ 2023-04” | 109865.84842 | 885 | 14184.81582 | 428 | 1963年 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 |
| “ 2023-05” | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 |
data . select ( pl . col ( 'cost_of_acquisition' ),
pl . col ( 'new_customers' ),
pl . col ( '*' ). forge_ecommerce . customer_acquisition_cost ( 'cost_of_acquisition' , 'new_customers' )) data . select ( pl . col ( 'total_revenue' ),
pl . col ( 'new_customers' ),
pl . col ( '*' ). forge_ecommerce . average_order_value ( 'total_revenue' , 'number_of_orders' )) data . select ( pl . col ( 'carts_created' ),
pl . col ( 'completed_purchases' ),
pl . col ( '*' ). forge_ecommerce . cart_abandonment_rate ( 'carts_created' , 'completed_purchases' )) data . select ( pl . col ( 'revenue_from_ads' ),
pl . col ( 'advertising_spend' ),
pl . col ( '*' ). forge_ecommerce . return_on_advertising_spend ( 'revenue_from_ads' , 'advertising_spend' )) data . select ( pl . col ( 'num_conversions' ),
pl . col ( 'num_visitors' ),
pl . col ( '*' ). forge_ecommerce . conversion_rate ( 'num_conversions' , 'num_visitors' )) 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' ))| Revenue_per_customer | 平均_customer_lifetime | customer_lifetime_value |
|---|---|---|
| F64 | F64 | F64 |
| 202.427329 | 3.159364 | 639.54169 |
| 116.173436 | 1.812245 | 210.534716 |
| 384.265156 | 4.771414 | 1833.488253 |
| 144.356328 | 3.395462 | 490.156408 |
| 275.734601 | 3.77914 | 1042.039585 |
| … | … | … |
| 290.148089 | 2.182535 | 633.258286 |
| 325.310229 | 1.421977 | 462.583676 |
| 378.206435 | 2.826138 | 1068.863683 |
| 155.732582 | 1.873762 | 291.805755 |
| 341.766952 | 2.66604 | 911.164293 |