Which file format can be used to save a Pandas DataFrame object and then loading it back with the proper index? I.e. if column blah was an index before saving it to the file, I want that after loading it back again blah to be an index without me having to tell this to Pandas.
            Asked
            
        
        
            Active
            
        
            Viewed 632 times
        
    -1
            
            
         
    
    
        user171780
        
- 2,243
- 1
- 20
- 43
- 
                    `df.to_csv(..., index=True)` and `df = pd.read_csv(..., index_col=[0])`. – Trenton McKinney Sep 08 '22 at 22:03
- 
                    That only works if the index has one column, fails with multiple columns. – user171780 Sep 08 '22 at 22:07
- 
                    It's a list, specify multiple columns: `index_col=[0, 1]`. Otherwise use `pickle` as in the duplicate. – Trenton McKinney Sep 08 '22 at 22:07
