# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Bonus: Temperature Analysis I

import pandas as pd
from datetime import datetime as dt

# "tobs" is "temperature observations"
df = pd.read_csv('Resources/hawaii_measurements.csv')
df.head()

df.tail()

# Convert the date column format from string to datetime
df.date = pd.to_datetime(df.date, infer_datetime_format=True)

# Set the date column as the DataFrame index
df = df.set_index(df['date'])

#Drop date column
df = df.drop(columns = 'date')

df.head()

# ### Compare June and December data across all years 

from scipy import stats


# Filter data for desired months
june_data=df[df.index.month==6]
december_data=df[df.index.month==12]

# Identify the average temperature for June
june_data.mean()


june_data.describe()

# Identify the average temperature for December
december_data.mean()

december_data.describe()

# Create collections of temperature data
june_temp = june_data.tobs
december_temp = december_data.tobs

june_temp.head()

december_temp.head()

# Run paired t-test
stats.ttest_ind(june_temp,december_temp)

# ### Analysis

# The mean temperatures found across all stations in June and December for the years 2010-2017 change by around 3.9 degrees F. When a paired t test was run, it had a high p-value of 3.90521, which deems is not statistically significant, therefore indicates strong evidence of a null hypothesis (meaning there exists no relationship in our data).



StarcoderdataJupyterScriptsDedupFiltered