考虑到不同产品的时间序列分配
我有多种产品的DF(PANDA)包含时间数据(见下文)。这些产品可能在与其他产品的日期相同的日期开始或结束(例如Prod 1和2系列在DN之前完成,而Prod 4在D3和DN之间开始的某个位置)。考虑到每个产品,我想进行时间序列分开。这样,根据产品,我可以在培训和测试上拥有相同的日期。我该怎么做?
date prod value
d1 p1 10
d1 p2 10
d2 p1 15
d2 p2 12
d3 p1 8
d3 p2 5
d3 p3 7
.
dn p2 20
dn p4 10
I have df (pandas) containing temporal data for several products (see below). The products may not start or finish in the same date as the others (eg. prod 1 and 2 series finished before dn, while prod 4 started somewhere between d3 and dn). I want to do a time series split, taking into account each produt. By doing that, I can have the same date on training and test, depending on the product. How do I do that?
date prod value
d1 p1 10
d1 p2 10
d2 p1 15
d2 p2 12
d3 p1 8
d3 p2 5
d3 p3 7
.
dn p2 20
dn p4 10
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用:
如果所有产品都具有相同的索引:
you could use:
if you want all products have the same index: