import pandas as pd
import numpy as np
from pandas import Series, DataFrame


weather = pd.read_table('daily_weather.tsv')


weather.groupby('season_desc').agg({'temp': np.mean})


fix = weather.replace("Fall", "Summer_").replace("Summer", "Spring_").replace("Winter", "Fall_").replace("Spring", "Winter_")

weather.groupby('season_desc').agg({'temp': np.mean})

"""
Explanation: Compute the average temperature by season ('season_desc'). (The temperatures are numbers between 0 and 1, but don't worry about that. Let's say that's the Shellman temperature scale.)
End of explanation
"""


weather['months'] = pd.DatetimeIndex(weather.date).month


weather.groupby('months').agg({'total_riders': np.sum})


"""
Explanation: Various of the columns represent dates or datetimes, but out of the box pd.read_table won't treat them correctly. This makes it hard to (for example) compute the number of rentals by month. Fix the dates and compute the number of rentals by month.
End of explanation
"""


weather[['total_riders', 'temp', 'months']].groupby('months').corr()


"""
Explanation: weather[['total_riders', 'temp']].corr()
3.Investigate how the number of rentals varies with temperature. Is this trend constant across seasons? Across months?
End of explanation
"""


weather[['no_casual_riders', 'no_reg_riders', 'temp']].corr()


"""
Explanation: weather[['total_riders', 'temp', 'season_desc']].groupby('season_desc').corr()
End of explanation
"""


weather[['no_casual_riders', 'no_reg_riders']].corr()


weather[['is_holiday', 'total_riders']].sum()


weather[['is_holiday', 'total_riders']].corr()

"""
Explanation: 4.There are various types of users in the usage data sets. What sorts of things can you say about how they use the bikes differently?
End of explanation
"""


