I have multiple columns with the status of the areas, I need to get the status on status column if all the status are completed.
You can filter all columns with Area
in columns names by DataFrame.filter
, compare by DataFrame.eq
for ==
and test if all True
s per rows by DataFrame.all
:
df['Status'] = df.filter(like='Area').eq('Completed').all(axis=1)
Or you can seelct all columns without first 2 by DataFrame.iloc
:
df['Status'] = df.iloc[:, 2:].eq('Completed').all(axis=1)
Or last 3 columns:
df['Status'] = df.iloc[:, -3:].eq('Completed').all(axis=1)
thanks ...i need to know how can i find the extact word,even am getting the similar word
@Deepweber - Not easy, need fuzzy match