0

I want to reshape the CSV row and columns into 4 dimension form that is acceptable for CNN in python.

Rows are 2118 and columns are 22

sunshine
  • 1,413
  • 2
  • 17
  • 36

1 Answers1

0

You first need to figure out the size of each dimension. After that you can use numpy.reshape.

For example we can convert a 2118x22 array into a 2118x22x1x1 array which satisfies the 4 dimensions requirement like:

original_array = np.random.randint(0, 100, (2118, 22))
dim1, dim2, dim3, dim4 = 2118, 22, 1, 1
original_array.reshape((dim1, dim2 , dim3, dim4))

Now your task is figure out the numbers for dim1, dim2, dim3 and dim4.

Franco Piccolo
  • 5,760
  • 6
  • 24
  • 45