0

I have this data

>>> data = [['Ob01',1,2,3],['Ob02',4,5,6],['Ob03',7,8,9]]
>>> dfr = pd.DataFrame(data, columns = ['Name', 'A','B','C'])

With a little bit of operation now I have this:

   Name  Op    A    B    C
   Ob01  Val   1    2    3
         mul2  2    4    6 
         div3 0.66 1.33  2 
   Ob02  Val   4    5    6
         mul2  8    10  12 
        div3 2.66 3.33  4 
   Ob03  Val   7    8    9
         mul2  14  16   18 
         div3 4.66 5.33  6 

where column Name is the index and column Op is subindex But now I want to add this new row but in all objects:

le = [24,26,72]

to obtain:

   Name  Op    A    B    C
   Ob01  Val   1    2    3
         mul2  2    4    6 
         div3 0.66 1.33  2 
         le    24   26   72
   Ob02  Val   4    5    6
         mul2  8    10  12 
         div3 2.66 3.33  4
         le    24   26   72 
   Ob03  Val   7    8    9
         mul2  14  16   18 
         div3 4.66 5.33  6
         le    24   26   72
Pamela
  • 15
  • 3
  • Does this answer your question? [adding a row to a MultiIndex DataFrame/Series](https://stackoverflow.com/questions/24917700/adding-a-row-to-a-multiindex-dataframe-series) – xyzjayne Jun 09 '21 at 18:47

0 Answers0