I have over a hundred CSV files that I will join with selections of a shapefile to represent visually in QGIS.
However, in these CSV files, the data is sometimes split into rows of 1A and 1B, or 13A and 13B, for example:
I can't perform the join with rows like this, because in the shapefile the data is never split into 1A and 1B:
For my purposes, I would like to add the content of 1B to 1A (which is different fields of vote numbers) and have a resulting single row (feature) called '1' where the number attributes are now the sums of the respective numbers in 1A and 1B. Another issue with the join of course is that 1A is a 'string', when I want them to be 'int'.
I don't think the 'one-to-many' join works because of the As and Bs.
I'm hoping there is a solution using Pandas that can run through a CSV file and accomplish this merge/summation for every instance of a row split into A and B. Then, I would have this run over a whole folder to perform the same thing on all my CSV files, like this:
for file in os.scandir(src_folder): if file.name.endswith('.csv'): #perform the merge-row code