Feb-03-2022, 01:05 PM
Hello,
I have a function in which I want to return in a column all the values that like ABC and return it in a new column as ABC , but I get an error, please advise, Thx!
def Dest_new (row):
if row(df_3.destination_location.str.startswith('ABC')) == True:
return 'ABC'
return 'Other'
df_3['Dest_New'] = df_3.apply(Dest_new, axis=1)
error :
TypeError: 'Series' object is not callable
I have a function in which I want to return in a column all the values that like ABC and return it in a new column as ABC , but I get an error, please advise, Thx!
def Dest_new (row):
if row(df_3.destination_location.str.startswith('ABC')) == True:
return 'ABC'
return 'Other'
df_3['Dest_New'] = df_3.apply(Dest_new, axis=1)
error :
TypeError: 'Series' object is not callable