Given the following dataframe:
import pandas as pd
df = pd.DataFrame({'level_0':[0,0,0,1,1,2,2,2,3,3],'name':['a','b','c','a','b','a','b','c','a','b'],'value':[1,2,3,1,2,1,2,3,1,2]})
df.set_index('level_0', inplace=True)
df
name value
level_0
0 a 1
0 b 2
0 c 3
1 a 1
1 b 2
2 a 1
2 b 2
2 c 3
3 a 1
3 b 2
I want to insert a row containing "c" for "name" and 3 for "value" where missing per index (level_0). I need to preserve the order such that "c" always occurs after "b".
Desired result:
name value
level_0
0 a 1
0 b 2
0 c 3
1 a 1
1 b 2
1 c 3
2 a 1
2 b 2
2 c 3
3 a 1
3 b 2
3 c 3
Thanks in advance!