Complete the code to extract the year from the 'date' column using the dt accessor.
df['year'] = df['date'].dt.[1]
The dt.year property extracts the year part from datetime values.
Complete the code to extract the month from the 'date' column using the dt accessor.
df['month'] = df['date'].dt.[1]
The dt.month property extracts the month part from datetime values.
Fix the error in the code to extract the day from the 'date' column using the dt accessor.
df['day'] = df['date'].[1]
df['date'].day without dt accessor.dt.day() which is incorrect.The dt accessor must be used before the property: df['date'].dt.day.
Fill both blanks to create a new column 'hour' extracting the hour from 'timestamp' column and filter rows where hour is greater than 12.
df['hour'] = df['timestamp'].[1].hour filtered = df[df['hour'] [2] 12]
Use dt.hour to get the hour part. Then filter rows where hour is greater than 12 using >.
Fill all three blanks to create a dictionary with keys as day names in uppercase, values as day numbers, filtering days greater than 15 from 'date' column.
result = dict(zip([1], [2])) result = {k: v for k, v in result.items() if v [3] 15} result = {k.upper(): v for k, v in result.items()}
Use dt.day_name() for day names, dt.day for day numbers, and filter with > 15.