<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('hawaii_measurements.csv')
df.head()
# Convert the date column format from string to datetime
df['date'] = pd.to_datetime(df['date'])
df
# Set the date column as the DataFrame index
index_df = df.set_index('date', drop=False)
index_df
# Drop the date column
final_df = index_df.drop('date', 1)
final_df<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 = final_df.filter(like = '-06-', axis=0)
june_df

dec_df = final_df.filter(like = '-12-', axis=0)
dec_df
# Identify the average temperature for June
avg_june = round(june_df['tobs'].mean(), 0)
avg_june
# Identify the average temperature for December
avg_dec = round(dec_df['tobs'].mean(), 0)
avg_dec
# Create collections of temperature data
jun = june_df['tobs']
dec = dec_df['tobs']
# Run un-paired t-test
t_value, p_value = stats.ttest_ind(jun, dec)
print(f"The t_value is {t_value}.")
print(f"The p_value is {p_value}.")<jupyter_output>The t_value is 31.60372399000329.
The p_value is 3.9025129038616655e-191.
{'fraction_non_alphanumeric': 0.1167192429022082, 'fraction_numerical': 0.03548895899053628, 'mean_word_length': 6.251428571428572, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '584990', 'license': 'MIT', 'n_tokens_mistral': 492, 'n_tokens_neox': 456, 'n_words': 128, 'path': 'temp_analysis_bonus_1_starter.ipynb', 'repo_name': 'akrakowsky/sqlalchemy-challenge', 'size': '1268'}