给定如下数据集:
[{'date': '2017-01', 'CPI': 242.839, 'MoM%': nan, 'YoY%': nan},
{'date': '2017-02', 'CPI': 243.603, 'MoM%': 0.0031, 'YoY%': nan},
{'date': '2017-03', 'CPI': 243.801, 'MoM%': 0.0008, 'YoY%': nan},
{'date': '2017-04', 'CPI': 244.524, 'MoM%': 0.003, 'YoY%': nan},
{'date': '2017-05', 'CPI': 244.733, 'MoM%': 0.0009, 'YoY%': nan},
{'date': '2017-06', 'CPI': 244.955, 'MoM%': 0.0009, 'YoY%': nan},
{'date': '2017-07', 'CPI': 244.786, 'MoM%': -0.0007, 'YoY%': nan},
{'date': '2017-08', 'CPI': 245.519, 'MoM%': 0.003, 'YoY%': nan},
{'date': '2017-09', 'CPI': 246.819, 'MoM%': 0.0053, 'YoY%': nan},
{'date': '2017-10', 'CPI': 246.663, 'MoM%': -0.0006, 'YoY%': nan},
{'date': '2017-11', 'CPI': 246.669, 'MoM%': 0.0, 'YoY%': nan},
{'date': '2017-12', 'CPI': 246.524, 'MoM%': -0.0006, 'YoY%': nan},
{'date': '2018-01', 'CPI': 247.867, 'MoM%': 0.0054, 'YoY%': 0.0207},
{'date': '2018-02', 'CPI': 248.991, 'MoM%': 0.0045, 'YoY%': 0.0221},
{'date': '2018-03', 'CPI': 249.554, 'MoM%': 0.0023, 'YoY%': 0.0236},
{'date': '2018-04', 'CPI': 250.546, 'MoM%': 0.004, 'YoY%': 0.0246},
{'date': '2018-05', 'CPI': 251.588, 'MoM%': 0.0042, 'YoY%': 0.028},
{'date': '2018-06', 'CPI': 251.989, 'MoM%': 0.0016, 'YoY%': 0.0287},
{'date': '2018-07', 'CPI': 252.006, 'MoM%': 0.0001, 'YoY%': 0.0295},
{'date': '2018-08', 'CPI': 252.146, 'MoM%': 0.0006, 'YoY%': 0.027},
{'date': '2018-09', 'CPI': 252.439, 'MoM%': 0.0012, 'YoY%': 0.0228},
{'date': '2018-10', 'CPI': 252.885, 'MoM%': 0.0018, 'YoY%': 0.0252},
{'date': '2018-11', 'CPI': 252.038, 'MoM%': -0.0033, 'YoY%': 0.0218},
{'date': '2018-12', 'CPI': 251.233, 'MoM%': -0.0032, 'YoY%': 0.0191},
{'date': '2019-01', 'CPI': 251.712, 'MoM%': 0.0019, 'YoY%': 0.0155}]
假设CPI
列对我们来说是未知的,那么是否可以基于月环比计算年环比增长率,或者在Python中反之亦然
参考资料:
是的,您可以根据滚动(12个周期)产品的
MoM
增长计算YoY
增长,前提是您的数据中没有遗漏月份。但是,由于在MoM
计算中已经存在舍入,您可能会积累一些错误:如果
MoM
未四舍五入,则更准确:相关问题 更多 >
编程相关推荐