I tried to open a big .csv file in python to seperate each row and append the last x lines in a new list.
btcDatear = []
btcPricear = []
btcVolumear = []
howfarback = 20000
try:
sourceCode = open('.btceUSD.csv', 'r')
splitSource = sourceCode.split('\n')
for eachline in splitSource[-howfarback:]:
splitLine = eachline.split(',')
btcDate = splitLine[0]
btcPrice = splitLine[1]
btcVolume = splitLine[2]
btcDatear.append(float(btcDate))
btcPricear.append(float(btcPrice))
btcVolumear.append(float(btcVolume))
except Exception, e:
print "failed raw data", str(e)
It works with file as small as 20MB but when i try it with a file around 500MB, it does not work.