I got stuck when calculating the median age in grouped data (age ranges) for each feature (each feature is a single administrative unit). I have about 18,000 features.
Field names indicate age ranges: 0-14, 15-64, 65-100. In the "median" field I would like to calculate the median age for each feature. I found a website https://atozmath.com/StatsG.aspx?q=1 where you can calculate such a median for a single feature, for example the first feature from the attribute table above.
The page easily calculated the median for the first feature in the image, and the page also wrote how it calculated it, but I don't know how to write a universal script for a "median" field to calculate the median for each feature.
Solved! Go to Solution.
now there is an error with this file path
how to write it so that was good?
Hi,
I've edited the original code to account for my stupidity.
Also you need to specify you path with 'r' then in quotes as per the code.
E.g. r'c:/users/david/project.gdb'
Have you done as I said mate?
my path looks like this and still error
Can you export your shapefile to a feature class? Not sure what's wrong.
Haha, I've edited the original to count it as a list rather than new parameters. My bad.