To display only if a record is False
, you'll need to invert your condition:
mFile[~mFile['CCK']])
MVCE:
Original:
In [1273]: df
Out[1273]:
A B
0 False 8
1 True 98
2 True 97
3 False 106
4 False 50
5 False 80
6 False 80
7 True 72
8 False 117
9 False 29
Using boolean indexing
:
In [1271]: df[~df.A].B
Out[1271]:
0 8
3 106
4 50
5 80
6 80
8 117
9 29
Name: B, dtype: int64
You could also use pd.Series.mask
:
In [1272]: df.B.mask(df.A).dropna()
Out[1272]:
0 8.0
3 106.0
4 50.0
5 80.0
6 80.0
8 117.0
9 29.0
Name: B, dtype: float64
If your data has string entries, you'd need pd.Series.str.contains
:
In [1278]: df[df.A.astype(str).str.contains('False')]
Out[1278]:
A B
0 False 8
3 False 106
4 False 50
5 False 80
6 False 80
8 False 117
9 False 29
For your case, it'd be
mFile[mFile['CCK'].astype(str).str.contains('False') ]
To check if False-y
values exist, just get the mask and call pd.Series.any()
:
mFile['CCK'].astype(str).str.contains('False').any()