Speed Up Exploratory Data Analysis with the klib Python library

Source

Download Dataset

Install klib

In [ ]:
! pip install klib

Importing the Relevant Libraries & Dataset

- National Football League (NFL) Dataset
In [1]:
import warnings
warnings.filterwarnings('ignore')
In [2]:
import klib
import pandas as pd

df = pd.read_csv('NFL_DATASET.csv')

df.head()
Out[2]:
Unnamed: 0 qtr down time TimeUnder PlayTimeDiff yrdln ydstogo ydsnet GoalToGo ... airEPA yacEPA Home_WP_pre Away_WP_pre Home_WP_post Away_WP_post Win_Prob WPA airWPA yacWPA
0 0 3 2.0 08:54 9 37.0 36.0 5 17 0.0 ... NaN NaN 0.138939 0.861061 0.126569 0.873431 0.138939 -0.012370 NaN NaN
1 1 3 1.0 12:48 13 15.0 32.0 10 4 0.0 ... NaN NaN 0.272768 0.727232 0.277266 0.722734 0.727232 -0.004498 NaN NaN
2 2 4 4.0 04:07 5 5.0 42.0 11 -1 0.0 ... NaN NaN 0.047530 0.952470 0.044235 0.955765 0.952470 0.003295 NaN NaN
3 3 2 1.0 06:49 7 0.0 20.0 10 48 0.0 ... 0.640774 2.464259 0.999998 0.000002 0.999989 0.000011 0.000002 0.000010 7.889122e-07 0.000009
4 4 2 NaN 02:00 2 28.0 27.0 0 22 0.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 67 columns

Missing Values Plot

Here we can examine the data quality. In other words, how clean is the dataset?

missingval_plot() - provides a high-level overview of the missing values in a dataset. It pinpoints which columns and rows to examine in more detail.

Top portion of the plot shows the aggregate for each column. Summary statistics is displayed on the right most side.

Bottom portion of the plot shows the missing values (black colors) in the DataFrame.

In [3]:
klib.missingval_plot(df)
Out[3]:
GridSpec(6, 6)

Data Cleaning

The data_cleaning() function essentially drops empty and single valued columns as well as empty and duplicate rows.

In [4]:
df_cleaned = klib.data_cleaning(df)
Shape of cleaned data: (183460, 63)Remaining NAs: 1757318

Changes:
Dropped rows: 0
     of which 0 duplicates. (Rows: [])
Dropped columns: 4
     of which 1 single valued.     Columns: ['play_attempted']
Dropped missing values: 520667
Reduced memory by at least: 60.43 MB (-64.44%)

Correlation Plot

Here, we can examine the intercorrelation amongst the features.

