Question on upsample and downsample

I need help on the below upsample/downsample time series problem and I’m not certain how to complete it. I have a given a try but no luck.

import pandas as pd
dataFrame = pd.read_csv(‘dow_jones_index.data’,parse_dates=[“date”], index_col=“date”)
dataFrame.head()
closeTS = dataFrame[(dataFrame.stock == ‘AA’)].close.str.replace(’$’,’ ').astype(float)
###Upsample the data filtered in the above step month wise and fill the max value of closing price for each month
###return the samples of down sampled data to variable ‘upsample’

###Start code here

tried upsample=closeTS but it is not working

upsample =
print(upsample)
###End code(approx 1 line)
upsample.to_csv(“output.txt”)

1 Like

upsample = closeTS.resample(‘M’).max()
print(upsample)
###End code(approx 1 line)
upsample.to_csv(“output.txt”)

this might help you