src/03_modelling/07_feature_engineering.py
def fill_geom(df):
        """This function fills Geom for some business_id
            and recovers around 1000 geoms in train set.
        """

        # list of business_id that has null geom
        list_of_id = df[df.Geom.isnull()].business_id.unique()

        # get all rows for these ids from original df
        could_fill = df[df.business_id.isin(list_of_id)]

        # able to find geom for these ids
        list_of_id = could_fill[could_fill.Geom.notnull()].business_id.unique()

        # fill geoms
        for i in list_of_id:
            df_i = df[df.business_id == i]
            geom = df_i[df_i.Geom.notnull()].Geom.values[0]
            df.loc[df.business_id == i, 'Geom'] = geom

        return df
This function fills Geom for some business_id
            and recovers around 1000 geoms in train set.
        
This function fills Geom for some business_id
and recovers around 1000 geoms in train set.
This function fills Geom for some business_id and recovers around 1000 geoms in train set .
def fill_geom(df):
        list_of_id = df[df.Geom.isnull()].business_id.unique()
        could_fill = df[df.business_id.isin(list_of_id)]
        list_of_id = could_fill[could_fill.Geom.notnull()].business_id.unique()
        for i in list_of_id:
            df_i = df[df.business_id == i]
            geom = df_i[df_i.Geom.notnull()].Geom.values[0]
            df.loc[df.business_id == i, 'Geom'] = geom
        return df
def fill_geom ( df ) : list_of_id = df [ df . Geom . isnull ( ) ] . business_id . unique ( ) could_fill = df [ df . business_id . isin ( list_of_id ) ] list_of_id = could_fill [ could_fill . Geom . notnull ( ) ] . business_id . unique ( ) for i in list_of_id : df_i = df [ df . business_id == i ] geom = df_i [ df_i . Geom . notnull ( ) ] . Geom . values [ 0 ] df . loc [ df . business_id == i , 'Geom' ] = geom return df
This function fills Geom for some business_id
and recovers around 1000 geoms in train set.
This function fills Geom for some business_id and recovers around 1000 geoms in train set .
"""This function fills Geom for some business_id
            and recovers around 1000 geoms in train set.
        """ # list of business_id that has null geom # get all rows for these ids from original df # able to find geom for these ids # fill geoms
df