Skip to Content
Numerical Computing with Python
book

Numerical Computing with Python

by Pratap Dangeti, Allen Yu, Claire Chung, Aldrin Yim
December 2018
Beginner to intermediate
682 pages
18h 1m
English
Packt Publishing
Content preview from Numerical Computing with Python

How it works...

To group by multiple columns as in step 1, we pass a list of the string names to the groupby method. Each unique combination of AIRLINE and WEEKDAY forms an independent group. Within each of these groups, the sum of the cancelled flights is found and then returned as a Series.

Step 2, again groups by both AIRLINE and WEEKDAY, but this time aggregates two columns. It applies each of the two aggregation functions, sum and mean, to each column resulting in four returned columns per group.

Step 3 goes even further, and uses a dictionary to map specific aggregating columns to different aggregating functions. Notice that the size aggregating function returns the total number of rows per group. This is different than the count aggregating ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781789953633OtherOtherErrata Page