[Enhancement] unnecessary calculation of composed classification in `population/urban_features.py`
lgervasoni opened this issue · 0 comments
lgervasoni commented
The composed classification calculation is unnecessary. During the pre-processing step, buildings classification are already given according to their composed classification, considering both containing Points of interest and building parts.
Code in population/urban_features.py
# Calculate the composed classification
df_osm_built.containing_poi = df_osm_built.containing_poi.apply(lambda x: x if isinstance(x,list) else [])
df_osm_built.activity_category = df_osm_built.activity_category.apply(lambda x: x if isinstance(x,list) else [])
df_osm_built['composed_classification'] = df_osm_built.apply(lambda x: get_composed_classification( x, df_osm_pois.loc[x.containing_poi] ).classification, axis=1 )
df_osm_built.loc[ df_osm_built.containing_poi.apply(lambda x: len(x)==0 ), "containing_poi" ] = np.nan
df_osm_built.loc[ df_osm_built.activity_category.apply(lambda x: len(x)==0 ), "activity_category" ] = np.nan