0
0
Data Analysis Pythondata~10 mins

FacetGrid for multi-panel views 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 import the seaborn library as sns.

Data Analysis Python
import [1] as sns
Drag options to blanks, or click blank then click option'
Aseaborn
Bmatplotlib
Cpandas
Dnumpy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing matplotlib or pandas instead of seaborn.
Forgetting the 'as sns' alias.
2fill in blank
medium

Complete the code to create a FacetGrid object using the 'tips' dataset, grouping by 'time'.

Data Analysis Python
g = sns.FacetGrid(tips, col=[1])
Drag options to blanks, or click blank then click option'
A'time'
B'sex'
C'smoker'
D'day'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'day' or other columns instead of 'time'.
Forgetting to put quotes around the column name.
3fill in blank
hard

Fix the error in the code to map a scatter plot of 'total_bill' vs 'tip' on the FacetGrid.

Data Analysis Python
g.map(plt.scatter, [1], 'tip')
Drag options to blanks, or click blank then click option'
Atotal_bill
B'total_bill'
C'day'
D'size'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the variable name without quotes causing a NameError.
Using wrong column names.
4fill in blank
hard

Fill both blanks to create a FacetGrid grouped by 'sex' and map a histogram of 'total_bill'.

Data Analysis Python
g = sns.FacetGrid(tips, col=[1])
g.map(plt.hist, [2])
Drag options to blanks, or click blank then click option'
A'sex'
B'total_bill'
C'tip'
D'day'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column names or missing quotes.
Mixing up the order of blanks.
5fill in blank
hard

Fill all three blanks to create a FacetGrid grouped by 'smoker' and 'day', map a scatter plot of 'total_bill' vs 'tip', and add a title.

Data Analysis Python
g = sns.FacetGrid(tips, row=[1], col=[2])
g.map(plt.scatter, [3], 'tip')
g.fig.suptitle('Total Bill vs Tip by Smoker and Day')
g.fig.tight_layout()
Drag options to blanks, or click blank then click option'
A'smoker'
B'total_bill'
C'day'
D'tip'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping row and col variables.
Passing variable names without quotes.
Using wrong variables for scatter plot axes.