All Courses

error All arrays must be of same length

By, 3 months ago
  • Bookmark

Sir What is This error All arrays must be of same length 

2 Answers

length mismatch is there, means number of elements is either less or more which it should be equal, check the column


This error message in Python is indicating that two or more arrays being used in the same operation have different lengths. For example, when trying to perform mathematical operations such as addition or multiplication, the arrays being used in the operation must have the same number of elements. If they have different lengths, the operation cannot be completed and this error message is raised.

One common situation this error could happen is when working with data in pandas DataFrame, if we have columns with different number of rows, pandas will give you this error.

To resolve this issue, you will need to ensure that all arrays involved in the operation have the same number of elements, by either removing elements from the larger array or adding elements to the smaller array.

Your Answer


Live Masterclass on : "How Machine Get Trained in Machine Learning?"

Mar 30th (7:00 PM) 516 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More