Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Analysis with NumPy and pandas

You're reading from   Hands-On Data Analysis with NumPy and pandas Implement Python packages from data manipulation to processing

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781789530797
Length 168 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Curtis Miller Curtis Miller
Author Profile Icon Curtis Miller
Curtis Miller
Arrow right icon
View More author details
Toc

Special numeric values

In addition to dtype objects, NumPy introduces special numeric values: nan and inf. These can arise in mathematical computations. Not A Number (nan). It indicates that a value that should be numeric is, in fact, not defined mathematically. For example, 0/0 yields nan. Sometimes, nan is also used to signify missing information; for example, pandas uses this. inf indicates a quantity that is arbitrarily large, so in practice, it means larger than any number the computer can conceive of. -inf is also defined and it means arbitrarily small. This could occur if a numeric operation blows up, that is, grows rapidly without bounds.

Nothing is ever equal to nan; it makes no sense for something undefined to be equal to something else. You need to use the NumPy function isnan to identify nan. While the == sign does not work for nan, it does work for inf....

You have been reading a chapter from
Hands-On Data Analysis with NumPy and pandas
Published in: Jun 2018
Publisher: Packt
ISBN-13: 9781789530797
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime