pandas

In pandas, you can use the following command: 

DallasData.groupby('active_status').agg({'services_completed':np.sum,'age_median':np.mean})

Sum of services completed and the mean customer age grouped by active and inactive customers using groupby in Python

Aggregating by more than one column or multi-index aggregation is also possible. Suppose we want zip code-wise details of active and inactive customers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset