How to convert 1D array into 2D array using pandas

0 votes

Hi Guys,

I am trying to create one CNN model. I have my image pixels in 1D array. But I want to read that image. So I have to convert that 1D array into 2D array. How can I do that?

May 8, 2020 in Machine Learning by akhtar
• 38,260 points
5,978 views

1 answer to this question.

0 votes

Hi@akhtar,

You can follow the below given codes to do this task.

import numpy as np
img = np.asanyarray(1D_array)
img.shape
(784,)
img1 = img.reshape((28,28))
img1.shape
(28,28)

Hope this will help.

answered May 8, 2020 by MD
• 95,460 points

Related Questions In Machine Learning

0 votes
1 answer

How to add random and/or fixed effects into cloglog regression in R

The standard glm function can be used ...READ MORE

answered Apr 13, 2022 in Machine Learning by anonymous
701 views
0 votes
1 answer

Example to run KNN algorithm using python

Have a look at this one: from sklearn.datasets ...READ MORE

answered May 9, 2019 in Machine Learning by Harvy
1,608 views
0 votes
1 answer

How to compare expected and predicted values?

The predict() function returns a plain numpy ...READ MORE

answered Jul 14, 2019 in Machine Learning by Tina
13,341 views
+1 vote
1 answer

module 'numpy' has no attribute 'unit8'

Hi@akhtar, You have used unit8 in your code. ...READ MORE

answered Jun 23, 2020 in Python by MD
• 95,460 points
15,725 views
0 votes
1 answer

Python : Cannot Import Data using Pandas

So< if your error says: ...READ MORE

answered Dec 7, 2018 in Data Analytics by Upasana
• 8,620 points
5,684 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to convert categorical variable into dummy variable?

Hi@akhtar, You can do this task using pandas ...READ MORE

answered May 7, 2020 in Machine Learning by MD
• 95,460 points
9,006 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP