There are some good examples of how to calculate zonal stats using geopandas and Rasterio/GDAL but all of these return a single statistic. Is there a method to return all of the pixel values so that custom statistics can be performed on the array of returned values?
so instead of:
gdf['mean'] = pd.DataFrame( zonal_stats( vectors=gdf['geometry'], raster='raster.tif', stats='mean' ) )['mean']
you would have something like:
gdf['All'] = pd.DataFrame( zonal_stats( vectors=gdf['geometry'], raster='raster.tif', stats='array' ) )['array']
This was originally closed as it was categorized as being answered elsewhere but the answer provided wasn't suitable (Geopandas and Zonal Statistic error). This answer does not demonstrate how to get the array.