Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

count proportion pandas

import pandas as pd

dogs = pd.DataFrame({
    'dog_name':['REX', 'WALTER', 'BLAZE', 'JASPER', 'TEDDY'], 
    'breed':['KOBE', 'OSCAR', 'OSCAR', 'KOBE', 'MAX']
})

print(dogs.value_counts(normalize=True))
Comment

PREVIOUS NEXT
Code Example
Python :: pandas convert first row to header 
Python :: joins in pandas 
Python :: python integer to string 
Python :: Use module Crypto.Cipher.PKCS1_OAEP instead 
Python :: Sending POST request in Django 
Python :: python os get path 
Python :: print in python without using print or sys module 
Python :: python message from teams 
Python :: python practice 
Python :: requests python3 example 
Python :: pandas reset index 
Python :: python variable 
Python :: create new column pandas lambda function assign apply 
Python :: python ordered dict to dict 
Python :: get last 3 elements in a list python 
Python :: length of string python 
Python :: uploading folder in google colab 
Python :: easy frequency analysis python 
Python :: count occurrence in array python 
Python :: python youtube downloader 
Python :: python program to check if binary representation is a palindrome 
Python :: django admin 
Python :: python create array 
Python :: new column with multiple conditions 
Python :: generate random integers in a range python 
Python :: Read JSON files with automatic schema inference 
Python :: python how to see what pip packages are installed 
Python :: month name in python 
Python :: Python of add two numbers 
Python :: how to terminate subprocess.call in python 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =