Lets say the input df is like below,
DateTime Length
0 2018-01-01 100
1 2018-02-01 100
2 2018-03-01 100
3 2018-04-01 100
4 2018-05-01 100
Try the code:
df1 = df.groupby(['DateTime']).agg({'Length': ['min', 'mean', 'max']}).reset_index()
outputdatelist = df1['DateTime'].tolist()
outputlen_min = df1['Length']['min'].tolist()
Prints:
print(outputdatelist)
['2018-01-01', '2018-02-01', '2018-03-01', '2018-04-01', '2018-05-01']
print(outputlen_min)
[100, 100, 100, 100, 100]
similarly for mean
and max
columns.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…