I have a data frame where a column (column B) can contain a letters, a number or nothing at all. Lets say the data frame is:
A B C
1 2 Dog
3 C Bird
30 nan Cat
11 4.1 Wolf
And I want to get rows conditionally, based on whether there is a number in column B:
A B C
1 2 Dog
11 4.1 Wolf
I have found that I can limit the dataframe to only rows that contain values by entering df.loc[df["B"].notnull()]
. What I'm trying to find out is whether or not there is an equivalent version of .notnull()
that can select only rows where column B contains a number?