Skip to main content

All 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 ...
Pragnya Makar's user avatar
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 ...
Turhan Tisinli's user avatar
-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 ...
Rajib- Research Lab's user avatar
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 , ...
Sreekar Voleti's user avatar
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 ...
user avatar
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] [...
Roosha's user avatar
  • 65
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([[[...
user19862793's user avatar
-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 ...
Starlord22's user avatar
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 ...
Rabinzel's user avatar
  • 7,883
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 ...
Weseng's user avatar
  • 69
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....
eggkeko's user avatar
-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 ...
Sukhmani Kaur Thethi's user avatar
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 ...
Anton Degterev's user avatar
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, ......
Kalli's user avatar
  • 15
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 ...
John van de Ven's user avatar

15 30 50 per page
1
2 3 4 5 6