'Undefined variable under data frame
This is my code but when I try for example to find the info of the stock, it says that goog is not defined.
import pandas as pd
from pandas_datareader import data as pdr
import yfinance as yf
yf.pdr_override()
from datetime import datetime
stock_list = ['goog', 'tsla']
# Set DataFrame as the Stock Ticker
end = '2022-03-01'
start = '2020-03-01'
for stock in stock_list:
globals()[stock] = pdr.get_data_yahoo(stock,start,end)
goog.info()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
