<jupyter_start><jupyter_text>S&P 500 Historical Analysis  Questions  Q1. From 1927-12-29 to the Present (2021-02-01), what is the distribution of daily returns?  A1.<jupyter_code>%pip install pandas
%pip install matplotlib
import pandas as pd

df = pd.read_csv("1927-12-29-to-2021-02-01-daily.csv", usecols=["Open", "Close"])

daily_returns = []

for i, row in df.iterrows():
    if row["Open"] == 0.0:
        daily_returns.append(0.0)
        continue

    daily_return = 100 * (row["Close"] - row["Open"]) / row["Open"]
    daily_returns.append(daily_return)

daily_returns = list(filter(lambda x: x != 0.0, daily_returns))
ax = pd.DataFrame(daily_returns).plot.hist(bins=100,
                                           figsize=(10,10),
                                           grid=True,
                                           title="Daily Return % of the S&P 500 since December 29th 1927")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12795698924731183, 'fraction_numerical': 0.06666666666666667, 'mean_word_length': 2.41025641025641, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '511365', 'license': 'MIT', 'n_tokens_mistral': 336, 'n_tokens_neox': 286, 'n_words': 70, 'path': 'S&P-500/analysis.ipynb', 'repo_name': 'adyavanapalli/financial-markets', 'size': '930'}