سؤال

I have some data which has multiindex called stdDF like so:

                                     MeB       ReB        nB        MeD  \
gal                 cam  prof                                             
1237667323260764326 mega 1     18.722369  0.816840  0.953351  21.372606   
                         2     19.047236  0.808913  0.924270  21.399734   
                    sdss 1     20.446750  1.142743  0.169849  21.563054   
                         2     19.086531  0.958046  0.788661  21.336464   

                                    ReD  
gal                 cam  prof            
1237667323260764326 mega 1     8.113494  
                         2     8.226689  
                    sdss 1     8.499926  
                         2     8.327510  

[4 rows x 5 columns]

But every time I try to call a row from this dataframe, with stdDF[1237667323260764326, mega, 1], it just says KeyError: u'no item named (1237667323260764326, mega, 1)'

I'm trying to write to this row with another series I have but this error keeps me from doing that!

This is extremely frustrating. I don't know why this is happening!

هل كانت مفيدة؟

المحلول

You need to index via tuples; and you are trying to access the columns, study the documentation, see here

stdDF.loc[(1237667323260764326, mega, 1)]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top