AttributeError: list object has no attribute [ Attribute_Name] ( Solved )

AttributeError_ list object has no attribute

AttributeError: list object has no attribute [ Attribute_Name] error occurs when we access any attribute which is not defined in the list class of python. There are multiple attributes that create a lot of confusion like ‘shape’ or ‘len’ etc. Usually, shape() and len() functions are to check the dimensions of different data structures in python. Here len() function is defined in the list python class. Here if invoke the shape function with list type object, The interpreter will through the AttributeError.  Well, In this article we will zoom in explicitly for attributeerrors related to list type  of object.

How to check the Attributes of the list object?

If you want to check the supported function with a list object, just run the below code. It will print all the supported function and attribute with the list object.

AttributeError list object has no attribute Attribute_Name
AttributeError list object has no attribute Attribute_Name

AttributeError: list object has no attribute [ Attribute_Name] ( Solution ) –

There are two types of generic solutions for this type of error. Let’s explore these-

1. Solution 1: Changing the object as per attribute –

In this type of fix, we will change the object type which supports that attribute. To simplify this, let’s take an example. Suppose we invoke shape() function which list object. Since list does not support shape() function. We can convert the list object to dataframe Series which supports this shape() attribute and perform similar functionality.

2 . Solution 2: Changing the Attribute as per object –

Since the underline object is not defined in the list type of object, we will search and replace the attribute with similar functionality with the list class itself. Again let’s take an example, as shape() is not available in the list class. The intent of using the shape function is to check the dimension of the list. A similar function for this functionality in the list is len(). We will invoke this function with a list-type object to solve this AttributeError.


AttributeError: list object has no attribute ( Similar Errors )-

There are often multiple errors related to attributes in the class like :

  1. ‘list’ object has no attribute ‘split’
  2. ‘list’ object has no attribute ‘items’
  3. ‘list’ object has no attribute lower
  4. ‘list’ object has no attribute replace
  5. ‘list’ object has no attribute head
  6. ‘list’ object has no attribute shape
  7. ‘list’ object has no attribute strip


Apart from the above most frequent error.  There are multiple attributes like add, copy, drop, iteritems, keys, encode, etc which also create confusion and end up in a similar AttributeError.  The Generic solution will remain the same for such similar errors. The specification will change on the basis of the module.


Data Science Learner Team


Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner