Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python - count number of values without dupicalte in a second column values

ID, domain
123, 'vk.com'
123, 'vk.com'
123, 'twitter.com'
456, 'vk.com'
456, 'facebook.com'
456, 'vk.com'
456, 'google.com'
789, 'twitter.com'
789, 'vk.com'

df = df.groupby('domain')['ID'].nunique()
print (df)

domain
'facebook.com'    1
'google.com'      1
'twitter.com'     2
'vk.com'          3
Comment

PREVIOUS NEXT
Code Example
Python :: how to get width of an object in pyqt5 
Python :: debugar python 
Python :: while loop countdown python 
Python :: how to add 2 dates in python 
Python :: playsound 
Python :: nested dict to df 
Python :: main arguments python 
Python :: pandas dataframe print decimal places 
Python :: check if number in range 
Python :: discordpy 
Python :: python timedelta 
Python :: print a random word from list python 
Python :: python snake game 
Python :: replace value column by another if missing pandas 
Python :: location of python in cmd 
Python :: How to replace both the diagonals of dataframe with 0 in pandas 
Python :: panda datetime ymd to dmy 
Python :: python text fromatting rows 
Python :: get max value column pandas 
Python :: dataframe change specicf values in column 
Python :: python remove all except numbers 
Python :: python ssh library 
Python :: django queryset unique values 
Python :: say command python 
Python :: use of // in python 
Python :: how to define dtype of each column before actually reading csv file 
Python :: urlencode python 
Python :: RuntimeWarning: invalid value encountered in true_divide 
Python :: how to find csrf token python 
Python :: package for downloading from youtybe for python 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =