Python Forum

Full Version: Help on Time Series problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need guidance on the time series problem below. I tried to do on my own as mentioned below but it is not working. I want to know how can I update the line ‘close_AA=’

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)

#Using the data filtered in the above step list all the closing price from jan to march assign the resulting series to variable 'close_AA'

###Start code here
### tried with ps.series(closeTS) but it is not working
close_AA = 
print (close_AA)###End code(approx 1 line)
close_AA.to_csv("output.txt")
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")