<jupyter_start><jupyter_text>Pumpkin lesson<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt

pumpkins = pd.read_csv('../data/US-pumpkins.csv')
pumpkins = pumpkins[pumpkins['Package'].str.contains('bushel', case=True, regex=True)]
pumpkins.head()<jupyter_output><empty_output><jupyter_text>Let's check for nulls<jupyter_code>pumpkins.isnull().sum()<jupyter_output><empty_output><jupyter_text>Let's only keep the most useful columns<jupyter_code>new_columns = ['City Name', 'Package', 'Month', 'Low Price', 'High Price', 'Date']
pumpkins.drop([c for c in pumpkins.columns if c not in new_columns], axis=1)
price = (pumpkins['Low Price'] + pumpkins['High Price']) / 2
month = pd.DatetimeIndex(pumpkins['Date']).month
new_pumpkins = pd.DataFrame({'Month': month, 'City': pumpkins['City Name'], 'Package': pumpkins['Package'], 'Low Price': pumpkins['Low Price'],'High Price': pumpkins['High Price'], 'Price': price})
new_pumpkins.loc[new_pumpkins['Package'].str.contains('1 1/9'), 'Price'] = price/(1 + 1/9)
new_pumpkins.loc[new_pumpkins['Package'].str.contains('1/2'), 'Price'] = price/(1/2)
new_pumpkins<jupyter_output><empty_output><jupyter_text>Visualizations<jupyter_code>price = new_pumpkins.Price
month = new_pumpkins.Month
plt.scatter(price, month)
plt.show()
new_pumpkins.groupby(['Month'])['Price'].mean().plot(kind='bar')
plt.ylabel("Pumpkin Price")<jupyter_output><empty_output><jupyter_text>Exercise
Visualize stuff :-)<jupyter_code>new_pumpkins.groupby(['Package'])['Price'].mean().plot(kind='bar')
plt.ylabel("Pumpkin Price")
new_pumpkins.groupby(['Month'])['Price'].mean().plot(kind='bar')
plt.ylabel("Pumpkin Price")
new_pumpkins.groupby(['City'])['Price'].mean().plot(kind='bar')
plt.ylabel("Pumpkin Price")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1889013452914798, 'fraction_numerical': 0.006726457399103139, 'mean_word_length': 8.807692307692308, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '479520', 'license': 'MIT', 'n_tokens_mistral': 671, 'n_tokens_neox': 664, 'n_words': 99, 'path': '2-Regression/2-Data/notebook.ipynb', 'repo_name': 'SabbeRubbish/ML-For-Beginners', 'size': '1784'}