Python NumPy

Created with Sketch.

Python NumPy

This Python NumPy Tutorial helps you learn NumPy from scratch so that you can use it effectively in your data science & machine learning projects.

numpy tutorial

What you’ll learn

  • Create single and multi-dimensional NumPy arrays
  • Effectively use NumPy built-in functions & methods
  • Perform mathematical operations on arrays
  • Extract elements from arrays using slicing and indexing
  • Select elements of arrays conditionally.

Section 1. Getting started

  • What is NumPy – learn what NumPy is and what it can do for you.

Section 2. Creating arrays

  • Creating arrays – show you how to create numpy arrays.
  • zeros() – create a numpy array of a given shape whose elements are filled with zeros.
  • ones() – create a numpy array of a given shape whose elements are filled with ones.
  • arange() –  create a numpy array with evenly spaced numbers.
  • linspace() – create a new numpy array with evenly spaced numbers of a specified interval.

Section 3. Array indexing & slicing

  • Indexing – learn how to select elements using indexing.
  • Slicing – show you how to use slices to extract elements from an array.
  • Fancy indexing – learn how to index a numpy array using another numpy array.
  • Boolean indexing – guide you on how to index an array using another array of boolean values.
  • View vs. copy – show you the difference between a view & copy of an array and how to use the copy() method to make a copy of an array.

Section 4. Aggregate functions

  • sum()– return the sum of all elements
  • mean() – return the average of all elements in an array.
  • var() – return the variance of all elements in an array.
  • std() – calculate the standard deviation of elements of an array.
  • prod() – return the product of all elements.
  • amin() – return the minimum value in an array.
  • amax() – return the maximum value in an array.
  • all() – return True if all elements in an array evaluate to True.
  • any() – return True if any of the elements in an array is nonzero.

Section 5. Array operations

  • reshape() – give an array a new shape while keeping the same elements.
  • transpose() – return a view of an array with axes transposed.
  • sort() – return a sorted copy of an array.
  • flatten() – return a copy of an array collapsed into one dimension.
  • ravel() – return a contiguous flattened array.

Section 6. Arithmetic operations

  • add() – return the sum of two equal-sized arrays.
  • subtract() – return the difference between two equal-sized arrays.
  • multiply() – return the product of two equal-sized arrays.
  • divide() – return the quotient of two equal-sized arrays.
  • Broadcasting – show you how NumPy uses broadcasting to perform arithmetic operations on arrays with different shapes.

Section 7. Joining & splitting arrays

  • concatenate() – join two or more arrays along an existing axis.
  • stack() – join two or more arrays along a new axis.
  • vstack() – join two or more arrays vertically.
  • hstack() – join two or more arrays horizontally.
  • split() – split an array into subarrays.

Leave a Reply

Your email address will not be published.