0
0
Data Analysis Pythondata~10 mins

Left and right joins in Data Analysis Python - Interactive Code Practice

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

Complete the code to perform a merge of df1 and df2 on the 'id' column.

Data Analysis Python
result = df1.[1](df2, on='id')
Drag options to blanks, or click blank then click option'
Amerge
Bjoin
Cconcat
Dappend
Attempts:
3 left
💡 Hint
Common Mistakes
Using concat or append instead of merge for joining.
2fill in blank
medium

Complete the code to perform a left join using pandas merge with the correct 'how' parameter.

Data Analysis Python
result = pd.merge(df1, df2, on='id', how='[1]')
Drag options to blanks, or click blank then click option'
Aright
Binner
Cleft
Douter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'inner' or 'outer' instead of 'left' for left join.
3fill in blank
hard

Fix the error in the code to perform a right join on 'key' column.

Data Analysis Python
result = pd.merge(df1, df2, on='[1]', how='right')
Drag options to blanks, or click blank then click option'
Akey
Bvalue
Cid
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the column name or using wrong column name.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.

Data Analysis Python
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Blen(word) > 3
Cword.startswith('a')
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using word instead of len(word) for values.
Wrong filter condition.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 4.

Data Analysis Python
{ [1]: [2] for word in words if [3] }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Clen(word) > 4
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.lower() instead of upper.
Wrong filter condition.