I have such a pandas dataframe:
A B C
1 2 3
4 5 6
nullnull 0 1
7 8 9
I now want to find out the index of the row where the nullnull
is. To use this index for slicing in order to get only the rows before this index.
I tried something like this:
row = df.ix[df['A'].startswith("nullnull")].index.tolist()
And got this error:
AttributeError: 'DataFrame' object has no attribute 'ix'
How could I do this using startswith
or maybe using another approach?
Change to loc
or .iloc
row = df.loc[df['A'].str.startswith("nullnull")].index.tolist()
row
Out[549]: [2]