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 in Python by anonymous
• 120 points
119 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 by Niroj
• 66,340 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 in Python by MD
• 65,200 points
4,531 views
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,780 points
68 views
0 votes
1 answer
0 votes
1 answer
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,452 views
0 votes
0 answers
+4 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,800 points
1,085 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 in Python by Niroj
• 66,340 points
3,766 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 in Python by Niroj
• 66,340 points
60 views