0

我有一个如下所示的 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 小时)

我需要将它加载到熊猫,然后获取一些关于数据的统计信息(最小值,最大值),但我需要数据来包含仅工作时间(8:00 到 18:00 之间)的所有日子的数据记录

我对熊猫图书馆很陌生

4

1 回答 1

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()
于 2013-08-11T18:30:00.773 回答