I'm very new to Python so apologies for my lack of understanding.
I need to read in 2 columns (latitude & longitude) of a 4 column CSV file. Example below.
ShopName Misc latitude longitude XXX 3 999999 999999
I then have to change the latitude and longitude using a pyproj transform scrypt that I have checked. I then need to save the tranformed latitude and longitude data into a new csv such that the column format is the same as the existing csv. Example below.
ShopName Misc latitude longitude XXX 3 49.12124 -2.32131
I'm a bit lost but this is where I got to. Thank you in advance
import csv
from pyproj import Transformer
#2.2 Define function
def transformer = Transformer.from_crs("epsg:12345", "epsg:9999")
result = transformer.transform(old_longitude, old_latitude)
return new_longitude, new latitude
#2.3 Set destination file to variable
with open('new.csv' ,'w') as csv_new2:
#2.4 Instruct write method to new file
fileWriter2 = csv.writer(csv_new2)
#2.5 Set existing file to variable
with open('old.csv','r') as csv_old2:
#2.6 Instruct read method to new file
fileReader2 = csv.reader(csv_old2)
for row in fileReader2: