I have a Pandas DataFrame that contains few millions of rows. I want to select a value from a row based on a condition C
.
I have the following code that is working :
all_matches= df.loc[C, "column_name"]
first_match = next(iter(all_matches), 'no match')
The problem is that it is extremely ineficient. I would like to know how is it possible to do something similar as df.loc[C, "column_name"]
, but stoping at the first match.