Hi everyone,
I tried importing the image using np.loadtxt. I manage to get my labels right however I keep getting a result of range 2 instead of 3 for images for images.
I’m a beginner and I was wondering if someone could help me figure out what I am doing wrong.
Thanks in advance!
When using np.loadtxt
, care should be taken to:
- Skip the header row
- Consider the right delimiter since the provided file is a csv.
The parameters delimiter=‘,’ and skiprow=1 were included however I still get the same problem
Please click my name and message your notebook as an attachment.
You have selected only 1 row in from the loaded dataset. The 1st dimension is the row and the 2nd is the column. To select all rows, use the :
token.
Once you fix that, correct the shape argument to reshape
.
Once I fix this, I get either: “‘tuple’ object is not callable” (with .shape(28, 28)) or “cannot reshape array of size 21524720 into shape (28,28)” (with .reshape(28, 28) which I don’t understand as 21524720/784 = 27,455 which is the number of images I am supposed to get…
The new shape given to reshape
should hold 3 values. The 1st one stands for the number of images. The last 2 dimensions you’ve used are correct.
Thank you for your help sir, it helped me understand where I was wrong and I managed to finish the assignment!