I have a data frame like this:
df
col1 col2
1 A
3 B
6 A
10 C
I want to create a data frame from above df in such a way that, if col1 values are not consecutive, it will create another row with the next col1 value and col2 value will be the just the above value.
the data frame I am looking for should be
df
col1 col2
1 A
2 A
3 B
4 B
5 B
6 A
7 A
8 A
9 A
10 C
I could do it using a simple for loop, But is there any pythonic way to do it most efficiently using pandas ?