0

Hi I am trying to create new column based on multiple conditions on multiple column and I keep getting the following error

Cannot perform 'rand_' with a dtyped [bool] array and scalar of type [bool]

The code that I have written is as below :

condition = [frame['Type'] == 'Commercial' & frame['var'].str.contains("IN-MARKET", case=False) 
& pd.DatetimeIndex(frame['Day']).year == 2019 & pd.DatetimeIndex(frame['Day']).month == 2,
frame['Type'] == 'Commercial' & frame['Campaign'].str.contains("FruitnNuts", case=False) & 
frame['var'].str.contains("300X250", case=False) & frame['Day'] >= '2019-04-08' & frame['Day'] <= '2019-04-20']
    
frame['norm'] = np.select(condition, [frame['imp']*0.03, imp*0.01], 
                                         default=frame['completes'])

I am hoping if someone can please help to resolve the issue. Any help would be highly appreciated

Tushar Mehta
  • 550
  • 1
  • 9
  • 21

0 Answers0