NumPy By Example
Minimum price
Suggested price

NumPy By Example

A Beginner's Guide to Learning NumPy

About the Book

The material is suitable for the NumPy beginner, although some basic programming knowledge -- preferably Python -- is assumed. It's also assumed you have at least a rudimentary understanding of running shell commands from a terminal on your system of choice. Many courses, especially in data science, have modules or bridging lessons for learning NumPy as a pre-requisite. This book would certainly be suitable as support material for this kind of introductory course.

  • Share this book

  • Categories

    • Computers and Programming
    • Data Structures
    • Python
    • Data Science
  • Feedback

    Email the Author(s)

About the Author

DAT Linux
DAT Linux

DAT Linux is a Linux distribution for data science. It brings together all your favourite open-source data science tools and apps into a ready-to-run desktop environment. It’s based on Ubuntu 22.04, so it’s easy to install and use. The custom DAT Linux Control Panel provides a centralised one-stop-shop for running and managing dozens of data science programs.

Table of Contents

    • Preface
      • About the Book
      • About DAT Linux
    • Chapter 1. Introduction
      • 1.1  What is NumPy?
      • 1.2  Why NumPy is Important
      • 1.3  NumPy as a Base or Integration Library
      • 1.4  Why Learn NumPy?
    • Chapter 2. Getting Started
      • 2.1  Python 3
      • 2.2  Using pip
      • 2.3  Installing NumPy
      • 2.4  Execution Environment
      • 2.5  NumPy First Steps
    • Chapter 3. Array Basics
      • 3.1  Dimensions & Axes
      • 3.2  Data Types
      • 3.3  Compound Types
      • 3.4  Mathematical Constants
      • 3.5  Exercises
    • Chapter 4. Array Creation
      • 4.1  Create Arrays using Python Lists
      • 4.2  Create Empty Arrays
      • 4.3  Create Arrays Filled with Preferred Values
      • 4.4  Create Arrays Filled with Incremental Sequences
      • 4.5  Create Arrays Filled with Random Values using numpy.random
      • 4.6  Array-like objects
      • 4.7  Create Arrays from Other Arrays or Array-like Objects
      • 4.8  Creating Common Matrices (2-D arrays)
      • 4.9  Structured Arrays
      • 4.10  Record arrays
      • 4.11  Other Ways to Create Arrays
      • 4.13  Exercises
    • Chapter 5. Array Inspection
      • 5.1  Shape & Size Information
      • 5.2  Truth Evaluation
      • 5.3  Type Properties
      • 5.4  String Representation
      • 5.5  Exercises
    • Chapter 6. Input & Output
      • 6.1  Persisting & Loading a Single Array
      • 6.2  Persisting & Loading Multiple Arrays
      • 6.3  Write Data to a CSV (text) File
      • 6.4  A Note About File Paths
      • 6.5  Exercises
    • Chapter 7. Array Selection & Modification
      • 7.1  Common Indexing & Slicing: 1-D Arrays
      • 7.2  Common Indexing & Slicing: n-D Arrays
      • 7.3  Fancy Indexing
      • 7.4  Exercises
    • Chapter 8. Array Computation
      • 8.1  Unary Ufuncs — Operating on a Single Array
      • 8.2  Binary Ufuncs
      • 8.3  Broadcasting — Binary Operations with Arrays of Dissimilar Dimension
      • 8.4  Matrix Operations
      • 8.5  Set Operations
      • 8.6  Other Logic Operations
      • 8.7  Statistical Operations
      • 8.8  Exercises
    • Chapter 9. Array Transformation
      • 9.1  Transposing
      • 9.2  Reshaping
      • 9.3  Flattening
      • 9.4  Rotating
      • 9.5  Combining & Splitting
      • 9.6  Sorting
      • 9.7  Exercises
    • Appendix A. Virtual Environments
      • A.1  virtualenv
      • A.2  Docker Containers
    • Appendix B. Python Lists & array Vs NumPy Arrays
      • B.1  Python Lists
      • B.2  The array Array
      • B.3  The Case for (or Against) NumPy Arrays
    • Appendix C. NumPy Function & Property Reference
      • C.1  numpy
      • C.2  numpy.ndarray
      • C.3  numpy.dtype
      • C.4  numpy.linalg
      • C.5  numpy.fft
      • C.6  numpy.random
    • Appendix D. Solutions to Exercises
      • D.1  Chapter 3
      • D.2  Chapter 4
      • D.3  Chapter 5
      • D.4  Chapter 6
      • D.5  Chapter 7
      • D.6  Chapter 8
      • D.7  Chapter 9

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub