<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
# Set the date column as the DataFrame index
df.set_index('Date',inplace=True)
df
# Drop the date column

del df["date"]
df

#df=df.drop(colums='date')
#df<jupyter_output><empty_output><jupyter_text>Compare June and December data across all years<jupyter_code>from scipy import stats
from numpy import mean, std
df=df.reset_index()
df
# Filter data for desired months

df["Date"].dtype
df_jun_dec=df.loc[(df["Date"].dt.month==6) | (df["Date"].dt.month==12) ,["Date","tobs"]]
df_jun_dec.head()
# Identify the average temperature for June
jun_df=df_jun_dec.loc[df_jun_dec["Date"].dt.month==6]
jun_temp=jun_df["tobs"]
jun_temp_list=jun_temp.tolist()

m_j=mean(jun_temp_list)
std_j=std(jun_temp_list)

print(f"Average Temperature: {m_j} , Standard Deviation: {std_j}")
# Identify the average temperature for December
dec_df=df_jun_dec.loc[df_jun_dec["Date"].dt.month==12]
dec_temp=dec_df["tobs"]
dec_temp_list=dec_temp.tolist()

m_d=mean(dec_temp_list)
std_d=std(dec_temp_list)

print(f"Average Temperature: {m_d} , Standard Deviation: {std_d}")
# Create collections of temperature data

jun_list=[]

for jun in jun_temp_list:
    if type(jun)==int:
        jun_list.append(jun)
        
dec_list=[]

for dec in dec_temp_list:
    if type(dec)==int:
        dec_list.append(dec)
# Run paired t-test
stats.ttest_ind(jun_list, dec_list)<jupyter_output><empty_output><jupyter_text>Analysis<jupyter_code># pvalue is significant that's why june and december months 
# have significantly different weather condition.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13089560148383678, 'fraction_numerical': 0.003179650238473768, 'mean_word_length': 6.769547325102881, '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': '34214', 'license': 'ADSL', 'n_tokens_mistral': 725, 'n_tokens_neox': 695, 'n_words': 152, 'path': 'temp_analysis_bonus_1_starter.ipynb', 'repo_name': 'warshophysical/sqlalchemy-challenge', 'size': '1887'}