How to create a Multi-index dataframe

  • Context: Python 
  • Thread starter Thread starter msn009
  • Start date Start date
  • Tags Tags
    Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
msn009
Messages
53
Reaction score
6

Attachments

  • p1.png
    p1.png
    945 bytes · Views: 574
Physics news on Phys.org
I haven't gotten into the weeds of this in while, but I think what you're asking is simply not in Pandas. Pandas is designed, in effect, to be excel spreadsheets via python (with the added capabilities that come with it).

Spreadsheets are fundamentally indexed with (i,j) pairs. There is no third index. (You could try to synthetically creating such a thing via a mapping formula that you come up with though that sounds unpleasant).

If you want to use (i,j,k) indexing, this is 3-D tensor territory that is easy to manipulate via arrays in Numpy. It is not Pandas.
 
  • Like
Likes   Reactions: msn009