I have a dataframe with lots of rows
0 val1
1 val2
2 val3
3 val3
4 val4
5 nan
6 nan
7 val7
I drop the na values I am left with:
0 val1
1 val2
2 val3
3 val3
4 val4
7 val7
However, now if I iterate over this doing something like:
for i in range(df.shape[0]):
row = df.at[1, 'colname']
I get an index error. I need to reindex it so it becomes like:
0 val1
1 val2
2 val3
3 val3
4 val4
5 val7
What is the best way to do this?
Thanks