how to plot a diagonal plot in python
I am trying to create a diagonal plot in python, I am working off an example that works but I am getting a key error message. The code is the following:
import pandas as pd import numpy as np import matplotlib.pyplot as plt filename = 'https://library.startlearninglabs.uw.edu/DATASCI410/Datasets/JitteredHeadCount.csv' headcount_df = pd.read_csv(filename) headcount_df.describe() num_cols = ["TablesOcc", "ablesOpen", "HeadCount", "TablesClosed", "DayNumber"] sns.pairplot(headcount_df.loc[:, num_cols], hue='DayOfWeek', palette="seismic", diag_kind="kde", size=2).map_upper(sns.kdeplot, cmap="Blues")
I am getting a key error messaging KeyError: 'DayOfWeek'
and
KeyError Traceback (most recent call last)
I am not sure why it is not working this time. any help would be appreciated.
This should work
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns filename = 'https://library.startlearninglabs.uw.edu/DATASCI410/Datasets/JitteredHeadCount.csv' headcount_df = pd.read_csv(filename) headcount_df.describe() sns.pairplot(headcount_df, hue='DayOfWeek', palette="seismic", diag_kind="kde", vars=["TablesOcc", "TablesOpen", "HeadCount", "TablesClosed", "DayNumber"], size=2).map_upper(sns.kdeplot, cmap="Blues")