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

There's more...

A consequence of pandas using different syntax for the logical operators is that operator precedence is no longer the same. The comparison operators have a higher precedence than and, or, and not. However, the new operators for pandas (the bitwise operators &, |, and ~) have a higher precedence than the comparison operators, thus the need for parentheses. An example can help clear this up. Take the following expression:

>>> 5 < 10 and 3 > 4False 

In the preceding expression, 5 < 10 evaluates first, followed by 3 < 4, and finally, the and evaluates. Python progresses through the expression as follows:

>>> 5 < 10 and 3 > 4>>> True and 3 > 4>>> True and False>>> False

Let's take a look at what would happen if the expression in ...

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