You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to this and hope someone can answer me.
I am trying to the following code but code does not work and I get following error. what is going wrong?
thanks
sale
_
import pandas as pd
import yfinance as yf
import datetime as dt_
from pandas_datareader import data as pdr
yf.pdr_override() # work around for yahoo trade data
start = dt.datetime(2016,1,1)
end = dt.datetime.now()
stocklist = ['AAPL', 'GOOG', 'MFST', 'AMZN']
for stock in stocklist:
print(f"stock = {stock}")
try:
#df=pdr.get_data_yahoo(stock,start,end)
df=pdr.get_data_stooq(stock,start,end)
#df=pdr.get_data_fred(stock,start,end)
print(df.head())
except:
print("No data "+ stock)
output:
stock = AAPL
Empty DataFrame
Columns: []
Index: []
stock = GOOG
Empty DataFrame
Columns: []
Index: []
stock = MFST
Empty DataFrame
Columns: []
Index: []
stock = AMZN
Empty DataFrame
Columns: []
Index: []
The text was updated successfully, but these errors were encountered:
I'm not seeing an error, it looks like you've posted code and output. We will need to know what link this is from and a copy-paste of the actual error will include the phrases like, Stacktrace, Traceback, or look something like this
IndentationError: unindent does not match any outer indentation level
Hi,
I am new to this and hope someone can answer me.
I am trying to the following code but code does not work and I get following error. what is going wrong?
thanks
sale
_
import pandas as pd
import yfinance as yf
import datetime as dt_
from pandas_datareader import data as pdr
yf.pdr_override() # work around for yahoo trade data
start = dt.datetime(2016,1,1)
end = dt.datetime.now()
stocklist = ['AAPL', 'GOOG', 'MFST', 'AMZN']
for stock in stocklist:
print(f"stock = {stock}")
output:
stock = AAPL
Empty DataFrame
Columns: []
Index: []
stock = GOOG
Empty DataFrame
Columns: []
Index: []
stock = MFST
Empty DataFrame
Columns: []
Index: []
stock = AMZN
Empty DataFrame
Columns: []
Index: []
The text was updated successfully, but these errors were encountered: