I am currently in a class that is a beginners course for python. We have an assignment instructing us to read the contents of the data file into a floating point array data2 without using genfromtxt or any other pre-written file-reading function. Thus, you have to create a file object, use string methods to access, convert, etc. Make the first column be yyyy-mm-dd as a floating point number. I am a little bit lost as to how I would do something like this and was hoping I could get a little bit of help on methods or ways to go about this. Thank you
data2 = []
with open('sp500_1950-01-03_to_2016-10-07.csv', 'r') as myfile:
for line in myfile:
data = line.rsplit(',')
data2.append(data)
print(data2)
This is what I have so far but I need every value/number to have its own index and be a float, I'm not sure how to do this.
finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC This is the link to the data/csv file we are supposed to read. Other than that we are supposed to come up with the method ourselves.