<jupyter_start><jupyter_text>Initial exploration of the space data<jupyter_code>space_data.head()
space_data.tail()
space_data.describe()<jupyter_output><empty_output><jupyter_text>Some basic cleaning of missing space data<jupyter_code>missing = space_data[space_data.isnull().any(axis=1)]
len(missing) #Uh oh, it looks like 3360/4323 rows have missing rocket cost data
missing.head()
space_data['Rocket'] = space_data['Rocket'].str.strip().str.replace(",","").astype(float)
space_data['Rocket'] = space_data['Rocket'].fillna(space_data['Rocket'].median()) #Simple imputation of missing rocket costs with median value
space_data.head()<jupyter_output><empty_output><jupyter_text>Summarizing some space data<jupyter_code>#In order to better summarize the data, I decided to isolate years from the data column so that I have more numerical data
years = [0]*len(space_data)
for i in range(len(space_data)):
    years[i] = int(space_data['Datum'][i].split()[3])
space_data['Year'] = years
space_data.head()
space_data.describe() #Instead of having to seperate summarize and mean/sd in R, python's describe function allows us to do them in one step<jupyter_output><empty_output><jupyter_text>Graphing some space data<jupyter_code>#Graphing a basic year vs. rocket cost graph by using pythons version of grouping
grouped_data = space_data.groupby(['Year']).mean().reset_index()
plt.plot('Year', 'Rocket', data=grouped_data, marker='o', color='Black')
plt.grid()
plt.xlabel("Year", size=12)
plt.ylabel("averageCost", size=12)
#The plot turned out relatively similar to the R group plot, but there are some interesting differences that I'll have to think about<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12366230677764566, 'fraction_numerical': 0.0089179548156956, 'mean_word_length': 7.8578947368421055, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '271767', 'license': 'MIT', 'n_tokens_mistral': 560, 'n_tokens_neox': 531, 'n_words': 152, 'path': 'space exploration/nathan-li-a-little-python-with-space.ipynb', 'repo_name': 'Elephant333/Kaggle-Machine-Learning-Notebooks', 'size': '1682'}