Complete the code to select data for January 2023 using date-based indexing.
january_data = df.loc[[1]]Using df.loc['2023-01'] selects all rows from January 2023.
Complete the code to slice the DataFrame for dates from March 1 to March 10, 2023.
march_slice = df.loc[[1]:'2023-03-10']
Starting the slice at '2023-03-01' includes data from March 1 onward.
Fix the error in the code to select data for the year 2022.
year_data = df.loc[[1]]Using '2022' selects all data for the year 2022. The other options are invalid date strings.
Fill both blanks to create a dictionary of word lengths for words longer than 4 characters.
lengths = {word: [1] for word in words if len(word) [2] 4}The dictionary comprehension uses len(word) to get word length and filters words with length greater than 4 using >.
Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.
result = { [1]: [2] for k, v in data.items() if v [3] 0}The dictionary comprehension uses k.upper() for keys, keeps values as v, and filters values greater than 0 with >.