Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python aggregate count and sum

(df.groupby('Company Name')
.agg({'Organisation Name':'count', 'Amount': 'sum'})
.reset_index()
.rename(columns={'Organisation Name':'Organisation Count'})

         Company Name   Amount  Organisation Count
0  Vifor Pharma UK Ltd  4207.93                   5
Comment

python aggregate count and sum

df.groupby('Company Name').agg(MySum=('Amount', 'sum'), MyCount=('Amount', 'count'))
Comment

PREVIOUS NEXT
Code Example
Python :: map to numpy array 
Python :: create database python 
Python :: python map function 
Python :: sudo apt-get install python2-pip 
Python :: python pandas rellenar con ceros a la izquierda 
Python :: fetch firestore indexes 
Python :: image completion inpainting with python 
Python :: python loop nest shorthand 
Python :: cv2 and PIL BRG to RGB 
Python :: python list sort key lambda on equal other function 
Python :: python switch case 
Python :: how to get ping from computer IN PYTHON 
Python :: splitting on basis of regex python 
Python :: append two dfs 
Python :: install python modules without pip 
Python :: flask production server 
Python :: zoom in librosa.display.specshow() 
Python :: how to sort dataframe in python by length of groups 
Python :: how to wait for loading icon to disappear from the page using selenium python 
Python :: python time.sleep 
Python :: WSGIPassAuthorization on 
Python :: pyqt5 spin box change value trigger 
Python :: how to get the memory location of a varible in python 
Python :: getting-the-last-element-of-a-list 
Python :: python chunk text 
Python :: how to use histogram in python 
Python :: python logging levels 
Python :: How to build a Least Recently Used (LRU) cache, in Python? 
Python :: pandas data frame from part of excel 
Python :: how can I print all items in a tuple, separated by commas? 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =