-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path2. kde.py
31 lines (25 loc) · 862 Bytes
/
2. kde.py
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
import codecademylib3_seaborn
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
# Take in the data from the CSVs as NumPy arrays:
set_one = np.genfromtxt("dataset1.csv", delimiter=",")
set_two = np.genfromtxt("dataset2.csv", delimiter=",")
set_three = np.genfromtxt("dataset3.csv", delimiter=",")
set_four = np.genfromtxt("dataset4.csv", delimiter=",")
# Creating a Pandas DataFrame:
n=500
df = pd.DataFrame({
"label": ["set_one"] * n + ["set_two"] * n + ["set_three"] * n + ["set_four"] * n,
"value": np.concatenate([set_one, set_two, set_three, set_four])
})
# Setting styles:
sns.set_style("darkgrid")
sns.set_palette("pastel")
# Add your code below:
sns.kdeplot(set_one, shade=True)
sns.kdeplot(set_two, shade=True)
sns.kdeplot(set_three, shade=True)
sns.kdeplot(set_four, shade=True)
plt.show()