ValueError arrays must all be same length

0 votes
I'm getting error in below code at the highlighted line......

import numpy as np
import pandas as pd

import matplotlib.pyplot as plt

from sklearn.datasets import load_boston

bosto=load_boston()
#here
bos1=pd.DataFrame(bosto)

print((bos1))




Traceback (most recent call last):
  File "C:/Users/sac/PycharmProjects/LinearRegression/LRegression.py", line 9, in <module>
    bos1=pd.DataFrame(bosto)
  File "C:\Users\sac\PycharmProjects\LinearRegression\venv\lib\site-packages\pandas\core\frame.py", line 468, in __init__
    mgr = init_dict(data, index, columns, dtype=dtype)
  File "C:\Users\sac\PycharmProjects\LinearRegression\venv\lib\site-packages\pandas\core\internals\construction.py", line 283, in init_dict
    return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "C:\Users\sac\PycharmProjects\LinearRegression\venv\lib\site-packages\pandas\core\internals\construction.py", line 78, in arrays_to_mgr
    index = extract_index(arrays)
  File "C:\Users\sac\PycharmProjects\LinearRegression\venv\lib\site-packages\pandas\core\internals\construction.py", line 397, in extract_index
    raise ValueError("arrays must all be same length")
ValueError: arrays must all be same length
Sep 21, 2020 in Python by anonymous
• 120 points
4,361 views

1 answer to this question.

0 votes

Hello,

For your query you can refer this:https://www.programmersought.com/article/5321489391/

Hope it helps!!

answered Sep 21, 2020 by Niroj
• 82,840 points

Related Questions In Python

0 votes
1 answer

ValueError("arrays must all be same length") ValueError: arrays must all be same length

Hi,  You need to specify index for your ...READ MORE

answered Jun 25, 2020 in Python by MD
• 95,460 points
28,820 views
0 votes
0 answers
0 votes
1 answer

In LightFM does the training set need to be the same size as the test set?

I would change the wording. Often in ML, ...READ MORE

answered Sep 21, 2018 in Python by charlie_brown
• 7,720 points
748 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,070 views
0 votes
1 answer

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Hello @kartik, Since different users might have different ...READ MORE

answered Jun 15, 2020 in Python by Niroj
• 82,840 points
23,334 views
0 votes
1 answer

How to keep keys/values in same order as declared?

You can't really do what you want ...READ MORE

answered Apr 13, 2020 in Python by Niroj
• 82,840 points
689 views
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