This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
iml-assignment-1/main.py

60 lines
2.0 KiB
Python
Raw Normal View History

2021-10-05 15:13:24 +00:00
import sklearn
import pandas as pd
import matplotlib
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv("Dataset.csv")
#Windspeed
plt.figure()
sns.set_theme(style="white", color_codes=True)
g = sns.JointGrid(data=data, x="Subscribed", y="windspeed", space=0, ratio=17)
g.plot_joint(sns.scatterplot, sizes=(30, 120), color="g", alpha=.6, legend=False) #size=data["hour"],
g.plot_marginals(sns.rugplot, height=1, color="g", alpha=.6)
#Seasons - Boxplot
plt.figure()
sns.set_theme(style="ticks", palette="pastel")
sns.boxplot(x="season", y="Total", palette=["m", "g"], data=data)
sns.despine(offset=10, trim=True)
#Subscribed, non-subscribed
plt.figure()
sns.lineplot(x="month", y="Total", data=data, color='purple')
sns.lineplot(x="month", y="Subscribed", data=data, color='blue')
sns.lineplot(x="month", y="Non-subscribed", data=data, color='red')
plt.legend(title='Type', loc='lower right', labels=['Total', 'Subscribed', 'Non-subscribed'])
# Distribution plot per month with weather type annotated?
plt.figure()
sns.displot(data=data, x="month", y="Total", hue="weather")
# Season - weather scatterplot
plt.figure()
sns.pointplot(x="Total", y="season", hue="weather", data=data, dodge=.8 - .8 / 3, join=False, palette="dark",markers="d", scale=.75, ci=None)
# By day -> Holidays
plt.figure()
sns.violinplot(data=data, x="day", y="Total", hue="smoker", split=True, inner="quart", linewidth=1, palette={"Yes": "b", "No": ".85"})
sns.despine(left=True)
#Temperature total
plt.figure()
sns.lineplot(x="temperature", y="Total", data=data)
sns.lineplot(x="feeling_temperature", y="Total", data=data)
plt.legend(title='Type', loc='upper left', labels=['Feeling', 'Feeling temperature'])
#Humidity total
plt.figure()
sns.lineplot(x="humidity", y="Total", data=data)
#Windspeed total
plt.figure()
sns.lineplot(x="windspeed", y="Total", data=data)
# Boxplot with weather types
plt.figure()
sns.boxplot(x="weather", y="Total", data=data, dodge=.8 - .8 / 3, palette="dark")