quick theoretical/coding question.
I am trying to create an index that reverse classifies median household income, assuming that in a vulnerability index, lower income census tracts are more vulnerable.
Presently, I am referring to the mapclassify.NaturalBreaks documentation.
So, let's say that my geodataframe is gdf and I follow along this Automating GIS tutorial.
import mapclassify
import geopandas as gpd
gdf = gpd.read_file('census.geojson', crs='epsg:3857')
classifier = mapclassify.NaturalBreaks(k=5, reverse=True)
gdf['median_household_index'] = gdf[['median_household_income']].apply(classifier)
would this work? I cannot find any parameters or documentation that discusses reverse reclassification. Appreciate any helpful links or code snippets.
thanks,
Chris
import pysal as ps
import mapclassify as mc
import geopandas as gpd
gdf = gpd.read_file('census.geojson', crs='epsg:3857')
classifier = mc.NaturalBreaks(k=5, reverse=True)
gdf['median_household_index'] = gdf[['median_household_income']].apply(classifier)
gdf.head()
in theory, I assume this would work...stackoverflow is asking me to post this minimum reproducible code example. but this does not work when I run it ...