About 120,000 results
Open links in new tab
  1. How to simply pass weights while np.average () - Stack Overflow

    [ 3, 8]] b = [[ 10, 1], [ 0.5, 1], [ 0.7, 0.2]] c = [[ 10, 12], [ 0.5, 13], [ 5, 0.7]] abc.append(a) abc.append(b) abc.append(c) print(np.average(np.array(abc), weights=[weights], axis=0)) OUT: TypeError: 1D …

  2. Getting 'ValueError: x and y must be 1D arrays of the same length' …

    Nov 8, 2018 · ValueError: x and y must be 1D arrays of the same length But whenever I check the len, .size, .shape, and .ndim of x and y, they are 1D arrays of the same length.

  3. Python - y should be a 1d array, got an array of shape instead

    Dec 6, 2020 · ValueError: y should be a 1d array, got an array of shape () instead. Actually, this was happening due to the wrong placement of [] brackets around np.argmax, below is the wrong code …

  4. Numpy's "shape" function returns a 1D value for a 2D array

    Mar 2, 2021 · Tl;dr. Your individual lists are of variable length thus forcing your NumPy array to be a 1D array of list objects rather than a 2D array of integers/floats Numpy arrays can only be defined when …

  5. NumPy broadcasting error when trying to add 2D array and 1D array

    Jul 11, 2025 · ValueError: operands could not be broadcast together with shapes (3,4) (3,) Any Ideas? I thought NumPy would automatically broadcast the 1D array across the rows, but it doesn’t work …

  6. Difference between numpy.array shape (R, 1) and (R,)

    Shape n, expresses the shape of a 1D array with n items, and n, 1 the shape of a n-row x 1-column array. (R,) and (R,1) just add (useless) parentheses but still express respectively 1D and 2D array …

  7. How do i fix values must be a 1D array problem in pandas

    Oct 28, 2021 · How do i fix values must be a 1D array problem in pandas Asked 4 years, 2 months ago Modified 4 years, 2 months ago Viewed 2k times

  8. ValueError: x and y must be equal-length 1D arrays

    May 7, 2022 · If the surface you are about to plot has a parametric equation (such as a sphere), use the meshgrid approach (x, y, z must be 2D arrays) and call ax.plot_surface. Instead, you used 1D arrays …

  9. Keras input explanation: input_shape, units, batch_size, dim, etc

    Jun 25, 2017 · if using channels_first: (batch_size, channels, imageside1, imageside2) 1D convolutions and recurrent layers use (batch_size, sequence_length, features) Details on how to prepare data for …

  10. python - Jax dynamic slicing tracer array - Stack Overflow

    May 17, 2024 · JAX arrays used in transformations like jit, vmap, and scan must always be statically-shaped (see Sharp bits: Dynamic Shapes for some discussion of this). dynamic_slice allows you to …