Numpy

  • Numpy Functions

    Numpy has a number of functions that can be applied to Numpy arrays. Some of these are element-wise functions that operate separately on each element of the array and return an array of the same size with the resulting values. Others are aggregate functions that return a single number calculated from apply the function to…

    Read more

  • 2D Numpy Arrays and Indexing

    You can always reshape a 1D Numpy array into a 2D or higher-dimensional array using the reshape method. You can also use reshape to reduce the number of dimensions of your array, or you can use flatten to create a 1D array. Indexing 2D Arrays Numpy has a nice syntax for slicing or indexing higher-dimensional…

    Read more

  • Views vs. Copies in Numpy

    When you use basic indexing to obtain a slice of a Numpy array, a view is returned. This means you can use the returned slice to modify the original array. To replace the slice you can use either another array of the same size, or a single number. In the latter case, Numpy broadcasts the…

    Read more

  • Numpy Slicing

    Numpy arrays support a rich syntax for referring to or modifying values. Basic slicing uses a start:end:step syntax, like lists. As with lists, all of these arguments are optional. start defaults to the start of the array (index 0), end defaults to the end of the array, and step size defaults to 1. So here…

    Read more

  • Numpy Arithmetic

    When you apply an arithmetical operation or a function to a Numpy array, it gets applied to every element in the array. For example, values * 2 returns a new Numpy array that’s the same as the first one, except all values are multiplied by two. If you want to modify the original array, assign…

    Read more

  • Creating Numpy Arrays

    Numpy is an important Python package, especially useful for machine learning and artificial intelligence purposes. “Numpy” is short for “numerical Python”. The package basically allows you to efficiently create and process very large arrays of numbers. Before you start you’ll likely need to install Numpy with pip install numpy It’s best to do this from…

    Read more

Blog at WordPress.com.