In [5]:
klib.corr_plot(df_cleaned, annot=False)
Out[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9a1fba3d50>

Display only Positive Correlation

In [6]:
klib.corr_plot(df_cleaned, split='pos', annot=False)
Displaying positive correlations. Specify a positive "threshold" to limit the results further.
Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9a1e9b3310>

Display only Negative Correlation.

In [7]:
klib.corr_plot(df_cleaned, split='neg', annot=False)
Displaying negative correlations. Specify a negative "threshold" to limit the results further.
Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9a1e9390d0>

Display Correlation with a target variable of interest

In [8]:
klib.corr_plot(df_cleaned, target='touchdown')
Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9a1e6d5d50>

Correlation data matrix

In [9]:
klib.corr_mat(df_cleaned)
Out[9]:
unnamed_0 qtr down time_under play_time_diff yrdln ydstogo ydsnet goal_to_go first_down yards_gained sp touchdown safety onsidekick pass_attempt air_yards yards_after_catch qbhit interception_thrown rush_attempt reception fumble sack challenge_replay opp_field_goal_prob opp_safety_prob opp_touchdown_prob field_goal_prob safety_prob touchdown_prob ex_point_prob two_point_prob exp_pts epa air_epa yac_epa home_wp_pre away_wp_pre home_wp_post away_wp_post win_prob wpa air_wpa yac_wpa
unnamed_0 1.00 -0.00 -0.00 -0.00 -0.01 -0.00 -0.00 0.00 0.00 -0.00 0.00 0.00 0.00 0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 0.00 -0.00 0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 0.00 -0.00 0.00 0.00 -0.00 0.00 -0.00 0.00 -0.00 0.00 -0.00 0.00 0.00 0.00
qtr -0.00 1.00 0.01 -0.03 -0.06 0.00 -0.01 0.01 0.01 -0.02 -0.02 0.00 0.00 0.00 0.04 0.01 0.02 -0.01 0.01 0.01 -0.04 -0.00 0.00 0.01 0.01 -0.16 -0.10 -0.17 -0.07 -0.18 -0.11 -0.01 0.04 -0.00 -0.00 0.02 -0.02 0.04 -0.03 0.04 -0.03 -0.03 -0.01 0.04 -0.04
down -0.00 0.01 1.00 -0.02 0.02 0.01 -0.24 -0.01 -0.01 0.28 -0.05 0.17 -0.01 0.00 0.00 -0.06 -0.03 -0.04 0.02 0.01 -0.30 -0.06 0.00 0.02 0.02 0.25 0.07 0.22 0.17 0.22 -0.45 - - -0.33 0.01 0.15 -0.11 0.00 -0.00 0.00 -0.00 -0.03 0.07 0.10 -0.08
time_under -0.00 -0.03 -0.02 1.00 0.10 0.02 0.09 -0.07 -0.02 0.09 0.07 -0.02 -0.01 -0.00 -0.02 0.02 0.00 0.02 0.00 -0.01 0.11 0.02 0.01 0.00 -0.01 0.38 0.21 0.41 0.17 0.50 0.34 -0.01 -0.01 0.04 -0.01 -0.02 0.02 -0.01 0.01 -0.01 0.01 0.02 0.03 -0.03 0.03
play_time_diff -0.01 -0.06 0.02 0.10 1.00 0.08 0.06 0.15 0.04 0.03 -0.02 -0.07 0.04 -0.00 -0.04 0.10 0.05 0.04 0.03 0.00 0.11 0.07 0.01 0.02 0.00 -0.01 -0.11 0.00 0.13 0.18 0.28 -0.12 -0.03 0.21 -0.01 -0.01 -0.00 0.00 -0.00 0.00 -0.00 0.10 -0.01 -0.01 0.01
yrdln -0.00 0.00 0.01 0.02 0.08 1.00 0.08 -0.19 -0.41 0.15 0.09 -0.34 -0.19 -0.03 0.02 0.05 0.08 0.05 0.03 0.01 -0.02 0.05 0.01 0.02 -0.02 0.05 -0.30 0.05 0.05 0.25 0.07 -0.28 -0.08 0.01 -0.04 -0.11 0.04 -0.01 0.01 -0.00 0.00 -0.02 -0.03 -0.10 0.04
ydstogo -0.00 -0.01 -0.24 0.09 0.06 0.08 1.00 -0.11 -0.09 -0.03 0.05 -0.17 -0.04 0.02 -0.05 0.27 0.16 0.12 0.08 0.04 0.12 0.20 0.02 0.06 0.01 0.26 0.19 0.25 0.24 0.31 0.16 -0.24 -0.06 0.01 -0.04 -0.11 0.06 -0.00 -0.00 -0.00 -0.00 -0.02 -0.00 -0.07 0.05
ydsnet 0.00 0.01 -0.01 -0.07 0.15 -0.19 -0.11 1.00 0.30 0.03 0.12 0.36 0.24 -0.02 -0.03 0.11 0.08 0.15 -0.04 -0.02 0.01 0.15 -0.02 -0.08 0.04 -0.53 -0.47 -0.52 0.33 -0.21 0.23 0.25 0.06 0.56 0.22 0.14 0.15 0.00 0.00 0.00 0.00 0.08 0.16 0.11 0.11
goal_to_go 0.00 0.01 -0.01 -0.02 0.04 -0.41 -0.09 0.30 1.00 -0.11 -0.09 0.24 0.32 -0.00 -0.01 0.01 -0.06 -0.05 -0.01 -0.00 0.06 -0.02 -0.00 -0.01 0.04 -0.26 -0.16 -0.26 0.16 -0.09 0.36 -0.04 0.00 0.43 -0.00 0.08 -0.07 0.00 -0.00 0.00 -0.00 0.08 0.00 0.07 -0.06
first_down -0.00 -0.02 0.28 0.09 0.03 0.15 -0.03 0.03 -0.11 1.00 0.37 -0.19 -0.11 -0.01 -0.01 0.09 0.08 0.20 -0.07 0.14 -0.14 0.22 0.06 -0.07 0.03 0.27 0.10 0.25 -0.00 0.27 0.01 -0.11 -0.03 -0.14 0.27 0.12 0.20 -0.00 0.00 -0.00 0.00 -0.08 0.28 0.09 0.18
yards_gained 0.00 -0.02 -0.05 0.07 -0.02 0.09 0.05 0.12 -0.09 0.37 1.00 0.04 0.21 -0.02 -0.02 0.19 0.25 0.49 -0.13 -0.05 -0.05 0.41 -0.04 -0.21 0.04 0.17 0.12 0.17 -0.00 0.14 0.08 -0.09 -0.02 -0.05 0.53 0.16 0.48 -0.00 0.00 -0.00 0.00 -0.05 0.43 0.11 0.39
sp 0.00 0.00 0.17 -0.02 -0.07 -0.34 -0.17 0.36 0.24 -0.19 0.04 1.00 0.61 0.07 -0.01 -0.09 -0.01 0.03 -0.04 0.01 -0.10 -0.00 -0.01 -0.04 0.04 -0.27 -0.17 -0.27 0.19 -0.28 -0.15 0.55 0.06 0.15 0.20 0.17 0.13 0.00 -0.01 0.00 -0.01 0.09 0.17 0.13 0.11
touchdown 0.00 0.00 -0.01 -0.01 0.04 -0.19 -0.04 0.24 0.32 -0.11 0.21 0.61 1.00 -0.00 -0.01 0.08 0.09 0.12 -0.01 0.04 0.01 0.14 0.02 -0.02 0.12 -0.13 -0.09 -0.13 0.08 0.01 0.22 -0.03 -0.01 0.24 0.25 0.17 0.12 0.00 -0.00 0.00 -0.01 0.04 0.22 0.13 0.11
safety 0.00 0.00 0.00 -0.00 -0.00 -0.03 0.02 -0.02 -0.00 -0.01 -0.02 0.07 -0.00 1.00 -0.00 -0.01 -0.01 -0.01 0.03 0.01 0.00 -0.01 0.04 0.05 0.03 0.03 0.07 0.03 -0.02 0.00 -0.01 -0.00 -0.00 -0.03 -0.01 -0.00 -0.01 0.00 -0.00 -0.00 0.00 -0.01 -0.01 -0.00 -0.01
onsidekick -0.00 0.04 0.00 -0.02 -0.04 0.02 -0.05 -0.03 -0.01 -0.01 -0.02 -0.01 -0.01 -0.00 1.00 -0.03 -0.02 -0.01 -0.01 -0.00 -0.02 -0.02 -0.00 -0.01 0.01 -0.00 0.01 -0.01 -0.02 -0.02 -0.02 -0.01 -0.00 -0.02 0.03 0.01 -0.01 0.00 -0.00 -0.00 0.00 0.05 -0.04 0.00 -0.00
pass_attempt -0.00 0.01 -0.06 0.02 0.10 0.05 0.27 0.11 0.01 0.09 0.19 -0.09 0.08 -0.01 -0.03 1.00 0.52 0.36 0.07 0.13 -0.54 0.69 -0.04 -0.14 0.06 0.04 0.01 0.04 0.13 0.14 0.18 -0.13 0.02 0.12 0.08 - - -0.00 0.00 -0.00 0.00 -0.13 0.06 - -
air_yards -0.00 0.02 -0.03 0.00 0.05 0.08 0.16 0.08 -0.06 0.08 0.25 -0.01 0.09 -0.01 -0.02 0.52 1.00 0.06 0.07 0.17 -0.28 0.22 -0.03 -0.07 0.06 0.04 0.01 0.04 0.06 0.08 0.06 -0.07 -0.02 0.03 0.10 0.77 -0.47 0.00 -0.00 0.00 -0.00 -0.09 0.08 0.53 -0.37
yards_after_catch -0.00 -0.01 -0.04 0.02 0.04 0.05 0.12 0.15 -0.05 0.20 0.49 0.03 0.12 -0.01 -0.01 0.36 0.06 1.00 -0.01 -0.03 -0.19 0.52 -0.01 -0.05 0.01 0.06 0.03 0.06 0.02 0.07 0.05 -0.05 -0.01 0.00 0.35 -0.22 0.54 0.00 -0.00 0.00 -0.00 -0.03 0.28 -0.16 0.43
qbhit -0.00 0.01 0.02 0.00 0.03 0.03 0.08 -0.04 -0.01 -0.07 -0.13 -0.04 -0.01 0.03 -0.01 0.07 0.07 -0.01 1.00 0.03 -0.15 -0.02 0.02 0.59 0.01 0.03 0.01 0.03 0.04 0.05 0.03 -0.04 -0.01 0.01 -0.16 0.03 -0.09 0.00 -0.00 0.00 -0.00 -0.06 -0.13 0.02 -0.07
interception_thrown -0.00 0.01 0.01 -0.01 0.00 0.01 0.04 -0.02 -0.00 0.14 -0.05 0.01 0.04 0.01 -0.00 0.13 0.17 -0.03 0.03 1.00 -0.07 -0.06 -0.00 -0.02 0.07 0.00 0.00 0.00 0.02 0.01 0.01 -0.02 -0.00 0.01 -0.33 0.10 -0.45 0.00 -0.00 0.00 -0.00 -0.04 -0.22 0.07 -0.30
rush_attempt 0.00 -0.04 -0.30 0.11 0.11 -0.02 0.12 0.01 0.06 -0.14 -0.05 -0.10 0.01 0.00 -0.02 -0.54 -0.28 -0.19 -0.15 -0.07 1.00 -0.37 0.02 -0.11 -0.02 0.00 0.00 0.01 0.09 0.13 0.35 -0.10 -0.00 0.25 -0.04 -0.01 0.01 -0.00 0.00 -0.00 0.00 0.16 -0.04 -0.01 0.00
reception -0.00 -0.00 -0.06 0.02 0.07 0.05 0.20 0.15 -0.02 0.22 0.41 -0.00 0.14 -0.01 -0.02 0.69 0.22 0.52 -0.02 -0.06 -0.37 1.00 -0.01 -0.10 0.03 0.05 0.02 0.05 0.07 0.10 0.12 -0.09 0.01 0.06 0.36 -0.25 0.67 -0.00 0.00 -0.00 0.00 -0.08 0.28 -0.18 0.54
fumble 0.00 0.00 0.00 0.01 0.01 0.01 0.02 -0.02 -0.00 0.06 -0.04 -0.01 0.02 0.04 -0.00 -0.04 -0.03 -0.01 0.02 -0.00 0.02 -0.01 1.00 0.19 0.14 0.02 0.01 0.02 0.01 0.03 0.02 -0.02 -0.00 0.01 -0.21 -0.05 -0.06 0.00 -0.00 -0.00 0.00 -0.02 -0.14 -0.04 -0.04
sack -0.00 0.01 0.02 0.00 0.02 0.02 0.06 -0.08 -0.01 -0.07 -0.21 -0.04 -0.02 0.05 -0.01 -0.14 -0.07 -0.05 0.59 -0.02 -0.11 -0.10 0.19 1.00 0.02 0.03 0.01 0.03 0.02 0.04 0.02 -0.03 -0.00 0.00 -0.21 -0.03 0.00 0.00 -0.00 0.00 -0.00 -0.04 -0.16 -0.02 0.00
challenge_replay -0.00 0.01 0.02 -0.01 0.00 -0.02 0.01 0.04 0.04 0.03 0.04 0.04 0.12 0.03 0.01 0.06 0.06 0.01 0.01 0.07 -0.02 0.03 0.14 0.02 1.00 -0.02 -0.01 -0.02 0.02 0.01 0.03 -0.01 0.02 0.03 -0.01 0.03 -0.03 -0.00 0.00 -0.00 0.00 -0.01 0.00 0.04 -0.02
opp_field_goal_prob -0.00 -0.16 0.25 0.38 -0.01 0.05 0.26 -0.53 -0.26 0.27 0.17 -0.27 -0.13 0.03 -0.00 0.04 0.04 0.06 0.03 0.00 0.00 0.05 0.02 0.03 -0.02 1.00 0.80 1.00 -0.18 0.70 0.01 -0.21 -0.05 -0.63 0.03 -0.01 0.03 -0.01 0.01 -0.01 0.01 -0.17 0.07 -0.01 0.04
opp_safety_prob -0.00 -0.10 0.07 0.21 -0.11 -0.30 0.19 -0.47 -0.16 0.10 0.12 -0.17 -0.09 0.07 0.01 0.01 0.01 0.03 0.01 0.00 0.00 0.02 0.01 0.01 -0.01 0.80 1.00 0.79 -0.30 0.33 -0.17 -0.12 -0.03 -0.65 0.03 0.01 0.03 -0.01 0.00 -0.01 0.00 -0.15 0.05 0.01 0.02
opp_touchdown_prob -0.00 -0.17 0.22 0.41 0.00 0.05 0.25 -0.52 -0.26 0.25 0.17 -0.27 -0.13 0.03 -0.01 0.04 0.04 0.06 0.03 0.00 0.01 0.05 0.02 0.03 -0.02 1.00 0.79 1.00 -0.16 0.73 0.04 -0.20 -0.05 -0.60 0.03 -0.01 0.03 -0.01 0.01 -0.01 0.01 -0.16 0.07 -0.01 0.04
field_goal_prob -0.00 -0.07 0.17 0.17 0.13 0.05 0.24 0.33 0.16 -0.00 -0.00 0.19 0.08 -0.02 -0.02 0.13 0.06 0.02 0.04 0.02 0.09 0.07 0.01 0.02 0.02 -0.18 -0.30 -0.16 1.00 0.19 0.38 -0.24 -0.06 0.60 -0.04 0.07 -0.07 -0.01 0.00 -0.01 0.00 0.10 -0.02 0.05 -0.05
safety_prob -0.00 -0.18 0.22 0.50 0.18 0.25 0.31 -0.21 -0.09 0.27 0.14 -0.28 0.01 0.00 -0.02 0.14 0.08 0.07 0.05 0.01 0.13 0.10 0.03 0.04 0.01 0.70 0.33 0.73 0.19 1.00 0.49 -0.28 -0.07 -0.05 -0.01 0.01 -0.01 -0.02 0.01 -0.02 0.01 -0.06 0.05 -0.02 0.02
touchdown_prob -0.00 -0.11 -0.45 0.34 0.28 0.07 0.16 0.23 0.36 0.01 0.08 -0.15 0.22 -0.01 -0.02 0.18 0.06 0.05 0.03 0.01 0.35 0.12 0.02 0.02 0.03 0.01 -0.17 0.04 0.38 0.49 1.00 -0.28 -0.07 0.73 -0.04 -0.02 0.00 -0.01 0.01 -0.01 0.01 0.10 -0.03 -0.03 0.01
ex_point_prob 0.00 -0.01 - -0.01 -0.12 -0.28 -0.24 0.25 -0.04 -0.11 -0.09 0.55 -0.03 -0.00 -0.01 -0.13 -0.07 -0.05 -0.04 -0.02 -0.10 -0.09 -0.02 -0.03 -0.01 -0.21 -0.12 -0.20 -0.24 -0.28 -0.28 1.00 -0.01 -0.05 -0.00 -0.00 0.00 0.01 -0.01 0.01 -0.01 0.09 -0.01 -0.00 0.00
two_point_prob -0.00 0.04 - -0.01 -0.03 -0.08 -0.06 0.06 0.00 -0.03 -0.02 0.06 -0.01 -0.00 -0.00 0.02 -0.02 -0.01 -0.01 -0.00 -0.00 0.01 -0.00 -0.00 0.02 -0.05 -0.03 -0.05 -0.06 -0.07 -0.07 -0.01 1.00 -0.01 0.00 0.01 0.01 -0.01 0.01 -0.00 0.00 -0.01 -0.01 0.00 0.01
exp_pts 0.00 -0.00 -0.33 0.04 0.21 0.01 0.01 0.56 0.43 -0.14 -0.05 0.15 0.24 -0.03 -0.02 0.12 0.03 0.00 0.01 0.01 0.25 0.06 0.01 0.00 0.03 -0.63 -0.65 -0.60 0.60 -0.05 0.73 -0.05 -0.01 1.00 -0.05 0.01 -0.03 -0.00 -0.00 0.00 -0.00 0.18 -0.07 0.00 -0.03
epa 0.00 -0.00 0.01 -0.01 -0.01 -0.04 -0.04 0.22 -0.00 0.27 0.53 0.20 0.25 -0.01 0.03 0.08 0.10 0.35 -0.16 -0.33 -0.04 0.36 -0.21 -0.21 -0.01 0.03 0.03 0.03 -0.04 -0.01 -0.04 -0.00 0.00 -0.05 1.00 0.14 0.72 0.00 -0.00 0.00 -0.00 -0.01 0.75 0.11 0.54
air_epa -0.00 0.02 0.15 -0.02 -0.01 -0.11 -0.11 0.14 0.08 0.12 0.16 0.17 0.17 -0.00 0.01 - 0.77 -0.22 0.03 0.10 -0.01 -0.25 -0.05 -0.03 0.03 -0.01 0.01 -0.01 0.07 0.01 -0.02 -0.00 0.01 0.01 0.14 1.00 -0.59 0.01 -0.01 0.01 -0.01 -0.02 0.13 0.70 -0.47
yac_epa 0.00 -0.02 -0.11 0.02 -0.00 0.04 0.06 0.15 -0.07 0.20 0.48 0.13 0.12 -0.01 -0.01 - -0.47 0.54 -0.09 -0.45 0.01 0.67 -0.06 0.00 -0.03 0.03 0.03 0.03 -0.07 -0.01 0.00 0.00 0.01 -0.03 0.72 -0.59 1.00 -0.00 0.00 -0.00 0.00 0.03 0.57 -0.41 0.77
home_wp_pre -0.00 0.04 0.00 -0.01 0.00 -0.01 -0.00 0.00 0.00 -0.00 -0.00 0.00 0.00 0.00 0.00 -0.00 0.00 0.00 0.00 0.00 -0.00 -0.00 0.00 0.00 -0.00 -0.01 -0.01 -0.01 -0.01 -0.02 -0.01 0.01 -0.01 -0.00 0.00 0.01 -0.00 1.00 -1.00 0.99 -0.98 0.00 -0.00 -0.01 0.01
away_wp_pre 0.00 -0.03 -0.00 0.01 -0.00 0.01 -0.00 0.00 -0.00 0.00 0.00 -0.01 -0.00 -0.00 -0.00 0.00 -0.00 -0.00 -0.00 -0.00 0.00 0.00 -0.00 -0.00 0.00 0.01 0.00 0.01 0.00 0.01 0.01 -0.01 0.01 -0.00 -0.00 -0.01 0.00 -1.00 1.00 -0.98 0.99 -0.00 0.00 0.01 -0.01
home_wp_post -0.00 0.04 0.00 -0.01 0.00 -0.00 -0.00 0.00 0.00 -0.00 -0.00 0.00 0.00 -0.00 -0.00 -0.00 0.00 0.00 0.00 0.00 -0.00 -0.00 -0.00 0.00 -0.00 -0.01 -0.01 -0.01 -0.01 -0.02 -0.01 0.01 -0.00 0.00 0.00 0.01 -0.00 0.99 -0.98 1.00 -1.00 0.00 -0.00 -0.01 0.00
away_wp_post 0.00 -0.03 -0.00 0.01 -0.00 0.00 -0.00 0.00 -0.00 0.00 0.00 -0.01 -0.01 0.00 0.00 0.00 -0.00 -0.00 -0.00 -0.00 0.00 0.00 0.00 -0.00 0.00 0.01 0.00 0.01 0.00 0.01 0.01 -0.01 0.00 -0.00 -0.00 -0.01 0.00 -0.98 0.99 -1.00 1.00 -0.00 0.00 0.01 -0.00
win_prob -0.00 -0.03 -0.03 0.02 0.10 -0.02 -0.02 0.08 0.08 -0.08 -0.05 0.09 0.04 -0.01 0.05 -0.13 -0.09 -0.03 -0.06 -0.04 0.16 -0.08 -0.02 -0.04 -0.01 -0.17 -0.15 -0.16 0.10 -0.06 0.10 0.09 -0.01 0.18 -0.01 -0.02 0.03 0.00 -0.00 0.00 -0.00 1.00 -0.03 -0.03 0.02
wpa 0.00 -0.01 0.07 0.03 -0.01 -0.03 -0.00 0.16 0.00 0.28 0.43 0.17 0.22 -0.01 -0.04 0.06 0.08 0.28 -0.13 -0.22 -0.04 0.28 -0.14 -0.16 0.00 0.07 0.05 0.07 -0.02 0.05 -0.03 -0.01 -0.01 -0.07 0.75 0.13 0.57 -0.00 0.00 -0.00 0.00 -0.03 1.00 0.19 0.62
air_wpa 0.00 0.04 0.10 -0.03 -0.01 -0.10 -0.07 0.11 0.07 0.09 0.11 0.13 0.13 -0.00 0.00 - 0.53 -0.16 0.02 0.07 -0.01 -0.18 -0.04 -0.02 0.04 -0.01 0.01 -0.01 0.05 -0.02 -0.03 -0.00 0.00 0.00 0.11 0.70 -0.41 -0.01 0.01 -0.01 0.01 -0.03 0.19 1.00 -0.66
yac_wpa 0.00 -0.04 -0.08 0.03 0.01 0.04 0.05 0.11 -0.06 0.18 0.39 0.11 0.11 -0.01 -0.00 - -0.37 0.43 -0.07 -0.30 0.00 0.54 -0.04 0.00 -0.02 0.04 0.02 0.04 -0.05 0.02 0.01 0.00 0.01 -0.03 0.54 -0.47 0.77 0.01 -0.01 0.00 -0.00 0.02 0.62 -0.66 1.00

Distribution Plot

Displays the distribution plot for columns of interest.

In [10]:
x = df_cleaned['win_prob']

klib.dist_plot(x)
Large dataset detected, using 10000 random samples for the plots. Summary statistics are still based on the entire dataset.
Out[10]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9a1eb15c90>

Categorical Plot

In [11]:
klib.cat_plot(df, figsize=(50,15))
Out[11]:
GridSpec(6, 21)

Save Plot as a PDF file

In [12]:
plot = klib.corr_plot(df_cleaned, annot=False, figsize=(12,10))

plot.figure.savefig('figure.pdf')