I need the row number of a matching cell that is empty: Int64Index([], dtype='int64')
. I am receiving an index 0 is out of bounds for axis 0 with size 0
exception.
Print indices of matching elements:
if len(item) < 9:
print(item)
print(df[df['column name'] == item].index)
Output:
nan
1234
abc
Int64Index([], dtype='int64')
Int64Index([209], dtype='int64')
Int64Index([325], dtype='int64')
Print indice number of matching cells:
print(df[df['column name'] == item].index[0])
Output, empty indice throws exception:
index 0 is out of bounds for axis 0 with size 0
Output without blank cell:
208
324
Thanks!