Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dataframe unstack

index = pd.MultiIndex.from_tuples([('one', 'a'), ('one', 'b'), ('two', 'a'), ('two', 'b')])
>>> s = pd.Series(np.arange(1.0, 5.0), index=index)
>>> s
one  a   1.0
     b   2.0
two  a   3.0
     b   4.0
dtype: float64

>>> s.unstack(level=0)
   one  two
a  1.0   3.0
b  2.0   4.0
Comment

PREVIOUS NEXT
Code Example
Python :: pandas separator are multiple spaces 
Python :: open gui window python 
Python :: selenium undetected chromedriver error 
Python :: activate internal logging nlog 
Python :: how to make python code faster 
Python :: escape sequence in python 
Python :: python add attribute to class instance 
Python :: for loop get rid of stop words python 
Python :: pyqt5 qtextedit change color of a specific line 
Python :: reshape python 
Python :: append to set python 
Python :: ipaddress in python 
Python :: python abc 
Python :: python schedule task every hour 
Python :: get median using python 
Python :: python print emoji 
Python :: multiplication table python 
Python :: hover show all Y values in Bokeh 
Python :: how to get the index of the first integer in a string python 
Python :: lambda function dataframe 
Python :: convert all numbers in list to string python 
Python :: arithmetic in python 
Python :: plot neural network keras 
Python :: up and down arrow matplotlib 
Python :: transformers bert 
Python :: python if elif else 
Python :: python list of dictionaries 
Python :: how to make a random int in python 
Python :: tf.reduce_sum() 
Python :: convert list to string separated by comma python 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =