Tried to retrieve Cost, if s['O_Status'] values is Closed, using below code.
Got this error, ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
.
FClose = [i for i in s['Cost'] if s['O_Status'] == 'Closed']
Cost Year O_Status ----> data frame column name
-------------------------------
6100000 2001 Closed
100004 2009 Operating
2004000 2015 Closed
144007 1999 Operating
Also is it possible to make the Categorical variable values Closed and Operating in to a new dataframe in the below format and store relative cost values,
Closed Operating ------> data frame column name
--------------------------
6100000 100004
2004000 144007