Try resetting index
df.reset_index(col_fill=['values', 'ID'])
it will create one more column which you can drop
or pop
from DataFrame.
The Final frame will be
ID value a
1 10 1
1 11 2
1 12 3
2 13 4
3 14 5
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.