How do i call data for the dates and values for any shares?
Example: I want to call the stock price and date for apple shares only for dec 2016, dec 2017.
Here is what I've tried:
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader.data as web
import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt
import datetime as dt
start = dt.datetime(2013,10,1)
end= dt.datetime(2018,4,30)
AAPL_data=[]
AAPL= web.DataReader('AAPL','iex', start, end)
AAPL_data.append(AAPL)
AAPL.loc['2016-12-01':'2016-12-31']
AAPL.loc['2017-12-01':'2017-12-31']
both work for me, for December '16/'17 data respectively. Pandas datetime indexing is very flexible and intuitive, see more examples here.
Incidentally, if you're using the new release of pandas-datareader (0.7.0), you no longer need to insert pd.core.common.is_list_like = pd.api.types.is_list_like
.