How to do it...

Execute the following steps to carry out EDA.

  1. Import the libraries:
import pandas as pdimport seaborn as snsimport numpy as np
  1. Get summary statistics for numeric variables:
df.describe().transpose().round(2)

This results in the following table:

  1. Get summary statistics for categorical variables:
df.describe(include='object').transpose()

This results in the following table:

  1. Plot the distribution of age and, additionally, split it by gender:
fig, ax = plt.subplots()sns.distplot(df.loc[df.sex=='Male', 'age'].dropna(),  hist=False, ...

Get Python for Finance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.