Q3 homework Flashcards
1
Q
Create a dataframe that includes the numbers of males and females from the titanic.
A
sex_df = titanic_df.groupby(‘sex’).size()
2
Q
Create slices for the pie plot based on the count of the number of males and females.
A
slices = sex_df.values
3
Q
Create a dataframe that includes the proportion of passengers in each class
A
class_df = titanic_df.groupby(‘pclass’).size()
4
Q
Create slices for a pie plot based on the class_df dataframe
A
slices = class_df.values
5
Q
Find and remove any values that have a fare greater than 400
A
no_outliers_df = age_fare_df[age_fare_df[‘fare’]<400]
6
Q
What is the code to create subplots, specifying a figure size of 15, 5 and 3 subplots?
A
fig, axs = plt.subplots(1, 3, figsize=(15, 5))