<jupyter_start><jupyter_text>Bonus: Temperature Analysis I<jupyter_code>import pandas as pd
from datetime import datetime as dt
# "tobs" is "temperature observations"
df = pd.read_csv(r'C:\Users\nnoar\OneDrive\Desktop\sqlaclhemy-challenge\Resources\hawaii_measurements.csv')
df.head()
# Convert the date column format from string to datetime
df['date'] = pd.to_datetime(df['date'],format='%Y-%m-%d')
df.info()
# Set the date column as the DataFrame index
df.set_index('date')

# Drop the date column
### Why would I do this if I need to filter by month???<jupyter_output><empty_output><jupyter_text>Compare June and December data across all years<jupyter_code>from scipy import stats
# Filter data for desired months
june = df.loc[df['date'].dt.month == 6 ]
december = df.loc[df['date'].dt.month == 12]


# Identify the average temperature for June
avg_june = june['tobs'].mean()
print(f'The average temperature in June is {avg_june} degrees')
# Identify the average temperature for December
avg_dec = december['tobs'].mean()
print(f'The average temperature in December is {avg_dec} degrees ')
# Create collections of temperature data
june_temps = june['tobs']
dec_temps = december['tobs']
all_temps = df['tobs']
# Run paired t-test
stats.ttest_ind(june_temps,all_temps)

stats.ttest_ind(dec_temps,all_temps)<jupyter_output><empty_output><jupyter_text>Analysis<jupyter_code>##We see from these that the average temperature on a day in June is closer to the average day overall than the average temperature on a day in Deecember in Hawaii.<jupyter_output><empty_output>