There are 2 types of warehouses warehouses capital and regional. It is necessary to scatter cities in different warehouses: Moscow and St. Petersburg in "MSKSPB", others in "regions" I wrote the following formula

clients['Склад'] = \ np.where(clients['Город'].map(lambda x: str(x)) == 'Москва', "MSKSPB", "Reg") 

How to add to the formula and Peter?

    1 answer 1

    Try this:

     cities = ['Москва','Санкт-Петербург'] clients['Склад'] = np.where(clients['Город'].isin(cities), 'MSKSPB', 'Reg')