Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to display percentage in pandas crosstab

pd.crosstab(df.A,df.B, normalize='index')
    .round(4)*100

B          A      B      C
A                         
one    33.33  33.33  33.33
three  33.33  33.33  33.33
two    33.33  33.33  33.33
Comment

PREVIOUS NEXT
Code Example
Python :: python add to file 
Python :: pygame how to find the full screen mode 
Python :: raise exception in python 
Python :: how to check if an object of a certain type python 
Python :: Plotly set axes labels 
Python :: how to convert utf-16 file to utf-8 in python 
Python :: python reverse 2d list 
Python :: python file hidden 
Python :: fast fourier transform python 
Python :: python code to generate fibonacci series 
Python :: list comprehension python if 
Python :: django never_cache example 
Python :: python find the average of a list 
Python :: jpython 
Python :: python profiler 
Python :: how to make an ai 
Python :: all pdf in a directory to csv python 
Python :: getting started with machine learning 
Python :: python import file from parent directory 
Python :: pandas nan to none 
Python :: clone website in python 
Python :: how to print all elements of a dictionary in python 
Python :: how to make a random variable in python 
Python :: python - change the bin size of an histogram+ 
Python :: remove item from list python 
Python :: tuple length in python 
Python :: convert base64 to numpy array 
Python :: python hide input 
Python :: print column in pandas 
Python :: numpy check if an array is all zero 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =