如何解决将时间序列分组为层次数据
我正在尝试根据一些示例数据创建一个分层时间序列。我想做的是
第一列成为季度总数,即一年的总数
那是
p = int(input("principal: "))
interest = int(input("annual interest rate: "))
years = int(input("# of years: "))
r = interest / 100
n = years * 12
top = r * (1 + r) ** n
bottom = (1+r) ** n - 1
fraction = top / bottom
A = round(fraction * p,2)
print(A)
到目前为止,我已经做到了:
level 0 : total for the year
level 1: Quarter 1 = (sum of Jan,feb,march,april),etc
level 2 : available data for months Jan to Dec
有没有更简单的方法来构建时间序列
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。