All Questions
Tagged with reshape multidimensional-array
77
questions
0
votes
0
answers
15
views
Is there any xarray code for selecting data in the shape of a parallelogram?
I have a temperature data with dimensions YC and XC. I'm interested in selecting data within the red parallelogram shape depicted in the figure. xarray.DataArray'YC: 720 XC: 560.
However, when using ...
0
votes
2
answers
23
views
Substituting " points = np.array([x, y]).T.reshape(-1, 1, 2)" with simpler steps
I am trying to generate the output of the following Python statement with simple-enough-to-understand steps, possibly using for-loops. I have studied the .reshape method and what -1 means as a ...
-4
votes
1
answer
429
views
How can I reshape my numpy array from (512) to (512,) in Python 3.x?
I am a new one in python. For maniputing the numpy array, I tried to reshape an array size several times like my expectation. But didn't cover it up.
Currently my array shape is 512
But I want to ...
3
votes
2
answers
151
views
Julia - Reshaping a 4D array into a matrix of matrices
I want to start from an array like
A = zeros( nK , nK , m , m )
and reshape it into an matrix of size (nK,nK) where each element is an mxm matrix.
I have tried the basis reshape function, reshape(A , ...
0
votes
0
answers
89
views
How to reshape a 2d array to 3d matrix in R?
I am new to R language, therefore need your assistance.
I have a 2D array of dimension 256* 149.
I want to reshape this 2d array into a 3d matrix in R..therefore the output dimension of the reshaped ...
2
votes
1
answer
76
views
How to remove subarrays containing nan elements on a 3d array preserving the shape?
I have a sparse array of shape (863, 923, 2) that contains lot of NANs:
[[[ 43.06010628 -11.01121568]
[ 25.03068277 16.3949826 ]
[-23.75853158 -10.95350074]
...
[ 25.52110353 3.00428452]
[...
1
vote
1
answer
299
views
Reducing the dimensions of an array in a list in Python
I am reshaping the array in a list Test from (1, 3, 3) to (3, 3). How do I reshape for a more general form, say for a very numpy array from (1, n, n) to (n, n)?
import numpy as np
Test = [np.array([[[...
-1
votes
1
answer
277
views
Reshaping each element of a multidimension 3D array to another Multidimension 3D array in Python
I'm working on a problem where I've to reshape a (63,16,3) array's each element to an array (4,4,3), and I'm stuck there.
I generated an array of (63,16,3) using the random function of NumPy. Please ...
2
votes
1
answer
148
views
Replace int values in 2D np.array with list of 3 values to make it 3D
I came along this problem when helping on this question where OP does some image processing. Regardless if there are other ways to do the whole thing, in one part, I have a 2D np.array filles with ...
0
votes
1
answer
265
views
3-dimensional array reshaping? HDF5 dataset type?
I have data in the following shape: (127260, 2, 1250)
The type of this data is <HDF5 dataset "data": shape (127260, 2, 1250), type "<f8">
The first dimension (127260) is ...
0
votes
0
answers
53
views
Remove all 'endlines' from a .txt file that contains a numeric array
I have a .txt file and I need it to be reshape to be an array like (580, 580)
The text is made of many float numbers with a space between them.
Like:
0.0568596534586 0.0059062688246 0.00586258685707 0....
-1
votes
1
answer
62
views
Define the size of each element as the third dimension/parameter in the shape of the multi-dimensional array in python
I have a dataset that looks like (top 5 values or head of my dataset):
a b c d
00010 01001 01001 01000
01001 00101 01001 01001
00011 00011 10000 01001
00101 01000 01001 01000
01001 00101 ...
5
votes
3
answers
1k
views
Julia: A fast and elegant way to get a matrix from an array of arrays
There is an array of arrays containing more than 10,000 pairs of Float64 values. Something like this:
v = [[rand(),rand()], ..., [rand(),rand()]]
I want to get a matrix with two columns from it. It ...
0
votes
1
answer
424
views
Convert a 2D array into 3D array repeating existing values
I have an array of shape (360,480) containing values from 1 to 11,
Array([[ 1, 1, 1, ..., 1, 1, 1],
[ 1, 1, 1, ..., 1, 1, 1],
[ 1, 1, 1, ..., 1, 1, 1],
...,
[ 4, 4, 4, ......
0
votes
0
answers
629
views
Turning 2D pd.dataFrame into 3D array
My Dataset consists of 3535560 rows × 16 columns. However it contains three 'index-variables, I would like to use to reshape the dataset: 1830 days, 46 latitude values and 42 longitude values. The ...