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

## Linear algebra

Be aware that NumPy is built to support linear algebra. A 1D NumPy array may correspond to a linear algebra vector; a 2D array to a matrix; and 3D, 4D, or all `ndarray` to tensors. So, when appropriate, NumPy supports linear algebra operations, such as matrix products, transposition, matrix inversion, and so on, for arrays. Most NumPy linear algebra functionality is supported in the `linalg` module. The following is a list of commonly used NumPy linear algebra functions:

Some of these are `ndarray` methods, others are in the `linalg` module you need to import. So we've actually been demonstrating transpose up to this point in earlier examples. Notice that we were using transpose here to swap around rows and columns.

This is transposition in `arr4`:

I said `arr4` was `arr3` and we switched around the axes. So axis 0 would still be axis 0, but axis 1 would be axis 2 of the old array, and axis 2 would be axis 1 of the old array.

Now let's see some other examples. Let's see a demonstration of reshape...