CHAPTER 2
INTRODUCTION TO NUMPY
This chapter provides a quick introduction to the Python NumPy package, which provides very useful functionality, not only for “regular” Python scripts, but also for Python-based scripts with TensorFlow. For instance, you will see NumPy code samples containing loops, arrays, and lists. You will also learn about dot products, the reshape() method (very useful!), how to plot with Matplotlib (discussed in more detail in Chapter 4), and examples of linear regression.
The first part of this chapter briefly discusses NumPy and some of its useful features. The second part contains examples of working arrays in NumPy, and contrasts some of the APIs for lists with the same APIs for arrays. In addition, you will see how easy it is to compute the exponent-related values (square, cube, and so forth) of elements in an array.
The second part of the chapter introduces subranges, which are very useful (and frequently used) for extracting portions of datasets...