Enrollments Open for Certification Course on Artificial Intelligence and Deep Learning by IIT RoorkeeApply Now
It is very important for a time series to have a frequency set, so as to consolidate that the data we are working on is free of any missing data.
Since we are working with stock-exchange time-series data, it makes sense to set the frequency of the time-series to business days, meaning the data is recorded for weekdays but not any weekends.
Thanks to pandas, there is a readily available method
asfreq() to set the frequency for the time-series.
asfreq() method converts the time-series to specified frequency.
We could pass an argument to the method to denote frequency. For example,
df.asfreq('d') implies to set the data to a daily frequency. Similarly,
'b' means business days
'30S' means 30 seconds
and so on.
First let us again check the shape of
df_yahoo to set the frequency to business days and store it in
yahoo_data data frame.
yahoo_data = df_yahoo.<< your code comes here >>
Now let us see if there are any extra rows introduced after setting the frequency.
View the last 30 rows of the newly formed
yahoo_data.<< your code comes here >>
Observe that there are extra rows and some missing values after setting the frequency to business days.
Let us see the column wise null values in
yahoo_data.<< you code comes here >>
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here