Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make index column as a normal column

df.reset_index(level=0, inplace=True)
Comment

how to make index column as a normal column

>>> df
                       val
tick       tag obs        
2016-02-26 C   2    0.0139
2016-02-27 A   2    0.5577
2016-02-28 C   6    0.0303
Comment

how to make index column as a normal column

>>> df.reset_index(level=['tick', 'obs'])
          tick  obs     val
tag                        
C   2016-02-26    2  0.0139
A   2016-02-27    2  0.5577
C   2016-02-28    6  0.0303
Comment

PREVIOUS NEXT
Code Example
Python :: python working directory executed file 
Python :: python check if number is float or int 
Python :: Why do we use graphs? 
Python :: python how to remove the title of the index from dataframe 
Python :: numpy multidimensional indexing 
Python :: python get news headlines 
Python :: python regex remove digits from string 
Python :: random number pythn 
Python :: decision tree gridsearchcv 
Python :: python matplotlib hist set axis range 
Python :: discord.py how to give a user a role 
Python :: python save input to text file 
Python :: convert hex to decimal python 
Python :: convert string representation of a list to list 
Python :: convert array to dataframe python 
Python :: python read png file 
Python :: python hello wrold 
Python :: python know the number of a loop 
Python :: python continue vs pass 
Python :: matplotlib axes labels 
Python :: how to parse dicts in reqparse in flask 
Python :: python print stderr 
Python :: command prompt pause in python 
Python :: how to iterate through a text file in python 
Python :: python previous answer 
Python :: tkinter change button text 
Python :: Python - Drop row if two columns are NaN 
Python :: shift coordinate in python 
Python :: python image to video 
Python :: pandas groupby count occurrences 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =