Complete the code to read a CSV file into a pandas DataFrame.
import pandas as pd data = pd.[1]('data.csv')
Use pd.read_csv to load CSV data into a DataFrame.
Complete the code to save a DataFrame to an Excel file.
import pandas as pd df = pd.DataFrame({'A': [1, 2]}) df.[1]('output.xlsx')
Use to_excel to save a DataFrame as an Excel file.
Fix the error in the code to correctly read a JSON file into a DataFrame.
import pandas as pd data = pd.[1]('data.json')
Use read_json to load JSON data into a DataFrame.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if the length is greater than 3.
words = ['apple', 'bat', 'carrot', 'dog'] lengths = {word: [1] for word in words if [2]
The dictionary maps each word to its length using len(word). The condition len(word) > 3 filters words longer than 3 letters.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths only if length is less than 5.
words = ['apple', 'bat', 'carrot', 'dog'] result = { [1]: [2] for w in words if [3] }
The keys are uppercase words using w.upper(). The values are their lengths with len(w). The condition filters words shorter than 5 letters.