I am working with very large .csv files and am attempting to find the number of lines in the file as well as other things such as parsing into json, etc.
my question is how do I overcome the limitations of the csv library because I am constantly receiving the following error.
I am providing a sample program that I know to work in python3 that will return the number of rows in the csv file.
import csv
input = 'large-input.csv'
with open(input ,"r") as f:
reader = csv.reader(f,delimiter = ",")
data = list(reader)
row_count = len(data)
print(row_count)
however, I continue getting this error when run against a 1.5GB csv file.
Traceback (most recent call last):
File "csv-len.py", line 6, in <module>
data = list(reader)
_csv.Error: field larger than field limit (131072)
Any work-arround this issue is greatly appreciated. thanks!