Convert 1d numpy array to 2d

Questions : Convert 1d numpy array to 2d


I have an array A of shape (30,) where programming each row has a list with 2000 elements. Learning I want to convert this into a 2d array Earhost of shape (30, 2000). This is what I most effective tried

A = np.reshape(A, (30, -1))

But, running this gives me an array of wrong idea shape (30, 1) rather than (30, 2000). use of case What should I do to get the correct United shape?

Total Answers 1

Answers 1 : of Convert 1d numpy array to 2d

where each row has a list with 2000 Modern elements

As Ahmed Mohamed AEK points out in the ecudated comments this won't work as the numpy some how object is of shape (30,). One easy fix anything else is to stack them into a 30 by 2000 not at all np.array. For example:

A = np.vstack(A)

or equvalently:

A = np.stack(A, axis=0)

Top rated topics

Google cloudshell method for moving a large number of files based on file number range?

NgFor detection from firebaes

How to create a launcher to group my Jumplists

How to compare weighted medians from independent groups?

How to retrieve current test from parent mocha suite

Detect a "Hole" or "output" in a delimited zone with OpenCV

How can I solve the error message I am receiving in my below code in my policy documents

ESP32 point-to-point connection, UART-WIFI passthrough mode, how to configure modules

Async void in C++ WinRT

QFuture then continuation never finishes (Qt 6)

VS2019 not saving qtversion

Datum transformation produces unexpected results

Django handle transaction on filter query

Creating a brushable map with vega-lite API

Why Plot Python 3 different with Matlab and even excel

Making a cron job not run for a test

Cannot install private Go module

Use namedtuple instead of tuple with typing.optional

Receiving error message "name 'SaveInput' is not defined" while defining a save method Django

Builder error while uploading Next.js project to Heroku

Count business days in calculation

Split tables into multiple tables every ten columns in python report lab

Make arrow-up/down, Pos1, End, Del ... more easy


Writing a function which checks if a string is within an allowed range

Angular create interface for Wordpress REST API posts data (unrecognized characters in interface property names)

How can I search for multiple specific keys with specific values in a nested dictionary?

Rxjs pipe function with multiple filter() and switchMap() operators in the chain

Read data from s3 using date format

How to append list of values to a column of list in dataframe

Adding and removing CSS classes to the parent row based on the state of editable data in a child cell?

R. T test for two groups that are part of different categories in the same data set?

Casting an Object as a Map when Firebase RTDB is updated

Cannot delete an item from the Django admin interface

Jest unable to recognize SVG component

Multiprocessing value and lock

Scanning windows docker images tool

Kotlin Argument Matcher failing with exception

SSRS using parameters in expresions - error bc30205 End of statement expected

Ffmpeg : how to use the animated scale filter?

Regexp_substr equivalent in postgresql

Can't return user data to my react native mobile app through passport.js

Css property value preceded by # and is invalid after angular build

Compile LLVM Pass on windows under visual studio 2019

Django, Can not import urls from django.conf.urls

C#. How do i turn a String into a Double array?

How to remove an object from an array?

Filter Dataframe Based on Differnce Between Columns [Not Next-to-Next Columns]

Constructor overloading with variadic arguments

Resize text on wrap with CSS