import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
#Resetting style
plt.rcParams.update(plt.rcParamsDefault)
ts = pd.read_csv('Desktop/Gold_Yearly.csv')
ts.head()
#Renaming specific columns
ts = ts.rename(columns={'Average\nClosing Price': 'Avg Closing Price',
'Annual\n% Change':'Annual Percentage Change'})
ts.columns
ts = ts.set_index('Year')
ts.index
fig, ax = plt.subplots(figsize=(20,12))
#Setting Style
plt.style.use('fivethirtyeight')
ax.plot(ts.index, ts['Avg Closing Price'])
#Modifying Labels
ax.tick_params(axis='both', labelsize=18)
ax.set_title('Historical Price of Gold')
ax.set_xlabel('Year', size = 20)
ax.set_ylabel('Price (USD)', size = 20)
#Plotting
plt.show()
fig, ax = plt.subplots(figsize=(20,12))
ax.plot(ts.index, ts['Annual Percentage Change'])
#Modifying Labels
ax.set_title('Historical Yearly Percentage Change of the Price of Gold')
ax.set_xlabel('Year', size = 20)
ax.set_ylabel('Percentage Change', size = 20)
#Plotting
plt.show()