我有一个DataFrame(dataframeA)和一列日期,格式如下
日期
19960826年
19960826年
19970303年
19970320年
19970905年
以及一列值
值
100
35
11
37
... 你知道吗
以及一列组
团购
组L
组m
... 你知道吗
给定另一个数据帧dataframeB,它有两列:格式为yyyymmdd的日期和组。对于dataframeB中的每一行,如何绘制每个组的日期前后60天内的值。你知道吗
例如,如果dataframeB第一行是
20050101集团
图(在Y轴上)dataframeA中的值,其中日期在2005年1月1日之前或之后的50天内,组为groupM。你知道吗
以下是一些示例数据:
注意:如果需要使datetime对象在视觉上看起来像
YYYYMMDD
,可以使用strftime()
并根据需要切换回datetime,例如:现在,假设出于某种原因需要将这些数据帧分开(即不允许
merge()
),那么下面的方法应该可以工作。你知道吗以下是几天的子集的输出示例:
相关问题 更多 >
编程相关推荐