Diagram
AttributeError: ‘list’ object has no attribute ‘reshape’ error occurs when you try to operate the reshape() method on the list object, but it does not exist on the list. You can use the reshape() attribute on the numpy object.
Reproduce the error
main_list = [21, 11, 19, 46]
main_list.rehsape(3, 2)
Output
How to fix the error?
To fix the AttributeError: ‘list’ object has no attribute ‘reshape’ error, convert an input list to an array using numpy.array() method and then use the reshape() attribute on the numpy array object.
import numpy as np
main_list = [21, 11, 19, 46]
main_arr = np.array(main_list)
print(main_arr.reshape(2, 2))
Output
You can see that we get the output without errors because now we are calling the reshape() method on the numpy object, not the list object.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.