I need to set a variable in Column B based on value in Column A as in :
ABC 1
PQR -
ABC -
PQR -
ABC -
PQR -
In my data, against some values of Column A I have a '1' set in column B. But the issue is it is against only the first occurrence. Like for 'ABC' above, '1' is set only for the first occurrence.
I need to set the '1' for all such remaining values. PS - There are a lot of entries so I can't hard-code values like 'For all ABC set column B to 1'
I've tried the following logic -
#Filter out entries with a '1' set
df_one = df_Consolidated[df_Consolidated['Val'] == 1]
#Store these values in a list
list_l2 = []
for s in df_one:
list_l2.append(df_one['Text String'])
#Check in the dataframe column once again iterating over the list
But I don't think this is the best or the correct approach to do this. I'm looking for a simple yet effective solution.