<jupyter_start><jupyter_text>Task 1<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('Bike-Sharing-Dataset/hour.csv')<jupyter_output><empty_output><jupyter_text>We are intersted in the following plots:1. total count vs time2. scatter plot of a registered vs total count3. density map of a registered vs total count<jupyter_code>plt.plot(data["dteday"], data["cnt"])

plt.scatter(data["registered"], data["cnt"])
plt.hist2d(data["registered"], data["cnt"], bins=(10, 10), cmap=plt.cm.jet);<jupyter_output><empty_output><jupyter_text>Task 2 We implmenented the following pipeline:1. Loading : loading csv file2. Clean Data by dropping column instant which we don't need.3. Process 4.  Wrangling   1. Loading<jupyter_code>data = pd.read_csv('Bike-Sharing-Dataset/hour.csv')
print(data.head(10))<jupyter_output>instant      dteday  season  yr  mnth  hr  holiday  weekday  workingday  \
0        1  2011-01-01       1   0     1   0        0        6           0   
1        2  2011-01-01       1   0     1   1        0        6           0   
2        3  2011-01-01       1   0     1   2        0        6           0   
3        4  2011-01-01       1   0     1   3        0        6           0   
4        5  2011-01-01       1   0     1   4        0        6           0   
5        6  2011-01-01       1   0     1   5        0        6           0   
6        7  2011-01-01       1   0     1   6        0        6           0   
7        8  2011-01-01       1   0     1   7        0        6           0   
8        9  2011-01-01       1   0     1   8        0        6           0   
9       10  2011-01-01       1   0     1   9        0        6           0   

   weathersit  temp   atemp   hum  windspeed  casual  registered  cnt  
0           1  0.24  0.2879  0.81     0.0000       3          13   16[...]<jupyter_text>2. Clean Data<jupyter_code>data.drop('instant', axis=1, inplace=True)<jupyter_output><empty_output><jupyter_text>Let's confirm if column instant has been removed<jupyter_code>data.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 17379 entries, 0 to 17378
Data columns (total 17 columns):
 #   Column      Non-Null Count  Dtype  
---  ------      --------------  -----  
 0   instant     17379 non-null  int64  
 1   dteday      17379 non-null  object 
 2   season      17379 non-null  int64  
 3   yr          17379 non-null  int64  
 4   mnth        17379 non-null  int64  
 5   hr          17379 non-null  int64  
 6   holiday     17379 non-null  int64  
 7   weekday     17379 non-null  int64  
 8   workingday  17379 non-null  int64  
 9   weathersit  17379 non-null  int64  
 10  temp        17379 non-null  float64
 11  atemp       17379 non-null  float64
 12  hum         17379 non-null  float64
 13  windspeed   17379 non-null  float64
 14  casual      17379 non-null  int64  
 15  registered  17379 non-null  int64  
 16  cnt         17379 non-null  int64  
dtypes: float64(4), int64(12), object(1)
memory usage: 2.3+ MB<jupyter_text>3. Process Data<jupyter_code>data['total'] = data['registered'] + data['casual']
data.head()<jupyter_output><empty_output><jupyter_text>4. Wrangle Data Check if the column total (sum of<jupyter_code>count = data['cnt'] == data['total']
assert count.sum() == len(data)<jupyter_output><empty_output><jupyter_text>Task 3  Step 1<jupyter_code>#data = pd.read_csv('Bike-Sharing-Dataset/hour.csv')
# Method chaining begins
import numpy as np
df = pd.read_csv('Bike-Sharing-Dataset/hour.csv').drop('instant', axis=1).assign(registered_ratio=data['registered']/ data['cnt']).assign(casual_ratio=data['casual']/ data['cnt']).assign(yr=lambda x: np.where(x.yr==0, 2011, 2012))


df
def load_and_process(url_or_path_to_csv_file):
    df = pd.read_csv(url_or_path_to_csv_file).drop('instant', axis=1).assign(registered_ratio=lambda x : x['registered']/ x['cnt']).assign(casual_ratio=lambda x :x['casual']/ x['cnt']).assign(yr=lambda x: np.where(x.yr==0, 2011, 2012))
    return df
load_and_process('Bike-Sharing-Dataset/hour.csv')
import project_functions
df = project_functions.load_and_process('Bike-Sharing-Dataset/hour.csv')
df<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup