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 |