0
0
ML Pythonml~10 mins

Why time series has unique challenges in ML Python - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the library used for time series data handling.

ML Python
import [1] as pd
Drag options to blanks, or click blank then click option'
Amatplotlib
Bpandas
Cnumpy
Dsklearn
Attempts:
3 left
💡 Hint
Common Mistakes
Using numpy which is for numerical arrays but lacks time series specific features.
2fill in blank
medium

Complete the code to convert a column to datetime format for time series analysis.

ML Python
df['date'] = pd.to_datetime(df['[1]'])
Drag options to blanks, or click blank then click option'
Adate
Bdate_string
Cvalue
Dtimestamp
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong column name that does not exist in the data.
3fill in blank
hard

Fix the error in the code to set the datetime column as the index for time series data.

ML Python
df.set_index('[1]', inplace=True)
Drag options to blanks, or click blank then click option'
Aindex
Btime
Cdate
Dtimestamp
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-datetime column as index causing errors in time series operations.
4fill in blank
hard

Fill both blanks to resample the time series data to monthly frequency and calculate the mean.

ML Python
monthly_data = df.[1]('M').[2]()
Drag options to blanks, or click blank then click option'
Aresample
Bmean
Csum
Dgroupby
Attempts:
3 left
💡 Hint
Common Mistakes
Using groupby instead of resample which does not handle time frequency.
5fill in blank
hard

Fill all three blanks to create a lag feature for the time series data.

ML Python
df['lag_[1]'] = df['value'].[2]([3])
Drag options to blanks, or click blank then click option'
A1
Bshift
C2
Ddiff
Attempts:
3 left
💡 Hint
Common Mistakes
Using diff which calculates difference instead of lagging values.