Metric Forge
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)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_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 |
Customer Acquisition Cost
data.with_columns(pl.col('*').forge_ecommerce.customer_acquisition_cost('cost_of_acquisition', 'new_customers'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | customer_acquisition_cost |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 56.547661 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 80.072112 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 236.296557 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 33.142093 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 70.54263 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 178.485526 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 38.530635 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 225.017992 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 81.444097 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 31.300858 |
Average Order Value
data.with_columns(pl.col('*').forge_ecommerce.average_order_value('total_revenue', 'number_of_orders'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | average_order_value |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 88.248246 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 158.895324 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 94.405666 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 124.142202 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 94.937575 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 206.996386 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 114.819084 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 148.594413 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 99.920248 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 195.466736 |
Cart Abandonment Rate
data.with_columns(pl.col('*').forge_ecommerce.cart_abandonment_rate('carts_created', 'completed_purchases'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | cart_abandonment_rate |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 27.628238 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 5.64409 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 35.537742 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 43.861437 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 20.61447 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 45.758123 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 29.367089 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 16.375 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 39.401496 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 49.823944 |
Return on Advertising Spend
data.with_columns(pl.col('*').forge_ecommerce.return_on_advertising_spend('revenue_from_ads', 'advertising_spend'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | return_on_advertising_spend |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 15.088353 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 4.932621 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 7.833861 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 8.59255 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 18.172438 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 4.721303 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 4.200362 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 1.947612 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 2.663196 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 1.609889 |
Conversion Rate
data.with_columns(pl.col('*').forge_ecommerce.conversion_rate('num_conversions', 'num_visitors'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | conversion_rate |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 2.280675 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 2.892562 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 3.649562 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 0.66172 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 1.121281 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 4.434389 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 3.284672 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 2.188131 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 8.342421 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 2.628044 |
Customer Lifetime Value
data.with_columns(pl.col('*').forge_ecommerce.customer_lifetime_value('revenue_per_customer', 'average_customer_lifetime'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (12, 16)
month | total_revenue | number_of_orders | cost_of_acquisition | new_customers | carts_created | completed_purchases | revenue_from_ads | advertising_spend | num_conversions | num_visitors | revenue_per_customer | average_customer_lifetime | num_customers_lost | total_customers_beginning | customer_lifetime_value |
---|
str | f64 | i64 | f64 | i64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 | f64 | i64 | i64 | f64 |
"2023-01" | 87454.011885 | 991 | 22958.350559 | 406 | 1969 | 1425 | 81339.957696 | 5390.910169 | 300 | 13154 | 202.427329 | 3.159364 | 239 | 3306 | 639.54169 |
"2023-02" | 145071.430641 | 913 | 18736.874206 | 234 | 1506 | 1421 | 76875.083402 | 15585.037018 | 427 | 14762 | 116.173436 | 1.812245 | 124 | 4680 | 210.534716 |
"2023-03" | 123199.394181 | 1305 | 28355.586842 | 120 | 1497 | 965 | 116505.482191 | 14872.037954 | 367 | 10056 | 384.265156 | 4.771414 | 177 | 4675 | 1833.488253 |
"2023-04" | 109865.84842 | 885 | 14184.81582 | 428 | 1963 | 1102 | 106008.046381 | 12337.204368 | 132 | 19948 | 144.356328 | 3.395462 | 299 | 2972 | 490.156408 |
"2023-05" | 65601.864044 | 691 | 18764.339456 | 266 | 1009 | 801 | 97258.809912 | 5351.995568 | 147 | 13110 | 275.734601 | 3.77914 | 296 | 3768 | 1042.039585 |
… | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
"2023-08" | 136617.614577 | 660 | 33555.278842 | 188 | 1108 | 601 | 116872.977654 | 24754.388513 | 392 | 8840 | 290.148089 | 2.182535 | 280 | 3479 | 633.258286 |
"2023-09" | 110111.501174 | 959 | 15990.213465 | 415 | 1975 | 1395 | 84633.082292 | 20148.99937 | 198 | 6028 | 325.310229 | 1.421977 | 239 | 3434 | 462.583676 |
"2023-10" | 120807.25778 | 813 | 25427.033152 | 113 | 800 | 669 | 54839.926382 | 28157.521963 | 271 | 12385 | 378.206435 | 2.826138 | 274 | 2648 | 1068.863683 |
"2023-11" | 52058.44943 | 521 | 27772.437066 | 341 | 2005 | 1215 | 56664.615513 | 21276.925638 | 459 | 5502 | 155.732582 | 1.873762 | 178 | 2317 | 291.805755 |
"2023-12" | 146990.985216 | 752 | 11393.512382 | 364 | 1704 | 855 | 44874.024516 | 27873.991889 | 313 | 11910 | 341.766952 | 2.66604 | 170 | 3257 | 911.164293 |
Product Development
You can use Product Development 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.
import polars as pl
data = pl.read_csv('datasets/customer-value.csv')
data
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 3)
feature_name | importance_score | satisfaction_score |
---|
str | i64 | i64 |
"Feature1" | 8 | 7 |
"Feature2" | 6 | 8 |
"Feature3" | 7 | 9 |
"Feature4" | 8 | 7 |
"Feature5" | 6 | 6 |
"Feature6" | 9 | 8 |
"Feature7" | 7 | 9 |
"Feature8" | 6 | 7 |
"Feature9" | 9 | 8 |
"Feature10" | 8 | 7 |
Underserved Customer Needs
from metric_forge.product_development import *
data.with_columns(pl.col('*').forge_product_dev.opportunity_score(importance_col='importance_score',satisfaction_col='satisfaction_score'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 4)
feature_name | importance_score | satisfaction_score | opportunity_score |
---|
str | i64 | i64 | f64 |
"Feature1" | 8 | 7 | 9.0 |
"Feature2" | 6 | 8 | 4.0 |
"Feature3" | 7 | 9 | 5.0 |
"Feature4" | 8 | 7 | 9.0 |
"Feature5" | 6 | 6 | 6.0 |
"Feature6" | 9 | 8 | 10.0 |
"Feature7" | 7 | 9 | 5.0 |
"Feature8" | 6 | 7 | 5.0 |
"Feature9" | 9 | 8 | 10.0 |
"Feature10" | 8 | 7 | 9.0 |
data.with_columns(pl.col('*').forge_product_dev.customer_value_delivered(importance_col='importance_score',satisfaction_col='satisfaction_score'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 4)
feature_name | importance_score | satisfaction_score | customer_value_delivered |
---|
str | i64 | i64 | f64 |
"Feature1" | 8 | 7 | 0.56 |
"Feature2" | 6 | 8 | 0.48 |
"Feature3" | 7 | 9 | 0.63 |
"Feature4" | 8 | 7 | 0.56 |
"Feature5" | 6 | 6 | 0.36 |
"Feature6" | 9 | 8 | 0.72 |
"Feature7" | 7 | 9 | 0.63 |
"Feature8" | 6 | 7 | 0.42 |
"Feature9" | 9 | 8 | 0.72 |
"Feature10" | 8 | 7 | 0.56 |
data.with_columns(pl.col('*').forge_product_dev.opportunity_to_add_value(importance_col='importance_score',satisfaction_col='satisfaction_score'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 4)
feature_name | importance_score | satisfaction_score | opp_to_add_value |
---|
str | i64 | i64 | f64 |
"Feature1" | 8 | 7 | 0.24 |
"Feature2" | 6 | 8 | 0.12 |
"Feature3" | 7 | 9 | 0.07 |
"Feature4" | 8 | 7 | 0.24 |
"Feature5" | 6 | 6 | 0.24 |
"Feature6" | 9 | 8 | 0.18 |
"Feature7" | 7 | 9 | 0.07 |
"Feature8" | 6 | 7 | 0.18 |
"Feature9" | 9 | 8 | 0.18 |
"Feature10" | 8 | 7 | 0.24 |
import polars as pl
data = pl.read_csv('datasets/customer-value-added.csv')
data
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 4)
feature_name | importance_score | satisfaction_score_before | satisfaction_score_after |
---|
str | i64 | i64 | i64 |
"Feature1" | 8 | 7 | 9 |
"Feature2" | 9 | 8 | 9 |
"Feature3" | 7 | 9 | 8 |
"Feature4" | 8 | 7 | 8 |
"Feature5" | 6 | 6 | 8 |
"Feature6" | 9 | 8 | 9 |
"Feature7" | 7 | 9 | 8 |
"Feature8" | 6 | 7 | 6 |
"Feature9" | 9 | 8 | 8 |
"Feature10" | 8 | 7 | 7 |
data.with_columns(pl.col('*').forge_product_dev.customer_value_created(importance_col='importance_score'
,satisfaction_after_col='satisfaction_score_after'
,satisfaction_before_col='satisfaction_score_before'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (10, 5)
feature_name | importance_score | satisfaction_score_before | satisfaction_score_after | customer_value_created |
---|
str | i64 | i64 | i64 | f64 |
"Feature1" | 8 | 7 | 9 | 0.16 |
"Feature2" | 9 | 8 | 9 | 0.09 |
"Feature3" | 7 | 9 | 8 | -0.07 |
"Feature4" | 8 | 7 | 8 | 0.08 |
"Feature5" | 6 | 6 | 8 | 0.12 |
"Feature6" | 9 | 8 | 9 | 0.09 |
"Feature7" | 7 | 9 | 8 | -0.07 |
"Feature8" | 6 | 7 | 6 | -0.06 |
"Feature9" | 9 | 8 | 8 | 0.0 |
"Feature10" | 8 | 7 | 7 | 0.0 |
Finance
The Finance module contains financial statement objects that you can call certain methods off of to get key financial metrics. You need to define these objects prior to running calcuations.
Financial Statement Objects
from metric_forge import *
fs = import_financials(ticker='MAR',engine='yfinance')
fs
Income Statement
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (5, 49)
date | Tax Effect Of Unusual Items | Tax Rate For Calcs | Normalized EBITDA | Total Unusual Items | Total Unusual Items Excluding Goodwill | Net Income From Continuing Operation Net Minority Interest | Reconciled Depreciation | Reconciled Cost Of Revenue | EBITDA | EBIT | Net Interest Income | Interest Expense | Interest Income | Normalized Income | Net Income From Continuing And Discontinued Operation | Total Expenses | Total Operating Income As Reported | Diluted Average Shares | Basic Average Shares | Diluted EPS | Basic EPS | Diluted NI Availto Com Stockholders | Net Income Common Stockholders | Net Income | Net Income Including Noncontrolling Interests | Net Income Continuous Operations | Tax Provision | Pretax Income | Other Income Expense | Other Non Operating Income Expenses | Special Income Charges | Other Special Charges | Restructuring And Mergern Acquisition | Earnings From Equity Interest | Net Non Operating Interest Income Expense | Interest Expense Non Operating | Interest Income Non Operating | Operating Income | Operating Expense | Depreciation Amortization Depletion Income Statement | Depreciation And Amortization In Income Statement | Selling General And Administration | General And Administrative Expense | Other Gand A | Gross Profit | Cost Of Revenue | Total Revenue | Operating Revenue |
---|
str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
"2023-12-31 00:00:00" | -5.22e6 | 0.087 | 4.2800e9 | -6e7 | -6e7 | 3.0830e9 | 2.77e8 | 1.8501e10 | 4.2200e9 | 3.9430e9 | -5.3500e8 | 5.65e8 | 3e7 | 3.1378e9 | 3.0830e9 | 1.9789e10 | 3.8640e9 | 3.029e8 | 3.015e8 | 10.18 | 10.23 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 2.95e8 | 3.3780e9 | -1.1e7 | 4e7 | -6e7 | null | 6e7 | 9e6 | -5.3500e8 | 5.65e8 | 3e7 | 3.9240e9 | 1.2000e9 | 1.89e8 | 1.89e8 | 1.0110e9 | 1.0110e9 | 1.0110e9 | 5.1240e9 | 1.8589e10 | 2.3713e10 | 6.3880e9 |
"2022-12-31 00:00:00" | -2.916e6 | 0.243 | 3.8110e9 | -1.2e7 | -1.2e7 | 2.3580e9 | 2.82e8 | 1.6126e10 | 3.7990e9 | 3.5170e9 | -3.7700e8 | 4.03e8 | 2.6e7 | 2.3671e9 | 2.3580e9 | 1.7299e10 | 3.4620e9 | 3.258e8 | 3.244e8 | 7.24 | 7.27 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 7.56e8 | 3.1140e9 | 1.7e7 | 1.1e7 | -1.2e7 | null | 1.2e7 | 1.8e7 | -3.7700e8 | 4.03e8 | 2.6e7 | 3.4740e9 | 1.0840e9 | 1.93e8 | 1.93e8 | 8.91e8 | 8.91e8 | 8.91e8 | 4.5580e9 | 1.6215e10 | 2.0773e10 | 5.4450e9 |
"2021-12-31 00:00:00" | -1.1696e7 | 0.068 | 2.0670e9 | -1.7200e8 | -1.7200e8 | 1.0990e9 | 2.95e8 | 1.0981e10 | 1.8950e9 | 1.6000e9 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.2593e9 | 1.0990e9 | 1.2099e10 | 1.7500e9 | 3.293e8 | 3.272e8 | 3.34 | 3.36 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 8.1e7 | 1.1800e9 | -1.8600e8 | 1e7 | -1.7200e8 | 1.64e8 | 8e6 | -2.4e7 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.7580e9 | 1.0430e9 | 2.2e8 | 2.2e8 | 8.23e8 | 8.23e8 | 8.23e8 | 2.8010e9 | 1.1056e10 | 1.3857e10 | 3.4900e9 |
"2020-12-31 00:00:00" | -7.209e7 | 0.27 | 7.24e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | 4.78e8 | 8.9800e9 | 4.57e8 | -2.1e7 | -4.1800e8 | 4.45e8 | 2.7e7 | -7.209e7 | -2.6700e8 | 1.0220e10 | 8.4e7 | 3.258e8 | 3.258e8 | -0.82 | -0.82 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -1.9900e8 | -4.6600e8 | -3.9900e8 | 9e6 | -2.6700e8 | null | 2.67e8 | -1.4100e8 | -4.1800e8 | 4.45e8 | 2.7e7 | 3.51e8 | 1.1080e9 | 3.46e8 | 3.46e8 | 7.62e8 | 7.62e8 | 7.62e8 | 1.4590e9 | 9.1120e9 | 1.0571e10 | 2.1190e9 |
"2019-12-31 00:00:00" | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | -1.5400e8 | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null |
Balance Sheet
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (5, 69)
date | Ordinary Shares Number | Share Issued | Net Debt | Total Debt | Tangible Book Value | Invested Capital | Working Capital | Net Tangible Assets | Capital Lease Obligations | Common Stock Equity | Total Capitalization | Total Equity Gross Minority Interest | Stockholders Equity | Gains Losses Not Affecting Retained Earnings | Other Equity Adjustments | Treasury Stock | Retained Earnings | Additional Paid In Capital | Capital Stock | Common Stock | Total Liabilities Net Minority Interest | Total Non Current Liabilities Net Minority Interest | Other Non Current Liabilities | Non Current Deferred Liabilities | Non Current Deferred Revenue | Non Current Deferred Taxes Liabilities | Long Term Debt And Capital Lease Obligation | Long Term Capital Lease Obligation | Long Term Debt | Current Liabilities | Other Current Liabilities | Current Debt And Capital Lease Obligation | Current Debt | Payables And Accrued Expenses | Current Accrued Expenses | Payables | Accounts Payable | Total Assets | Total Non Current Assets | Other Non Current Assets | Non Current Deferred Assets | Non Current Deferred Taxes Assets | Non Current Note Receivables | Investments And Advances | Long Term Equity Investment | Goodwill And Other Intangible Assets | Other Intangible Assets | Goodwill | Net PPE | Accumulated Depreciation | Gross PPE | Construction In Progress | Other Properties | Machinery Furniture Equipment | Buildings And Improvements | Land And Improvements | Properties | Current Assets | Other Current Assets | Assets Held For Sale Current | Prepaid Assets | Receivables | Accounts Receivable | Allowance For Doubtful Accounts Receivable | Gross Accounts Receivable | Cash Cash Equivalents And Short Term Investments | Cash And Cash Equivalents | Cash Financial |
---|
str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
"2023-12-31 00:00:00" | 2.90539975e8 | 2.90539975e8 | 1.1535e10 | 1.2760e10 | -1.8758e10 | 1.1191e10 | -4.4510e9 | -1.8758e10 | 8.87e8 | -6.8200e8 | 1.0638e10 | -6.8200e8 | -6.8200e8 | -6.4700e8 | -6.4700e8 | 2.0929e10 | 1.4838e10 | 6.0510e9 | 5e6 | 5e6 | 2.6356e10 | 1.8594e10 | 5.1600e9 | 1.2270e9 | 1.0180e9 | 2.09e8 | 1.2207e10 | 8.87e8 | 1.1320e10 | 7.7620e9 | 3.3280e9 | 5.53e8 | 5.53e8 | 3.8810e9 | 3.1430e9 | 7.38e8 | 7.38e8 | 2.5674e10 | 2.2363e10 | 6.58e8 | 6.73e8 | 6.73e8 | 1.38e8 | 3.08e8 | 3.08e8 | 1.8076e10 | 9.1900e9 | 8.8860e9 | 2.5100e9 | -8.9000e8 | 3.4000e9 | 7.2e7 | 9.29e8 | 6.22e8 | 1.1080e9 | 6.69e8 | 0.0 | 3.3110e9 | 2.61e8 | null | null | 2.7120e9 | 2.7120e9 | -1.9700e8 | 2.9090e9 | 3.38e8 | 3.38e8 | null |
"2022-12-31 00:00:00" | 3.106e8 | 3.106e8 | 9.5570e9 | 1.1098e10 | -1.7051e10 | 1.0632e10 | -4.0260e9 | -1.7051e10 | 1.0340e9 | 5.68e8 | 9.9480e9 | 5.68e8 | 5.68e8 | -7.2900e8 | -7.2900e8 | 1.7015e10 | 1.2342e10 | 5.9650e9 | 5e6 | 5e6 | 2.4247e10 | 1.6908e10 | 5.1220e9 | 1.3720e9 | 1.0590e9 | 3.13e8 | 1.0414e10 | 1.0340e9 | 9.3800e9 | 7.3390e9 | 3.3140e9 | 6.84e8 | 6.84e8 | 3.3410e9 | 2.5950e9 | 7.46e8 | 7.46e8 | 2.4815e10 | 2.1502e10 | 5.84e8 | 2.4e8 | 2.4e8 | 1.52e8 | 3.35e8 | 3.35e8 | 1.7619e10 | 8.7470e9 | 8.8720e9 | 2.5720e9 | -8.7400e8 | 3.4460e9 | 3.6e7 | 9.87e8 | 6.49e8 | 1.0860e9 | 6.88e8 | 0.0 | 3.3130e9 | 2.35e8 | null | null | 2.5710e9 | 2.5710e9 | -1.9100e8 | 2.7620e9 | 5.07e8 | 5.07e8 | null |
"2021-12-31 00:00:00" | 3.273e8 | 3.273e8 | 8.7450e9 | 1.1236e10 | -1.6585e10 | 1.1552e10 | -2.7810e9 | -1.6585e10 | 1.0980e9 | 1.4140e9 | 1.0747e10 | 1.4140e9 | 1.4140e9 | -3.4200e8 | -3.4200e8 | 1.4446e10 | 1.0305e10 | 5.8920e9 | 5e6 | 5e6 | 2.4139e10 | 1.7732e10 | 5.9510e9 | 1.3500e9 | 1.1810e9 | 1.69e8 | 1.0431e10 | 1.0980e9 | 9.3330e9 | 6.4070e9 | 2.5220e9 | 8.05e8 | 8.05e8 | 3.0800e9 | 2.3540e9 | 7.26e8 | 7.26e8 | 2.5553e10 | 2.1927e10 | 6.04e8 | 2.28e8 | 2.28e8 | 1.44e8 | 3.87e8 | 3.87e8 | 1.7999e10 | 8.9260e9 | 9.0730e9 | 2.5650e9 | -8.5000e8 | 3.4150e9 | 1.37e8 | 1.0620e9 | 5.45e8 | 9.85e8 | 6.86e8 | 0.0 | 3.6260e9 | 2.51e8 | null | 2.51e8 | 1.9820e9 | 1.9820e9 | -1.8700e8 | 2.1690e9 | 1.3930e9 | 1.3930e9 | null |
"2020-12-31 00:00:00" | 3.244e8 | 3.244e8 | 9.4990e9 | 1.1199e10 | -1.7734e10 | 1.0806e10 | -2.9270e9 | -1.7734e10 | 8.23e8 | 4.3e8 | 9.6330e9 | 4.3e8 | 4.3e8 | -1.3500e8 | -1.3500e8 | 1.4497e10 | 9.2060e9 | 5.8510e9 | 5e6 | 5e6 | 2.4271e10 | 1.8519e10 | 6.8680e9 | 1.6250e9 | 1.5420e9 | 8.3e7 | 1.0026e10 | 8.23e8 | 9.2030e9 | 5.7520e9 | 1.7690e9 | 1.1730e9 | 1.1730e9 | 2.8100e9 | 2.2830e9 | 5.27e8 | 5.27e8 | 2.4701e10 | 2.1876e10 | 6.16e8 | 2.49e8 | 2.49e8 | 1.59e8 | 4.22e8 | null | 1.8164e10 | 8.9890e9 | 9.1750e9 | 2.2660e9 | -8.8800e8 | 3.1540e9 | 2.9e7 | 7.52e8 | 6.4e8 | 1.0450e9 | 6.88e8 | 0.0 | 2.8250e9 | 1.8e8 | 8e6 | 1.8e8 | 1.7680e9 | 1.7680e9 | null | null | 8.77e8 | 8.77e8 | null |
"2019-12-31 00:00:00" | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | 2.55e8 | 2.52e8 | null | null | null | null | null | null | 2.25e8 |
Cash Flow
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (5, 44)
date | Free Cash Flow | Repurchase Of Capital Stock | Repayment Of Debt | Issuance Of Debt | Issuance Of Capital Stock | Capital Expenditure | End Cash Position | Beginning Cash Position | Changes In Cash | Financing Cash Flow | Cash Flow From Continuing Financing Activities | Net Other Financing Charges | Cash Dividends Paid | Common Stock Dividend Paid | Net Common Stock Issuance | Common Stock Payments | Common Stock Issuance | Net Issuance Payments Of Debt | Net Short Term Debt Issuance | Net Long Term Debt Issuance | Long Term Debt Payments | Long Term Debt Issuance | Investing Cash Flow | Cash Flow From Continuing Investing Activities | Net Other Investing Changes | Net Business Purchase And Sale | Sale Of Business | Purchase Of Business | Net PPE Purchase And Sale | Sale Of PPE | Capital Expenditure Reported | Operating Cash Flow | Cash Flow From Continuing Operating Activities | Change In Working Capital | Other Non Cash Items | Stock Based Compensation | Deferred Tax | Deferred Income Tax | Depreciation Amortization Depletion | Depreciation And Amortization | Depreciation | Operating Gains Losses | Net Income From Continuing Operations |
---|
str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
"2023-12-31 00:00:00" | 2.7180e9 | -3.9530e9 | -6.8400e8 | 1.9180e9 | 2.9e7 | -4.5200e8 | 3.66e8 | 5.25e8 | -1.5900e8 | -2.8640e9 | -2.8640e9 | -1.3300e8 | -5.8700e8 | -5.8700e8 | -3.9240e9 | -3.9530e9 | 2.9e7 | 1.7800e9 | 5.46e8 | 1.2340e9 | -6.8400e8 | 1.9180e9 | -4.6500e8 | -4.6500e8 | 1.7e7 | -1.0100e8 | null | -1.0100e8 | 7.1e7 | 7.1e7 | -4.5200e8 | 3.1700e9 | 3.1700e9 | 6.9e7 | 1.48e8 | 2.05e8 | -6.1200e8 | -6.1200e8 | 2.77e8 | 2.77e8 | 2.77e8 | null | 3.0830e9 |
"2022-12-31 00:00:00" | 2.0310e9 | -2.5660e9 | -8.0400e8 | 9.83e8 | 0.0 | -3.3200e8 | 5.25e8 | 1.4210e9 | -8.9600e8 | -2.9620e9 | -2.9620e9 | -7.2e7 | -3.2100e8 | -3.2100e8 | -2.5660e9 | -2.5660e9 | 0.0 | -3e6 | -1.8200e8 | 1.79e8 | -8.0400e8 | 9.83e8 | -2.9700e8 | -2.9700e8 | 3.4e7 | 0.0 | null | 0.0 | 1e6 | 1e6 | -3.3200e8 | 2.3630e9 | 2.3630e9 | -5.4200e8 | -2.0700e8 | 1.92e8 | 2.8e8 | 2.8e8 | 2.82e8 | 2.82e8 | 2.82e8 | null | 2.3580e9 |
"2021-12-31 00:00:00" | 9.94e8 | 0.0 | -2.1740e9 | 1.7930e9 | 2e6 | -1.8300e8 | 1.4210e9 | 8.94e8 | 5.27e8 | -4.6300e8 | -4.6300e8 | -2.3400e8 | 0.0 | 0.0 | 2e6 | 0.0 | 2e6 | -2.3100e8 | 1.5e8 | -3.8100e8 | -2.1740e9 | 1.7930e9 | -1.8700e8 | -1.8700e8 | -1.6e7 | 0.0 | null | 0.0 | 1.2e7 | 1.2e7 | -1.8300e8 | 1.1770e9 | 1.1770e9 | 1.1e8 | -3.9200e8 | 1.82e8 | -2.8100e8 | -2.8100e8 | 2.95e8 | 2.95e8 | 2.95e8 | 1.64e8 | 1.0990e9 |
"2020-12-31 00:00:00" | 1.5040e9 | -1.5000e8 | -1.8870e9 | 3.5610e9 | 0.0 | -1.3500e8 | 8.94e8 | 2.53e8 | 6.41e8 | -1.0330e9 | -1.0330e9 | -1.1100e8 | -1.5600e8 | -1.5600e8 | -1.5000e8 | -1.5000e8 | 0.0 | -6.1600e8 | -2.2900e9 | 1.6740e9 | -1.8870e9 | 3.5610e9 | 3.5e7 | 3.5e7 | -9e7 | 2.6e8 | 2.6e8 | null | 2.6e8 | 2.6e8 | -1.3500e8 | 1.6390e9 | 1.6390e9 | -2.8e7 | 1.7300e9 | 2.01e8 | -4.7800e8 | -4.7800e8 | 4.78e8 | 4.78e8 | 4.78e8 | 3e6 | -2.6700e8 |
"2019-12-31 00:00:00" | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | 3.95e8 | null | null | null | null | null | null | null | null | null | null | null | null | null | null | -1.4700e8 | null |
FinancialStatements(ticker=MAR)
Income Statement
import polars as pl
fs.income_statement.with_columns(pl.col('*').forge_income_statement.gross_profit_margin(revenue_column='Total Revenue',cogs_column='Cost Of Revenue'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (5, 50)
date | Tax Effect Of Unusual Items | Tax Rate For Calcs | Normalized EBITDA | Total Unusual Items | Total Unusual Items Excluding Goodwill | Net Income From Continuing Operation Net Minority Interest | Reconciled Depreciation | Reconciled Cost Of Revenue | EBITDA | EBIT | Net Interest Income | Interest Expense | Interest Income | Normalized Income | Net Income From Continuing And Discontinued Operation | Total Expenses | Total Operating Income As Reported | Diluted Average Shares | Basic Average Shares | Diluted EPS | Basic EPS | Diluted NI Availto Com Stockholders | Net Income Common Stockholders | Net Income | Net Income Including Noncontrolling Interests | Net Income Continuous Operations | Tax Provision | Pretax Income | Other Income Expense | Other Non Operating Income Expenses | Special Income Charges | Other Special Charges | Restructuring And Mergern Acquisition | Earnings From Equity Interest | Net Non Operating Interest Income Expense | Interest Expense Non Operating | Interest Income Non Operating | Operating Income | Operating Expense | Depreciation Amortization Depletion Income Statement | Depreciation And Amortization In Income Statement | Selling General And Administration | General And Administrative Expense | Other Gand A | Gross Profit | Cost Of Revenue | Total Revenue | Operating Revenue | gross_profit_margin |
---|
str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
"2023-12-31 00:00:00" | -5.22e6 | 0.087 | 4.2800e9 | -6e7 | -6e7 | 3.0830e9 | 2.77e8 | 1.8501e10 | 4.2200e9 | 3.9430e9 | -5.3500e8 | 5.65e8 | 3e7 | 3.1378e9 | 3.0830e9 | 1.9789e10 | 3.8640e9 | 3.029e8 | 3.015e8 | 10.18 | 10.23 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 2.95e8 | 3.3780e9 | -1.1e7 | 4e7 | -6e7 | null | 6e7 | 9e6 | -5.3500e8 | 5.65e8 | 3e7 | 3.9240e9 | 1.2000e9 | 1.89e8 | 1.89e8 | 1.0110e9 | 1.0110e9 | 1.0110e9 | 5.1240e9 | 1.8589e10 | 2.3713e10 | 6.3880e9 | 0.216084 |
"2022-12-31 00:00:00" | -2.916e6 | 0.243 | 3.8110e9 | -1.2e7 | -1.2e7 | 2.3580e9 | 2.82e8 | 1.6126e10 | 3.7990e9 | 3.5170e9 | -3.7700e8 | 4.03e8 | 2.6e7 | 2.3671e9 | 2.3580e9 | 1.7299e10 | 3.4620e9 | 3.258e8 | 3.244e8 | 7.24 | 7.27 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 7.56e8 | 3.1140e9 | 1.7e7 | 1.1e7 | -1.2e7 | null | 1.2e7 | 1.8e7 | -3.7700e8 | 4.03e8 | 2.6e7 | 3.4740e9 | 1.0840e9 | 1.93e8 | 1.93e8 | 8.91e8 | 8.91e8 | 8.91e8 | 4.5580e9 | 1.6215e10 | 2.0773e10 | 5.4450e9 | 0.219419 |
"2021-12-31 00:00:00" | -1.1696e7 | 0.068 | 2.0670e9 | -1.7200e8 | -1.7200e8 | 1.0990e9 | 2.95e8 | 1.0981e10 | 1.8950e9 | 1.6000e9 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.2593e9 | 1.0990e9 | 1.2099e10 | 1.7500e9 | 3.293e8 | 3.272e8 | 3.34 | 3.36 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 8.1e7 | 1.1800e9 | -1.8600e8 | 1e7 | -1.7200e8 | 1.64e8 | 8e6 | -2.4e7 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.7580e9 | 1.0430e9 | 2.2e8 | 2.2e8 | 8.23e8 | 8.23e8 | 8.23e8 | 2.8010e9 | 1.1056e10 | 1.3857e10 | 3.4900e9 | 0.202136 |
"2020-12-31 00:00:00" | -7.209e7 | 0.27 | 7.24e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | 4.78e8 | 8.9800e9 | 4.57e8 | -2.1e7 | -4.1800e8 | 4.45e8 | 2.7e7 | -7.209e7 | -2.6700e8 | 1.0220e10 | 8.4e7 | 3.258e8 | 3.258e8 | -0.82 | -0.82 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -1.9900e8 | -4.6600e8 | -3.9900e8 | 9e6 | -2.6700e8 | null | 2.67e8 | -1.4100e8 | -4.1800e8 | 4.45e8 | 2.7e7 | 3.51e8 | 1.1080e9 | 3.46e8 | 3.46e8 | 7.62e8 | 7.62e8 | 7.62e8 | 1.4590e9 | 9.1120e9 | 1.0571e10 | 2.1190e9 | 0.138019 |
"2019-12-31 00:00:00" | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | -1.5400e8 | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null |
fs.income_statement.with_columns(pl.col('*').forge_income_statement.net_profit_margin(revenue_column='Total Revenue',cogs_column='Cost Of Revenue',expenses_column='Total Expenses'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (5, 50)
date | Tax Effect Of Unusual Items | Tax Rate For Calcs | Normalized EBITDA | Total Unusual Items | Total Unusual Items Excluding Goodwill | Net Income From Continuing Operation Net Minority Interest | Reconciled Depreciation | Reconciled Cost Of Revenue | EBITDA | EBIT | Net Interest Income | Interest Expense | Interest Income | Normalized Income | Net Income From Continuing And Discontinued Operation | Total Expenses | Total Operating Income As Reported | Diluted Average Shares | Basic Average Shares | Diluted EPS | Basic EPS | Diluted NI Availto Com Stockholders | Net Income Common Stockholders | Net Income | Net Income Including Noncontrolling Interests | Net Income Continuous Operations | Tax Provision | Pretax Income | Other Income Expense | Other Non Operating Income Expenses | Special Income Charges | Other Special Charges | Restructuring And Mergern Acquisition | Earnings From Equity Interest | Net Non Operating Interest Income Expense | Interest Expense Non Operating | Interest Income Non Operating | Operating Income | Operating Expense | Depreciation Amortization Depletion Income Statement | Depreciation And Amortization In Income Statement | Selling General And Administration | General And Administrative Expense | Other Gand A | Gross Profit | Cost Of Revenue | Total Revenue | Operating Revenue | net_profit_margin |
---|
str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
"2023-12-31 00:00:00" | -5.22e6 | 0.087 | 4.2800e9 | -6e7 | -6e7 | 3.0830e9 | 2.77e8 | 1.8501e10 | 4.2200e9 | 3.9430e9 | -5.3500e8 | 5.65e8 | 3e7 | 3.1378e9 | 3.0830e9 | 1.9789e10 | 3.8640e9 | 3.029e8 | 3.015e8 | 10.18 | 10.23 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 3.0830e9 | 2.95e8 | 3.3780e9 | -1.1e7 | 4e7 | -6e7 | null | 6e7 | 9e6 | -5.3500e8 | 5.65e8 | 3e7 | 3.9240e9 | 1.2000e9 | 1.89e8 | 1.89e8 | 1.0110e9 | 1.0110e9 | 1.0110e9 | 5.1240e9 | 1.8589e10 | 2.3713e10 | 6.3880e9 | -0.618437 |
"2022-12-31 00:00:00" | -2.916e6 | 0.243 | 3.8110e9 | -1.2e7 | -1.2e7 | 2.3580e9 | 2.82e8 | 1.6126e10 | 3.7990e9 | 3.5170e9 | -3.7700e8 | 4.03e8 | 2.6e7 | 2.3671e9 | 2.3580e9 | 1.7299e10 | 3.4620e9 | 3.258e8 | 3.244e8 | 7.24 | 7.27 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 2.3580e9 | 7.56e8 | 3.1140e9 | 1.7e7 | 1.1e7 | -1.2e7 | null | 1.2e7 | 1.8e7 | -3.7700e8 | 4.03e8 | 2.6e7 | 3.4740e9 | 1.0840e9 | 1.93e8 | 1.93e8 | 8.91e8 | 8.91e8 | 8.91e8 | 4.5580e9 | 1.6215e10 | 2.0773e10 | 5.4450e9 | -0.613344 |
"2021-12-31 00:00:00" | -1.1696e7 | 0.068 | 2.0670e9 | -1.7200e8 | -1.7200e8 | 1.0990e9 | 2.95e8 | 1.0981e10 | 1.8950e9 | 1.6000e9 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.2593e9 | 1.0990e9 | 1.2099e10 | 1.7500e9 | 3.293e8 | 3.272e8 | 3.34 | 3.36 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 1.0990e9 | 8.1e7 | 1.1800e9 | -1.8600e8 | 1e7 | -1.7200e8 | 1.64e8 | 8e6 | -2.4e7 | -3.9200e8 | 4.2e8 | 2.8e7 | 1.7580e9 | 1.0430e9 | 2.2e8 | 2.2e8 | 8.23e8 | 8.23e8 | 8.23e8 | 2.8010e9 | 1.1056e10 | 1.3857e10 | 3.4900e9 | -0.670997 |
"2020-12-31 00:00:00" | -7.209e7 | 0.27 | 7.24e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | 4.78e8 | 8.9800e9 | 4.57e8 | -2.1e7 | -4.1800e8 | 4.45e8 | 2.7e7 | -7.209e7 | -2.6700e8 | 1.0220e10 | 8.4e7 | 3.258e8 | 3.258e8 | -0.82 | -0.82 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -2.6700e8 | -1.9900e8 | -4.6600e8 | -3.9900e8 | 9e6 | -2.6700e8 | null | 2.67e8 | -1.4100e8 | -4.1800e8 | 4.45e8 | 2.7e7 | 3.51e8 | 1.1080e9 | 3.46e8 | 3.46e8 | 7.62e8 | 7.62e8 | 7.62e8 | 1.4590e9 | 9.1120e9 | 1.0571e10 | 2.1190e9 | -0.828777 |
"2019-12-31 00:00:00" | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | -1.5400e8 | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null |
Mortgage
The Mortgage module contains mortgage objects that you enable you to assess mortgage metrics. You need to define these objects prior to running calcuations.
from metric_forge.mortgage import *
mortgage = Mortgage(principal=390000,annual_interest_rate=5.75,start_date='2023-09-01',term_years=30,extra_principal_payment=200)
mortgage.calculate_monthly_payment()
2275.934140129842
mortgage.generate_amortization_schedule()
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (360, 6)
payment_number | payment_date | payment | interest_payment | principal_payment | principal_remaining |
---|
i64 | str | f64 | f64 | f64 | f64 |
1 | "2023-10-01" | 2275.93414 | 1868.75 | 407.18414 | 389592.81586 |
2 | "2023-10-31" | 2275.93414 | 1866.798909 | 409.135231 | 389183.680629 |
3 | "2023-11-30" | 2275.93414 | 1864.83847 | 411.09567 | 388772.584959 |
4 | "2023-12-30" | 2275.93414 | 1862.868636 | 413.065504 | 388359.519455 |
5 | "2024-01-29" | 2275.93414 | 1860.889364 | 415.044776 | 387944.474679 |
… | … | … | … | … | … |
356 | "2052-11-27" | 2275.93414 | 53.752435 | 2222.181705 | 8995.717798 |
357 | "2052-12-27" | 2275.93414 | 43.104481 | 2232.829659 | 6762.888139 |
358 | "2053-01-26" | 2275.93414 | 32.405506 | 2243.528634 | 4519.359505 |
359 | "2053-02-25" | 2275.93414 | 21.655264 | 2254.278876 | 2265.080629 |
360 | "2053-03-27" | 2275.93414 | 10.853511 | 2265.080629 | 1.2655e-8 |
mortgage.calculate_principal_only_payment()
{'new_term_years': 24.502707600761994, 'time_saved_years': 5.497292399238006}
mortgage.refinance_assessment(RefinanceOption(new_loan_amount=340000,new_annual_interest_rate=5.25,new_term_years=30,associated_costs=5000))
{'Old Monthly Payment': 2275.934140129842,
'New Monthly Payment': 1877.492587282451,
'Monthly Savings': 398.441552847391,
'Break-Even Point (months)': 12.548891962367875,
'Total Savings (over the loan term)': 138438.95902506076,
'Should Refinance': True}
Web Traffic
from metric_forge.web_traffic import *
import polars as pl
data = pl.read_csv('datasets/web_traffic.csv')
data
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 8)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 |
Average Session Duration
data.with_columns(pl.col('*').forge_web_traffic.average_session_duration(total_duration_col='total_duration', total_sessions_col='total_sessions'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | average_session_duration |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 120.0 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 100.0 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | 30.0 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 100.0 |
Bounce Rate
data.with_columns(pl.col('*').forge_web_traffic.bounce_rate(single_page_sessions_col='single_page_sessions', total_sessions_col='total_sessions'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | bounce_rate |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 20.0 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 20.0 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | 50.0 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 20.0 |
Click Through Rate
data.with_columns(pl.col('*').forge_web_traffic.click_through_rate(num_clicks_col='num_clicks', num_impressions_col='num_impressions'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | click_through_rate |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 10.0 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 10.0 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | NaN |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 10.0 |
Cost Per Click
data.with_columns(pl.col('*').forge_web_traffic.cost_per_click(total_cost_col='total_cost',num_clicks_col='num_clicks'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | cost_per_click |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 0.5 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 0.5 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | 0.0 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 0.5 |
Exit Rate
data.with_columns(pl.col('*').forge_web_traffic.exit_rate(exits_col='exits',total_page_views_col='total_page_views'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | exit_rate |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 10.0 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 10.0 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | 10.0 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 10.0 |
Pages Per Session
data.with_columns(pl.col('*').forge_web_traffic.pages_per_session(total_page_views_col='total_page_views',total_sessions_col='total_sessions'))
<style>
.dataframe > thead > tr,
.dataframe > tbody > tr {
text-align: right;
white-space: pre-wrap;
}
</style>
shape: (4, 9)
total_duration | total_sessions | single_page_sessions | num_clicks | num_impressions | total_cost | exits | total_page_views | pages_per_session |
---|
i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | f64 |
1200 | 10 | 2 | 100 | 1000 | 50 | 5 | 50 | 5.0 |
1500 | 15 | 3 | 150 | 1500 | 75 | 7 | 70 | 4.666667 |
60 | 2 | 1 | 0 | 0 | 0 | 2 | 20 | 10.0 |
2500 | 25 | 5 | 200 | 2000 | 100 | 10 | 100 | 4.0 |