I have a csv file contaning 30000000 entries. like this
കൃഷി 3
വ്യാപകമാകുന്നു 2
നെല്കൃഷി 2
വെള്ളം 2
നെല്ല് 2
മാത്രമേ 2
ജല 2
When I try to reve
Since all you want to do is write the file in reverse order, just write the same row back, but in reverse; like this:
writer.writerow(row[::-1])
A negative index starts from the right, and a negative step value (the third argument in the slice syntax) will simply reverse the object.
This will stop the error you are seeing now, and in case you have rows columns that are not 2, they will also be written in reverse.