Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (19k points)
recategorized by

I am receiving the error: ValueError: Wrong number of items passed 3, placement implies 1, and I am struggling to figure out where, and how I may begin addressing the problem.

I don't really understand the meaning of the error; which is making it difficult for me to troubleshoot. I have also included the block of code that is triggering the error in my Jupyter Notebook.

The data is tough to attach; so I am not looking for anyone to try and re-create this error for me. I am just looking for some feedback on how I could address this error.

results = testSet.copy()

  results['predictedY'] = predictedY

results['sigma'] = sigma

1 Answer

0 votes
by (33.1k points)

In your problem, the value error came due to more number of values got assigned to the data frame, which is accepting only one value in one column.

In this case, the value on the right side:

results['predictedY'] = predictedY

is assigning 3 values into a dataframe column that allows only one value. This is the reason you are getting this ‘value error’.

To solve this problem you can try this:

results[[‘Predicition1’, ‘Prediction2’, ‘Prediction3’]]  = predictedY

You need to initialize the result dataframe first to assign values in columns. Then the above code will solve the remaining problem.

Hope this answer helps.

If you want to learn more about Data Science, visit data science tutorial and data science certification by Intellipaat.

Browse Categories

...