Answer To: Lab 10 CIS 370 Due: Week of 4/12/2021 Note: All labs are due before next week’s lab starts More on...
Vicky answered on Apr 16 2021
# import libraries
import pandas as pd
import numpy as np
import scipy.stats as sc
import matplotlib.pyplot as plt
import seaborn as sns
# read hour.csv file
data = pd.read_csv('hour.csv')
# drop instant and dteday columns
data.drop(['instant','dteday'],axis=1,inplace=True)
# correlation matrix
print(data.corr())
# create heatmap of correlation matrix
sns.heatmap(data.corr())
# create histogram of all columns
data.hist(figsize=(15, 10))
# create scatter plot of all columns
sns.pairplot(data)
# create density plot of all columns
fig, axs = plt.subplots(3, 5)
fig.set_figheight(10)
fig.set_figwidth(15)
data['season'].plot.density(color='blue',ax=axs[0, 0])
axs[0, 0].set_title('season')
data['yr'].plot.density(color='orange',ax=axs[0, 1])
axs[0, 1].set_title('yr')
data['mnth'].plot.density(color='green',ax=axs[0, 2])
axs[0, 2].set_title('mnth')
data['hr'].plot.density(color='red',ax=axs[0, 3])
axs[0, 3].set_title('hr')
data['holiday'].plot.density(color='violet',ax=axs[0, 4])
axs[0, 4].set_title('holiday')
data['weekday'].plot.density(color='brown',ax=axs[1, 0])
axs[1, 0].set_title('weekday')
data['workingday'].plot.density(color='pink',ax=axs[1, 1])
axs[1, 1].set_title('workingday')
data['weathersit'].plot.density(color='grey',ax=axs[1, 2])
axs[1,...