Code:
import pandas as pd
import pandas_datareader.data as pdr
import datetime as dt
df = pdr.DataReader('MSFT','yahoo', start='2021-4-15', end='2023-04-14')
df.head()
O/P:
TypeError: string indices must be integers, not 'str'.
I was trying to get the stock data as dataframe using pandas datareader library, while practicing and learning.
but in O/P it's throwing error as
TypeError: string indices must be integers, not 'str'
How to fix it ? I have gone through the pd datareader documentation, where they also shown the exact code snippet.
You can try this approach:
That is how you can access the data until the issue with package will be solved.