In my dataframe, there are NaN values in some rows. I want to delete these rows. I solve it with dataframe.dropna(how='any'). The result looks like:
         date  time   open   hign    low  close  volume  turnover
2  2015-09-01   931  48.60  48.60  48.00  48.00  449700  21741726
3  2015-09-01   932  47.91  48.33  47.91  48.25  158500   7614508
I want to reindex the rows of my dataframe, so I run:
length = dataframe.dropna(how='any').shape[0]
dataframe1 = dataframe.index(range(length))
But dataframe1 still keeps the old index values, like:
          date  time   open   hign    low  close  volume  turnover
0         NaN   NaN    NaN    NaN    NaN    NaN     NaN       NaN
1         NaN   NaN    NaN    NaN    NaN    NaN     NaN       NaN
2  2015-09-01   931  48.60  48.60  48.00  48.00  449700  21741726
3  2015-09-01   932  47.91  48.33  47.91  48.25  158500   7614508
How can I make the number begin with 0 and delete the first two rows?
Desired result:
          date  time   open   hign    low  close  volume  turnover
0  2015-09-01   931  48.60  48.60  48.00  48.00  449700  21741726
1  2015-09-01   932  47.91  48.33  47.91  48.25  158500   7614508
 
     
    