I am trying to find a way to programmatically search for values in a specific column within a csv file and replace the values if the conditions are met.
Essentially, I will be dealing with a lot of large files with inconsistent data for the State value (Some use NY, others use New York). I need to try to replace most, if not all, with the ISO standard (e.g. NY) for all states.
How would I go about changing this:
data1,data2,New York,data4
data1,data2,NY,data4
data1,data2,Ohio,data4
To this:
data1,data2,NY,data4
data1,data2,NY,data4
data1,data2,OH,data4
All without creating a new file.
os.remove