Top "Array-broadcasting" questions

Broadcasting (or singleton expansion) applies a function element-wise across one or more multidimensional arrays, matching shapes of the arguments by repeating missing or singleton dimensions.

How does numpy.newaxis work and when to use it?

When I try numpy.newaxis the result gives me a 2-d plot frame with x-axis from 0 to 1. However, when I …

python numpy multidimensional-array array-broadcasting numpy-ndarray
Numpy `ValueError: operands could not be broadcast together with shape ...`

Im using python 2.7 and am attempting a forcasting on some random data from 1.00000000 to 3.0000000008. There are approx 196 items in my …

python arrays numpy array-broadcasting
Numpy - create matrix with rows of vector

I have a vector [x,y,z,q] and I want to create a matrix: [[x,y,z,q], [x,…

python python-2.7 numpy array-broadcasting
how to multiply pandas dataframe with numpy array with broadcasting

I have a dataframe of shape (4, 3) as following: In [1]: import pandas as pd In [2]: import numpy as np In [3]: x = …

python numpy pandas array-broadcasting
Numpy - normalize RGB pixel array

I have a numpy array with shape (34799, 32, 32, 3)which means (num examples, width, height, channels). Now I normalize the image data …

python numpy image-processing array-broadcasting normalize
Subtracting numpy arrays of different shape efficiently

Using the excellent broadcasting rules of numpy you can subtract a shape (3,) array v from a shape (5,3) array X with …

python arrays numpy vectorization array-broadcasting
Numpy array broadcasting rules

I'm having some trouble understanding the rules for array broadcasting in Numpy. Obviously, if you perform element-wise multiplication on two …

python numpy array-broadcasting
Why the following operands could not be broadcasted together?

The arrays are of following dimensions: dists: (500,5000) train: (5000,) test:(500,) Why does the first two statements throw an error whereas the …

python python-3.x numpy array-broadcasting
Memory Efficient L2 norm using Python broadcasting

I am trying to implement a way to cluster points in a test dataset based on their similarity to a …

python numpy euclidean-distance array-broadcasting
Matlab equivalent of Numpy broadcasting?

I'm trying to find some way to substract a size 3 vector from each column of a 3*(a big number) matrix …

python matlab numpy array-broadcasting