2

I have a 4 dimensional array with shape (1, 2000, 102, 32)

I would like to convert it to (64000,102) 64000 is based on (2000*32).

Then store it in csv file.

Thanks

0

1 Answer 1

2

Does ordering of the dimensions matter? If not, you can just use numpy reshape function. Example is below.

import numpy as np
a=np.zeros((1, 2000, 102, 32))
print(a.shape)
b=a.reshape(64000,102) 
print(b.shape)

checkout csv module on how to write it to csv

Sign up to request clarification or add additional context in comments.

3 Comments

Hi, This didn't work out. Cause the shape of the array is 4 dimension and the dimensions are (1,2000,102,32). I want to reduce the dimensions to 2D (64000, 102)
Quick question, does this reshape place the first 2000 rows and then append next 2000 rows in a sequence?
Yes. It just flattens everything and follows the normal sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.