Skip to content Skip to sidebar Skip to footer

Get Grouped Informations From An Array With Pandas

I have a Dataset structured like this: 'Date','Time','Open','High','Low','Close','Up','Down','Volume' 01/03/2000,00:05,1481.50,1481.50,1481.00,1481.00,2,0,0.00 01/03/2000,00:10,14

Solution 1:

Use groupby and agg:

df.groupby('Date').agg({
    'Close': 'last',
    'Open': 'first',
    'High': 'max',
    'Low': 'min',
    'Volume': 'sum'
})

Output:

CloseOpenHighLowVolumeDate01/03/20001480.50 1481.50 1481.5  1480.5  2.003/01/20182707.25 2717.25 2718.0  2706.0  59663.0

Post a Comment for "Get Grouped Informations From An Array With Pandas"