How do I get just the 5 minute data using Python/pandas out of this csv? For every 5 minute interval I\'m trying to get the DATE, TIME,OPEN, HIGH, LOW, CLOSE, VOLUME for tha
Another way using pandas is to use its TimeGrouper-function.
Its purpose is just meant for use cases like yours.
import pandas as pd
df = pd.DataFrame("Your data provided above")
df["DATE"] = pd.to_datetime(df["DATE"])
df.set_index("DATE", inplace=True)
df = df.groupby(pd.TimeGrouper('5Min')).agg({
"OPEN": "first",
"HIGH": "max",
"LOW": "min",
"CLOSE": "last",
"VOLUME": "sum"
})
The provided script uses an aggregation you might have in mind since you're dealing with stock-data. It aggregates in a way that you will end up with the 5-min candles resulting from your 1-min candles.