我的数据看起来像这样。
Year Quarter Quantity Price TotalRevenue
0 2000 1 23 142 3266
1 2000 2 23 144 3312
2 2000 3 23 147 3381
3 2000 4 23 151 3473
4 2001 1 22 160 3520
5 2001 2 22 183 4026
6 2001 3 22 186 4092
7 2001 4 22 186 4092
8 2002 1 21 212 4452
9 2002 2 19 232 4408
10 2002 3 19 223 4237
我想弄清楚如何获得'边际收入',其中:
MR = (∆TR/∆Q)
边际收入=(总收入变化)/(数量变化)
我找到了:df.pct_change()但是这似乎得到了一切的百分比变化。
另外,我正在试图弄清楚如何获得相关的东西:
ElasticityPrice = (%ΔQuantity/%ΔPrice)
你的意思是这样的吗?
df['MarginalRevenue'] = df['TotalRevenue'].pct_change() / df['Quantity'].pct_change()
要么
df['MarginalRevenue'] = df['TotalRevenue'].diff() / df['Quantity'].diff()