Top "Numpy" questions

NumPy is an extension of the Python language that adds support to large multidimensional arrays and matrixes, along with a large library of high-level mathematical functions for operations with these arrays.

How do I find the length (or dimensions, size) of a numpy matrix in python?

For a numpy matrix in python from numpy import matrix A = matrix([[1,2],[3,4]]) How can I find the length of a …

python matrix numpy
How to remove specific elements in a numpy array

How can I remove some specific elements from a numpy array? Say I have import numpy as np a = np.…

python arrays numpy
Most efficient way to map function over numpy array

What is the most efficient way to map a function over a numpy array? The way I've been doing it …

python performance numpy
How to add an extra column to a NumPy array

Let’s say I have a NumPy array, a: a = np.array([ [1, 2, 3], [2, 3, 4] ]) And I would like to add a column …

python numpy
initialize a numpy array

Is there way to initialize a numpy array of a shape and add to it? I will explain what I …

python arrays numpy
How to take column-slices of dataframe in pandas

I load some machine learning data from a CSV file. The first 2 columns are observations and the remaining columns are …

python pandas numpy dataframe slice
numpy matrix vector multiplication

When I multiply two numpy arrays of sizes (n x n)*(n x 1), I get a matrix of size (n …

python arrays numpy vector matrix
How do I convert a numpy array to (and display) an image?

I have created an array thusly: import numpy as np data = np.zeros( (512,512,3), dtype=np.uint8) data[256,256] = [255,0,0] What I want …

python arrays image numpy data-visualization
Pandas conditional creation of a series/dataframe column

I have a dataframe along the lines of the below: Type Set 1 A Z 2 B Z 3 B X 4 C Y …

python pandas numpy dataframe
Converting NumPy array into Python List structure?

How do I convert a NumPy array to a Python List (for example [[1,2,3],[4,5,6]] ), and do it reasonably fast?

python numpy