0
0
Data Analysis Pythondata~10 mins

Why combining datasets creates complete pictures in Data Analysis Python - Test Your Understanding

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

Complete the code to merge two dataframes on the 'id' column.

Data Analysis Python
merged_df = df1.merge(df2, on=[1])
Drag options to blanks, or click blank then click option'
A'name'
B'id'
C'age'
D'score'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column that doesn't exist in both dataframes.
Forgetting to put quotes around the column name.
2fill in blank
medium

Complete the code to concatenate two dataframes vertically.

Data Analysis Python
combined_df = pd.concat([df1, df2], axis=[1])
Drag options to blanks, or click blank then click option'
A0
B-1
C1
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using axis=1 which stacks columns instead of rows.
Using an invalid axis number.
3fill in blank
hard

Fix the error in the code to merge dataframes with an inner join.

Data Analysis Python
result = df1.merge(df2, how=[1], on='user_id')
Drag options to blanks, or click blank then click option'
A'outer'
B'left'
C'inner'
D'right'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'outer' which keeps all rows, not just matching ones.
Using 'left' or 'right' which keep all rows from one dataframe only.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.

Data Analysis Python
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length.
Using '<' instead of '>' in the condition.
5fill in blank
hard

Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 0.

Data Analysis Python
result = [1]: [2] for k, v in data.items() if v [3] 0}
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'k' instead of 'k.upper()' for keys.
Using '<' instead of '>' in the condition.
Using keys as values or vice versa.