Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created May 29, 2020 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/fc630fe8dc0f00d92ef3738a73c11b14 to your computer and use it in GitHub Desktop.
Save codecademydev/fc630fe8dc0f00d92ef3738a73c11b14 to your computer and use it in GitHub Desktop.
Codecademy export
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(data = set_one, shade = True)
sns.kdeplot(data = set_two, shade = True)
sns.kdeplot(data = set_three, shade = True)
sns.kdeplot(data = set_four, shade = True)
sns.legend()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment