text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sn

filename = '../input/bike_sharing_hourly.csv'
data = pd.read_csv(filename)

data.isnull().sum()

data.rename(columns={'weathersit': 'weather', 'mnth': 'month', 'hr': 'hour', 'yr': 'year', 'hum': 'humidity', 'cnt': 'count'}, inplace=True)

data.dtypes

data = data.drop(['instant', 'dteday'], axis=1)
data['year'] = data.year.astype('category')
data['season'] = data.season.astype('category')
data['month'] = data.month.astype('category')
data['hour'] = data.hour.astype('category')
data['holiday'] = data.holiday.astype('category')
data['weekday'] = data.weekday.astype('category')
data['workingday'] = data.workingday.astype('category')
data['weather'] = data.weather.astype('category')
data.dtypes

## Exploratory Data Analysis

# Analyzing the change in bike sharing pattern('count' variable in dataset) with categorical variables

fig,[ax1,ax2,ax3,ax4,ax5,ax6,ax7,ax8] = plt.subplots(nrows=8, figsize=(15,25))
sn.barplot(x = data['weekday'], y = data['count'],ax = ax1)
sn.barplot(x = data['season'], y = data['count'],ax = ax2)
sn.barplot(x = data['month'], y = data['count'],ax = ax3)
sn.barplot(x = data['holiday'], y = data['count'],ax = ax4)
sn.barplot(x = data['hour'], y = data['count'],ax = ax5)
sn.barplot(x = data['weather'], y = data['count'],ax = ax6)
sn.barplot(x = data['workingday'], y = data['count'],ax = ax7)
sn.barplot(x = data['year'], y = data['count'],ax = ax8)

fig, axes = plt.subplots(nrows=3, ncols=3, figsize=(25, 30))
sn.pointplot(x='hour', y='registered', hue='month', data=data, ax=axes[0][0])
sn.pointplot(x='hour', y='casual', hue='month', data=data, ax=axes[0][1])
sn.pointplot(x='hour', y='count', hue='month', size=7, data=data, ax=axes[0][2])
sn.pointplot(x='hour', y='registered', hue='season', data=data, ax=axes[1][0])
sn.pointplot(x='hour', y='casual', hue='season', data=data, ax=axes[1][1])
sn.pointplot(x='hour', y='count', hue='season', size=7, data=data, ax=axes[1][2])
sn.pointplot(x='hour', y='registered', hue='weather', data=data, ax=axes[2][0])
sn.pointplot(x='hour', y='casual', hue='weather', data=data, ax=axes[2][1])
sn.pointplot(x='hour', y='count', hue='weather', size=7, data=data, ax=axes[2][2])