Hello everyone please help what could i be doing wrong here Im getting this error

0 votes

# load image and store it numpy array 

# empty list to store images 

X = []

# iterating over each image

for img_name in data1.image_names:

  # loading the image using its name

  img1 = plt.imread('/content/images/' + img_name)

  #img = plt.imread('/content/drive/MyDrive/images/' + '10205.jpg')

  # saving each image in the list

  X.append(img1)

  # converting the list of images into array

  X=np.array(X)

  # storing the target variable in separate variable 

  y = data1.class1_male_or_female.values

Error: 

AttributeError                            Traceback (most recent call last)
<ipython-input-13-b131471561a9> in <module>()
      9   #img = plt.imread('/content/drive/MyDrive/images/' + '10205.jpg')
     10   # saving each image in the list
---> 11   X.append(img1)
     12 
     13   # converting the list of images into array

AttributeError: 'numpy.ndarray' object has no attribute 'append'
Dec 23, 2021 in Others by Yolanda

edited Mar 4, 2025 282 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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