原始数据
Touch Time Install Time
3/28/2019 14:06 3/28/2019 15:34
3/27/2019 19:23 3/28/2019 15:22
3/28/2019 15:01 3/28/2019 15:18
3/28/2019 12:41 3/28/2019 15:18
3/27/2019 12:10 3/28/2019 15:08
在此之后,我使用 read_csv 读取了 csv 并创建了一个新的列差异
df['diff'] = pd.to_datetime(df['Install Time']) - pd.to_datetime(df['Touch Time'])
这会创建一个列差异:
Touch Time Install Time diff
0 3/28/2019 14:06 3/28/2019 15:34 0 days 01:28:00
1 3/27/2019 19:23 3/28/2019 15:22 0 days 19:59:00
2 3/28/2019 15:01 3/28/2019 15:18 0 days 00:17:00
3 3/28/2019 12:41 3/28/2019 15:18 0 days 02:37:00
4 3/27/2019 12:10 3/28/2019 15:08 1 days 02:58:00
对于我的分析,我想将 diff 列中的值转换为小时,然后使用 matplotlib 绘制它。
我希望最终数据如下所示:
0 days 01:28:00 should reflect as 1
1 days 02:58:00 should reflect as 26
慕桂英546537
慕斯709654
相关分类