I'm creating code that takes financial data from QUANDL The problem is that I can't format the chart by date. I searched the internet and saw that I have to use the matplotlib.dates library Here I paste the code. Would anyone be able to help me?
I want to see the date in this format: 10-10-2018
import pandas as pd
import quandl
import datetime as dt
import numpy as np
#matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
from matplotlib import style
start = dt.datetime(2018, 1, 1)
end = dt.date.today()
s = "AAPL"
#token = ""
#add authtoken = token
df = quandl.get("WIKI/" + s, start_date = start, end_date = end)
# df['10ma'] = df['Close'].rolling(10).mean().shift()
df['10ma'] = df['Close'].rolling(window = 10, min_periods= 0).mean()
df['20ma'] = df['Close'].rolling(window = 20, min_periods= 0).mean()
plt.show()
Open High Low ... Adj. Low Adj. Close Adj. Volume
Date ...
2018-01-02 170.16 172.30 169.26 ... 169.26 172.26 25048048.0
2018-01-03 172.53 174.55 171.96 ... 171.96 172.23 28819653.0
2018-01-04 172.54 173.47 172.08 ... 172.08 173.03 22211345.0
2018-01-05 173.44 175.37 173.05 ... 173.05 175.00 23016177.0
2018-01-08 174.35 175.61 173.93 ... 173.93 174.35 20134092.0
[5 rows x 12 columns]