Complete the code to convert the 'date' column to datetime format.
df['date'] = pd.to_datetime(df['[1]'])
The 'date' column must be converted to datetime to analyze trends over time.
Complete the code to set the 'date' column as the DataFrame index.
df = df.set_index('[1]')
Setting 'date' as index helps in time-based analysis and plotting.
Fix the error in resampling the data by month and calculating the mean.
monthly_avg = df.resample('[1]').mean()
'M' stands for month in resampling frequency strings.
Fill both blanks to create a dictionary of average sales per month for products with sales greater than 100.
monthly_sales = {product: df[df['product'] == product].resample([1]).[2]() for product in df['product'].unique() if df[df['product'] == product]['sales'].mean() > 100}Resample by month ('M') and calculate the mean sales.
Fill all three blanks to filter data for dates after 2020-01-01, resample weekly, and calculate total sales.
filtered = df[df.index > [1]] weekly_sales = filtered.resample([2])['sales'].[3]()
Filter dates after '2020-01-01', resample weekly ('W'), and sum sales.
