A large .csv file has a typical row with approx 3000 data elements separated by commas. Approximately 50% of this data is fluff(non-value added data) and can be removed. How can I remove this fluff with multiple string removals? I am new to Python.
I can read the data. I am unable to change the data. Variable x in the code below would be the changed string by row.
with open('som_w.csv','r+') as file:
reader = csv.reader(file, delimiter=',')
for i, row in enumerate(reader):
print(row)
print(i+1)
writer = csv.writer(file, delimiter=',')
for row in writer:
x = re.sub(r'<.*?>',"",writer)
print(x)
file.close()
The current error is the csv.writer is not iterable. I believe I'm heading down the wrong path.