# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Bivariate and Multivariate Analysis

# +
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')

df = sns.load_dataset('iris')
# -

df.head() 

df['species'].unique() 

df.groupby('species').size() 

sns.distplot(df['sepal_length'])

# ## Bivariate data analysis

plt.figure(figsize=(10,6))
sns.scatterplot(x='sepal_length', y='petal_length', data=df, hue='species')
plt.xlabel('Sepal Length', fontsize=14)
plt.ylabel('Petal Length', fontsize=14)
plt.title('Relationship between Sepal and Petal Length', fontsize=14)
plt.show() 

# ## Multivariate data analysis

# ## Covariance

df.cov() 

sns.heatmap(df.cov()) 

# ## Correlation

# Pearson's r correlation
df.corr() 

sns.heatmap(df.corr())

sns.heatmap(df.corr(), annot=True)

sns.heatmap(df.corr(), annot=True, cmap='viridis')

StarcoderdataJupyterScriptsDedupFiltered