<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('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['date']
#dt.fromisoformat(df['date'])
df.dtypes
#df['date'] = pd.Timedelta(df['date']).isoformat()
df['date']=pd.to_datetime(df['date'], infer_datetime_format=True)
df.dtypes
df.head()
# Set the date column as the DataFrame index
df.set_index('date',inplace=True)
# Drop the date column
df.reset_index(drop=True,inplace=True)<jupyter_output><empty_output><jupyter_text>Compare June and December data across all years<jupyter_code>from scipy import stats
# Python SQL toolkit and Object Relational Mapper
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func,inspect
# create engine to hawaii.sqlite
engine = create_engine("sqlite:///Resources/hawaii.sqlite",echo=False)
engine
# reflect an existing database into a new model
Base = automap_base()

# reflect the tables
Base.prepare(engine, reflect=True)
# View all of the classes that automap found
Base.classes.keys()
# Save references to each table
Measurement=Base.classes.measurement
Station=Base.classes.station
# Create our session (link) from Python to the DB
session=Session(engine)
inspector=inspect(engine)
Col=inspector.get_columns('Measurement')
for c in Col:
    print(c['name'],c['type'])
# Filter data for desired months
June_Temp=session.query(Measurement.date,Measurement.tobs).filter(func.strftime('%m',Measurement.date)=='06').all()
June_Temp
Dec_Temp=session.query(Measurement.date,Measurement.tobs).filter(func.strftime('%m',Measurement.date)=='12').all()
Dec_Temp
# Create collections of temperature data
June_Temp_DF=pd.DataFrame(June_Temp,columns=("Date","TOBS"))
June_Temp_DF.head()
Dec_Temp_DF=pd.DataFrame(Dec_Temp,columns=('Date','TOBS'))
Dec_Temp_DF.head()
# Identify the average temperature for December
Dec_AVG_Temp=Dec_Temp_DF.TOBS.mean()
Dec_AVG_Temp
# Identify the average temperature for June
June_AVG_Temp=June_Temp_DF.TOBS.mean()
June_AVG_Temp
# Run unpaired t-test
stats.ttest_ind(June_Temp_DF['TOBS'],Dec_Temp_DF['TOBS'],equal_var=False)<jupyter_output><empty_output><jupyter_text>Analysis<jupyter_code>Unpaired t-test is used to determine the difference in the average temperature of June and December  for all stations
for a time period between 2010 and 2017.

The t-statistic value is 31.35, and the p-value in this case is 4.19,so it can be concluded that there is no statistical 
significance.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11534276387377584, 'fraction_numerical': 0.006891548784911135, 'mean_word_length': 7.61875, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '387732', 'license': 'ADSL', 'n_tokens_mistral': 945, 'n_tokens_neox': 897, 'n_words': 229, 'path': 'temp_analysis_bonus_1_starter.ipynb', 'repo_name': 'lekpix/sqlalchemy-challenge', 'size': '2757'}