I've got a dataframe in which I am trying to look through the column "#Inc" to see if there is the number 4. If there is, I want to print the whole row. How do I do this?
I tried this and failed (Error was --> only list like object are allowed to be passed to isin(), you passed an int):
if df.loc[df['#Inc'].isin(4)] is true:
print 'WIN'
else:
print 'FAILURE!'
Here is the output:
OUTPUT:
Month Avg Inc. #Inc Avg.Dec #Dec
0 JAN 0.091454 1 0.000000 0
1 FEB 0.008307 1 -0.030809 1
2 MAR 0.000000 0 -0.027193 2
3 APR 0.008845 1 -0.035857 1
4 MAY 0.000000 0 -0.076321 2
5 JUN 0.033715 1 -0.025242 1
6 JUL 0.016775 1 -0.028849 1
7 AUG 0.079845 1 -0.033116 1
8 SEP 0.000000 0 -0.042201 2
9 OCT 0.044914 1 -0.049798 1
10 NOV 0.000000 0 -0.148163 2
11 DEC 0.039241 1 -0.024030 1