I have a csv file of stock market tickers name which I want to import into python as a list in order to use it in web.DataReader(ticker_list, 'yahoo', start, end)
. Since my csv file is only a single column, is there a efficient way to do this? My list is as simple as below image
Would this work for you?
import csv
with open('1.csv') as f:
reader = csv.reader(f)
data = list(reader)
Afterwards you could access the lists contents by using something like
print(data[0])
for an output of ['^GSPC']
.
I hope this helps