truth value of a Series is ambiguous
truth value of a Series is ambiguous Question: I am trying to create new column in pandas dataframe with row number as condition using iloc. This is my code: import pandas as pd shop=pd.DataFrame.from_dict(data) def cate_shop (shop): if shop==shop.iloc[:4]: return ‘Service’ if shop==shop.iloc[4:140]: return ‘Food & Beverage’ if shop==shop.iloc[140:173]: return ‘Fashion’ if shop==shop.iloc[173:197]: return ‘Electronics’ …