Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy array count frequency

import numpy as np

x = np.array([1,1,1,2,2,2,5,25,1,1])
unique, counts = np.unique(x, return_counts=True)

print np.asarray((unique, counts)).T
Comment

PREVIOUS NEXT
Code Example
Python :: selenium press tab python 
Python :: python format seconds to hh mm ss 
Python :: python gui size 
Python :: bold text variable in python 
Python :: python urlencode 
Python :: how to get file name without extension in python 
Python :: ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost) 
Python :: split data validation 
Python :: extract domain name from url python 
Python :: python unchain list 
Python :: flask code 
Python :: format python number with commas 
Python :: renaming headers pandasd 
Python :: read multiple csv python 
Python :: sns figsize 
Python :: color to black and white cv2 
Python :: object to int64 pandas 
Python :: show image in tkinter pillow 
Python :: django import response 
Python :: how to split and keep delimiter at the same line in python 
Python :: python alert 
Python :: pig latin translator python 
Python :: pandas plotly backend 
Python :: who is a pythonista 
Python :: shuffle dataframe python 
Python :: pillow python crop 
Python :: python numpy installation 
Python :: distance formula in python 
Python :: 2 list difference python 
Python :: python split string by tab 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =