I made a pandas dataframe, but when I call df.columns I get RangeIndex(start=0, stop=17, step=1). What is happening? I just want to get a list of my headers
            Asked
            
        
        
            Active
            
        
            Viewed 214 times
        
    -2
            
            
        - 
                    1It's very difficult for someone to help you with what you have given here. You should post a [reproduce-able example](https://stackoverflow.com/help/minimal-reproducible-example) so that others might be able to help you out more – sedavidw Dec 04 '20 at 03:35
- 
                    How did you make the dataframe? If you didn't specify headers (or use something like read_csv) then the columns will just be 0, 1, 2, 3 ... but that is implemented via the `RangeIndex`. `df[0]` should get you the first column. – tdelaney Dec 04 '20 at 03:38
1 Answers
0
            
            
        This post covers your question in detail: Get list from pandas DataFrame column headers
Briefly, you can use: df.columns.tolist() or df.columns.values.tolist()
 
    
    
        Jin
        
- 1
- 2
