-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplore.py
More file actions
40 lines (33 loc) · 1.08 KB
/
explore.py
File metadata and controls
40 lines (33 loc) · 1.08 KB
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
34
35
36
37
38
39
40
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from scipy.stats import pearsonr, spearmanr
from env import get_db_url
import wrangle as w
import prepare as p
import matplotlib as mpl
mpl.rcParams["axes.formatter.useoffset"] = False
def plot_categorical_and_continuous_vars(df, x, y, order):
plt.figure(figsize=(16,9))
sns.catplot(data= df, x= x, y= y, hue='county', order=order)
plt.title(f'catplot of {x} versus {y}')
plt.xticks(rotation='vertical')
plt.xlim()
plt.show()
print('~~~~~~~~~~~~~~~~~~')
plt.figure(figsize=(16,9))
sns.barplot(data=df, x= x, y=y, order=order)
plt.title(f'bargraph of {x} versus {y}')
plt.xticks(rotation='vertical')
plt.show()
print('~~~~~~~~~~~~~~~~~~')
plt.figure(figsize=(16,9))
sns.violinplot(data=df, x=x,y=y, hue='county', order=order)
plt.title(f' {x} versus {y}')
plt.xticks(rotation='vertical')
plt.show()
print('~~~~~~~~~~~~~~~~~~')