0
0
Pandasdata~10 mins

Why end-to-end analysis matters in Pandas - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load data from a CSV file using pandas.

Pandas
import pandas as pd
data = pd.[1]('data.csv')
Drag options to blanks, or click blank then click option'
Aread_csv
Bread_excel
Cto_csv
Dread_json
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'to_csv' instead of 'read_csv' which saves data instead of loading it.
Using 'read_excel' when the file is a CSV.
2fill in blank
medium

Complete the code to display the first 5 rows of the DataFrame.

Pandas
print(data.[1]())
Drag options to blanks, or click blank then click option'
Ahead
Binfo
Csample
Dtail
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tail()' which shows the last rows instead of the first.
Using 'info()' which shows summary info, not data rows.
3fill in blank
hard

Fix the error in the code to filter rows where the 'score' column is greater than 50.

Pandas
filtered = data[data['score'] [1] 50]
Drag options to blanks, or click blank then click option'
A<
B<=
C==
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' or '<' which select smaller or equal values.
Using '==' which selects only values exactly equal to 50.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths for words longer than 3 characters.

Pandas
lengths = {word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Blen(words) > 3
Clen(word) > 3
Dword > 3
Attempts:
3 left
💡 Hint
Common Mistakes
Using len(words) which is the total number of words, not length of each word.
Using word > 3 which compares a string to a number and causes error.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their scores if the score is above 70.

Pandas
result = { [1]: [2] for word, score in data.items() if score [3] 70 }
Drag options to blanks, or click blank then click option'
Aword.upper()
Bscore
C>
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.lower() instead of uppercase.
Using '<' or '==' instead of '>' for filtering scores.