Hello,
I wonder if someone can help me here. I have a csv table cells with comma separated values. I need to split those comma separated values into new rows and populate the corresponding field by dividing the dollar amount to the number of newly created rows
so I am trying to create something like this:
I haven’t included the dataset as it is huge. I know I can accomplish this in excel, but I want to automate the process with a larger dataset update in ArcGIS Pro. Thank you all in advance!
Solved! Go to Solution.
Just one approach, this can be done using python expressions in the Python window. You can copy and paste the results into a new file to read it in as a table.
with arcpy.da.SearchCursor("file.csv") as rows:
for row in rows:
ids = row[0].split(",")
val = float(row[1])
valpart = val / len(ids)
for k in ids:
print(k, valpart)
Just one approach, this can be done using python expressions in the Python window. You can copy and paste the results into a new file to read it in as a table.
with arcpy.da.SearchCursor("file.csv") as rows:
for row in rows:
ids = row[0].split(",")
val = float(row[1])
valpart = val / len(ids)
for k in ids:
print(k, valpart)
Many thanks!!