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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.