Jun-13-2023, 05:30 PM
Hi, my scripts are evolving but I seem to have taken a step backward. The script below works without the print(data) command but not with it. This wasn't the case before but I don't know what script complexity has caused this to start happening.
import yfinance as yf import pandas as pd #import sys from datetime import date today = date.today() data = None for line in open('C:\\Users\\stant\\OneDrive\\Documents\\daxandpython\\tickers.txt'): #ticker="MSFT"#yf.Ticker(line.strip("\n\r")) line=line.strip("\n\r") #ticker=yf.Ticker(line) ticker=line x = yf.download(ticker, start="2017-01-01", end=today, progress=False).round(2) #x["Stock"]=ticker #x["Date"]=x.index x.insert(0, "Date", x.index) x.insert(0, "Ticker", ticker) if data is None: data = x else: data = pd.concat((data, x)) data = data.sort_index() print(data)
Error: File "<stdin>", line 16
print(data)
^^^^^
SyntaxError: invalid syntax