import pandas as pdimport iodata = """value "2015-09-25 00:46" 71.925000"2015-09-25 00:47" 71.625000"2015-09-25 00:48" 71.333333"2015-09-25 00:49" 64.571429"2015-09-25 00:50" 72.285714"""df = pd.read_table(io.StringIO(data), delim_whitespace=True)# Converting the index as datedf.index = pd.to_datetime(df.index)# Extracting hour & minutedf['A'] = df.index.hourdf['B'] = df.index.minutedf# value A B# 2015-09-25 00:46:00 71.925000 0 46# 2015-09-25 00:47:00 71.625000 0 47# 2015-09-25 00:48:00 71.333333 0 48# 2015-09-25 00:49:00 64.571429 0 49# 2015-09-25 00:50:00 72.285714 0 50
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)