Complete the code to create a pandas DataFrame with a None value.
import pandas as pd data = {'A': [1, 2, [1], 4]} df = pd.DataFrame(data) print(df)
None is used to represent missing data in Python and works in pandas DataFrames.
Complete the code to import the correct function to create a NaN value.
import pandas as pd from numpy import [1] data = {'B': [1, 2, [1], 4]} df = pd.DataFrame(data) print(df)
numpy.nan is the standard way to represent NaN (Not a Number) in pandas.
Fix the error in the code to check for NaN values in the DataFrame.
import pandas as pd import numpy as np df = pd.DataFrame({'C': [1, np.nan, 3]}) print(df.[1]())
DataFrame has the method isna() to check for NaN values.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
words = ['apple', 'bat', 'car', 'door'] lengths = {word: [1] for word in words if [2]
The dictionary comprehension uses len(word) as value and filters words with length greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths only if length is greater than 3.
words = ['apple', 'bat', 'car', 'door'] result = { [1]: [2] for word in words if [3] }
The dictionary comprehension maps uppercase words to their lengths, filtering words longer than 3 characters.