5 (1)

5 (1)

#### Overview of this book

Python, a multi-paradigm programming language, has become the language of choice for data scientists for visualization, data analysis, and machine learning. Hands-On Data Analysis with NumPy and Pandas starts by guiding you in setting up the right environment for data analysis with Python, along with helping you install the correct Python distribution. In addition to this, you will work with the Jupyter notebook and set up a database. Once you have covered Jupyter, you will dig deep into Python’s NumPy package, a powerful extension with advanced mathematical functions. You will then move on to creating NumPy arrays and employing different array methods and functions. You will explore Python’s pandas extension which will help you get to grips with data mining and learn to subset your data. Last but not the least you will grasp how to manage your datasets by sorting and ranking them. By the end of this book, you will have learned to index and group your data for sophisticated data analysis and manipulation.
Title Page
Packt Upsell
Contributors
Preface
Free Chapter
Setting Up a Python Data Analysis Environment
Diving into NumPY
Operations on NumPy Arrays
pandas are Fun! What is pandas?
Arithmetic, Function Application, and Mapping with pandas
Managing, Indexing, and Plotting
Other Books You May Enjoy
Index

## 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`. That said, you're better off distinguishing finite and infinite values using the function is finite or is `inf`. Arithmetic involving...