I have a data frame. Then I have a logical condition using which I create another data frame by removing some rows. The new data frame however skips indices for removed rows. How can I get it to reindex sequentially without skipping? Here's a sample coded to clarify
import pandas as pd
import numpy as np
jjarray = np.array(range(5))
eq2 = jjarray == 2
neq2 = np.logical_not(eq2)
jjdf = pd.DataFrame(jjarray)
jjdfno2 = jjdf[neq2]
jjdfno2
Out:
0
0 0
1 1
3 3
4 4
I want it to look like this:
0
0 0
1 1
2 3
3 4
Thanks.