-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpair_plot.py
More file actions
33 lines (24 loc) · 814 Bytes
/
pair_plot.py
File metadata and controls
33 lines (24 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
classes = ['Hogwarts House', 'Arithmancy', 'Astronomy', 'Herbology',
'Defense Against the Dark Arts', 'Divination', 'Muggle Studies',
'Ancient Runes', 'History of Magic', 'Transfiguration', 'Potions',
'Care of Magical Creatures', 'Charms', 'Flying']
# Pair plot
def pair_plot (filename : str):
# Read data
try:
df = pd.read_csv(filename)
except:
print("error when trying to read dataset", file=sys.stderr)
sys.exit(1)
# Select features
df = df[classes]
# Draw pairplot
sns.pairplot(df, hue="Hogwarts House", diag_kind="hist")
# Show plot
plt.show()
if __name__ == "__main__":
pair_plot("data/dataset_train.csv")