I would like to add a new column retailer_relationship
, to my dataframe.
I would like each row value of this new column to be 'TRUE'
if the retailer
column value starts with any items within the list retailer_relationship
, and 'FALSE'
otherwise.
What I've tried:
list_of_relationships = ("retailer1","retailer2","retailer3")
for i in df.index:
for relationship in list_of_relationships:
if df.iloc[i]['retailer'].str.startswith(relationship):
df.at[i, 'retailer_relationship'] = "TRUE"
else:
df.at[i, 'retailer_relationship'] = "FALSE"