Skip to Content
Learn Python by Building Data Science Applications
book

Learn Python by Building Data Science Applications

by Philipp Kats, David Katz
August 2019
Beginner
482 pages
12h 56m
English
Packt Publishing
Content preview from Learn Python by Building Data Science Applications

Math

Of course, mathematical operations are well present in pandas, which actively leverages NumPy's functionality and supports an extra-wide specter of math and statistical functionality. To get a sum, mean, median, max/min, or percentile of a numerical column, just call it as a column's method:

>>> N = pd.Series([1,2,3,10])>>> N.mean()4.0>>> N.median()2.5>>> N.sum()16>>> N.max()10

It also supports operations such as correlation (just call it on another numeric column of the same length), and many more. Most of the time, you can run the very same functions on the dataframes—in this case, axis (direction of operation) will be used as an argument. The default, all operations are run vertically—for example, for df.sum() you will get a series ...

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

Python for Data Science

Python for Data Science

Yuli Vasiliev
Introduction to Machine Learning with Python

Introduction to Machine Learning with Python

Andreas C. Müller, Sarah Guido

Publisher Resources

ISBN: 9781789535365Supplemental Content