<jupyter_start><jupyter_text>Advanced Matplotlib Graphing Assignment DatasetConstructionTimeSeriesDatav2.csv  Pre-Processing<jupyter_code>import pandas as pd
%matplotlib inline

import matplotlib.pyplot as plt

df_const = pd.read_csv('ConstructionTimeSeriesDatav2.csv')
df_const.head()
df_const.shape
df_const
df_const['Difference'] = df_const['Private Construction']-df_const['Public Construction']
df_const['Difference'].describe()
df_const.dtypes
for i in range(len(df_const['Month-Year'])):
    df_const['Month-Year'][i] = df_const['Month-Year'][i].replace('-','')
df_const['Date DT'] = pd.to_datetime(df_const['Month-Year'], format='%b%y')
df_const.head()<jupyter_output><empty_output><jupyter_text>Create the Graph<jupyter_code>date = df_const['Date DT'] 
diff = df_const['Difference'] 
fig,ax = plt.subplots()

fig.suptitle('How Much More Was Spent on Private than Public Construction',fontsize=14)

ax.plot(date,diff,color='k')
ax.xaxis.set_label_text('Date',fontsize=13)  # x-axis caption
ax.yaxis.set_label_text('Difference (Private-Public)',fontsize=13) # y-axis caption

# Vertical Lines
ax.axvline(pd.to_datetime('2005-01-01'),linewidth=1,color='k',label='Low',linestyle='-')
ax.axvline(pd.to_datetime('2007-01-01'),linewidth=1,color='k',label='High',linestyle='-')

ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)

# Axis limits
ax.set_ylim(0,max(diff)+10000)

# Y tick labels
ax.set_yticklabels(["${:,.0f}".format(x) for x in ax.get_yticks()])

# Text
ax.text(pd.to_datetime('2006-01-01'),30000,'Max',fontsize=12,verticalalignment='center',\
        horizontalalignment='center',fontname='Times New Roman')
ax.text(pd.to_datetime('2006-01-01'),25000,'Difference',fontsize=12,verticalalignment='center',\
        horizontalalignment='center',fontname='Times New Roman')

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17341977309562398, 'fraction_numerical': 0.03403565640194489, 'mean_word_length': 8.497435897435897, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '253948', 'license': 'CC0-1.0', 'n_tokens_mistral': 715, 'n_tokens_neox': 666, 'n_words': 90, 'path': 'graphing/M3Graphing.ipynb', 'repo_name': 'eengleman/eengleman.github.io', 'size': '1851'}