【发布时间】:2020-12-08 10:56:20
【问题描述】:
假设我有这个简单的数据框:
df = {'time': [1305, 850, 6, 1210], 'freq': [10, 15, 20, 25]}
df = pd.DataFrame(df, columns = ['time','freq'])
time freq
0 1305 10
1 850 15
2 6 20
3 1210 25
其中 1305 表示 13:05,805 表示 08:05,6 表示 00:06,1210 表示 24 小时制的 12:10。
使用python,如何将'time'列转换为hh:mm格式,如上图?
真的很难解决这个问题,所以非常感谢任何帮助:)
【问题讨论】:
-
时间没有格式,它是一个二进制值。在这种情况下,您的 整数 似乎被视为包含时间的 字符串。这不是军事时间。
标签: python pandas dataframe time