Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to get value_counts() order

mobile = pd.DataFrame({'PattLen':[1,1,2,6,6,7,7,7,7,8]})
print (mobile)
   PattLen
0        1
1        1
2        2
3        6
4        6
5        7
6        7
7        7
8        7
9        8

print (mobile.PattLen.value_counts())
7    4
6    2
1    2
8    1
2    1
Name: PattLen, dtype: int64


mt = mobile.PattLen.value_counts().sort_index()
print (mt)
1    2
2    1
6    2
7    4
8    1
Name: PattLen, dtype: int64
Comment

PREVIOUS NEXT
Code Example
Python :: smma python 
Python :: how to get path of all the functions in a python module 
Python :: python stack size 
Python :: harihar kaka class 10 questions 
Python :: sklearn impute 
Python :: how to get github repository access in python code directly 
Python :: how to kill python process started by excel 
Python :: godot variablen einen wert hinzufügen 
Python :: AGE CALCULATOION IN PYTHON 
Python :: plant python documentation 
Python :: santhal paragana 
Python :: required depend filed odoo 
Python :: The current Numpy installation fails to pass a sanity check due to a bug in the windows runtime. 
Python :: incremental betekenis 
Python :: pandas replace inf with 0 
Shell :: run lumen 
Shell :: how to install cv2 
Shell :: uninstall skype from ubuntu 
Shell :: how to remove mysql workbench in ubuntu 
Shell :: uninstall wps office 
Shell :: linux find files larger than 1gb 
Shell :: centos stop apache 
Shell :: restart rabbitmq service linux 
Shell :: install wps ubuntu 20.04 
Shell :: nonexistentpath data directory /data/db not found 
Shell :: yarn install 
Shell :: upgrade plotly version 
Shell :: apache enable mod reqrite 
Shell :: check my ubuntu version 
Shell :: (node:14140) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found! 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =