我有一个csv文件,如下所示:
"06/09/2013 14:08:34.930","7.2680542849633447","1.6151231744362988","0","0","21","1546964992","15.772567829158248","1577332736","8360","21.400382061280961","0","15","0","685","0","0","0","0","0","0","0","4637","0"
csv包括每月1个月的值(24小时)
我需要将它加载到pandas然后获取一些关于数据的统计数据(min,max)但是我需要数据包括仅工作时间(8:00到18:00之间)的所有日期的数据记录< / p>
我是pandas library的新手
答案 0 :(得分:0)
加载您的数据:
import pandas as pd
from datetime import datetime
df = pd.read_csv('data.csv', header=None, index_col=0)
从8:00到18:00过滤工作时间数据:
work_hours = lambda d: datetime.strptime(d, '%d/%m/%Y %H:%M:%S.%f').hour in range(8, 18)
df = df[map(work_hours, df.index)]
获取第一个数据列的最小值和最大值:
min, max = df[1].min(), df[1].max()