0

having this df:

      JSN CIRL1_I[X] CIRL1_I[Y] CIRL1_I[Z] CIRL2_D[X] CIRL2_D[Y] CIRL2_D[Z]  \
0      USL          1          1          1          1          1          1   
1      LSL         -1         -1         -1         -1         -1         -1   
2      UTL       0,75       0,75       0,75       0,75       0,75       0,75   
3      LTL      -0,75      -0,75      -0,75      -0,75      -0,75      -0,75   
4      URL        NaN        NaN        NaN        NaN        NaN        NaN   
5      LRL        NaN        NaN        NaN        NaN        NaN        NaN   
6  NOMINAL     -518,9       -447     183,79       -525      446,5        244  

Then I convert the first row to index, which creates a row without entries (even not Nan)

raw_limits = raw_limits.set_index('JSN') 

        CIRL1_I[X] CIRL1_I[Y] CIRL1_I[Z] CIRL2_D[X] CIRL2_D[Y] CIRL2_D[Z]  \
JSN                                                                         
USL              1          1          1          1          1          1   
LSL             -1         -1         -1         -1         -1         -1   
UTL           0,75       0,75       0,75       0,75       0,75       0,75   
LTL          -0,75      -0,75      -0,75      -0,75      -0,75      -0,75   
URL            NaN        NaN        NaN        NaN        NaN        NaN   
LRL            NaN        NaN        NaN        NaN        NaN        NaN   
NOMINAL     -518,9       -447     183,79       -525      446,5        244 

I want to drop the row 'JSN', it works with every row but the first:

 raw_limits = raw_limits.drop(['JSN'])

 KeyError: "['JSN'] not found in axis"

How I can get rif of the first row? Thanks

1 Answers1

0

JSN is not a row with entries but the index (as you specified using raw_limits.set_index("JSN")).

So there is no row to drop.

To remove the column (i.e. the index) 'JSN' you can do:

raw_limits.reset_index(drop=True)

That will reset your index back to 0-6 and drop the current JSN index.

Luke
  • 11
  • 4