Questions tagged [valueerror]

Must be used only when 'ValueError' is raised. It occurs when inappropriate values of a correct datatype is used

ValueError : raised when a function receives an argument having the correct datatype but an inappropriate value

This answer can help out : What does ValueError mean?

1769 questions
713
votes
17 answers

ValueError: invalid literal for int() with base 10: ''

I got this error from my code: ValueError: invalid literal for int() with base 10: ''. What does it mean? Why does it occur, and how can I fix it?
Sarah Cox
  • 7,155
  • 3
  • 16
  • 3
260
votes
27 answers

sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype('float64')

I am using sklearn and having a problem with the affinity propagation. I have built an input matrix and I keep getting the following error. ValueError: Input contains NaN, infinity or a value too large for dtype('float64'). I have…
Ethan Waldie
  • 2,799
  • 2
  • 12
  • 14
107
votes
2 answers

ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?

I use pickle to dump a file on python 3, and I use pickle to load the file on python 2, the ValueError appears. So, python 2 pickle can not load the file dumped by python 3 pickle? If I want it? How to do?
Aleeee
  • 1,913
  • 6
  • 17
  • 27
65
votes
4 answers

What does "ValueError: object too deep for desired array" mean and how to fix it?

I'm trying to do this: h = [0.2, 0.2, 0.2, 0.2, 0.2] Y = np.convolve(Y, h, "same") Y looks like this: While doing this I get this error: ValueError: object too deep for desired array Why is this? My guess is because somehow the convolve function…
Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
63
votes
4 answers

ValueError: Shape of passed values is (1, 6), indices imply (6, 6)

I am passing a list from flask function to another function, and getting this value error. My code at sending end: @app.route('/process', methods=['POST']) def process(): name = request.form['name'] comment = request.form['comment'] …
Sbk3824
  • 1,229
  • 1
  • 14
  • 24
48
votes
2 answers

ValueError: shape mismatch: objects cannot be broadcast to a single shape

I am using the SciPy's pearsonr(x,y) method and I cannot figure out why the following error is happening: ValueError: shape mismatch: objects cannot be broadcast to a single shape It computes the first two (I am running several thousand of these…
Alex Brashear
  • 864
  • 3
  • 9
  • 15
36
votes
3 answers

Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)

My input is simply a csv file with 339732 rows and two columns : the first being 29 feature values, i.e. X the second being a binary label value, i.e. Y I am trying to train my data on a stacked LSTM model: data_dim = 29 timesteps = 8 num_classes…
Saurav--
  • 1,530
  • 2
  • 15
  • 33
33
votes
3 answers

ValueError: Could not interpret input 'index' when using index with seaborn lineplot

I want the use the index of a pandas DataFrame as x value for a seaborn plot. However, this raises a value error. A small test example: import pandas as pd import seaborn as…
MaxS
  • 978
  • 3
  • 17
  • 34
28
votes
5 answers

ValueError and TypeError in python

I can't completely understand the difference between Type and Value error in Python3x. Why do we get a ValueError when I try float('string') instead of TypeError? shouldn't this give also a TypeError because I am passing a variable of type 'str' to…
thileepan
  • 619
  • 3
  • 8
  • 18
28
votes
2 answers

Must have equal len keys and value when setting with an iterable

I have two dataframes as follows: leader: 0 11 1 8 2 5 3 9 4 8 5 6 [6065 rows x 2 columns] DatasetLabel: 0 1 .... 7 8 9 10 11 12 0 A J .... 1 2 5 NaN NaN NaN 1 B K .... 3 4 NaN NaN NaN NaN [4095 rows x 14…
user3806649
  • 1,257
  • 2
  • 18
  • 42
25
votes
2 answers

ValueError: continuous format is not supported

I have written a simple function where I am using the average_precision_score from scikit-learn to compute average precision. My Code: def compute_average_precision(predictions, gold): gold_predictions = np.zeros(predictions.size, dtype=np.int) …
Wasi Ahmad
  • 35,739
  • 32
  • 114
  • 161
22
votes
2 answers

ValueError: install DBtypes to use this function

I'm using BigQuery for the first time. client.list_rows(table, max_results = 5).to_dataframe(); Whenever I use to_dataframe() it raises this error: ValueError: Please install the 'db-dtypes' package to use this function. I found this similar…
21
votes
10 answers

Pipeline OrdinalEncoder ValueError Found unknown categories

Please take it easy on me. I’m switching careers into data science and don’t have a CS or programming background—so I could be doing something profoundly stupid. I've researched for a few hours without success. Objective: get Pipeline to run with…
Pablo Honey
  • 311
  • 1
  • 2
  • 5
21
votes
4 answers

How do I fix invalid literal for int() with base 10 error in pandas

This is the error that is showing up whenever i try to convert the dataframe to int. ("invalid literal for int() with base 10: '260,327,021'", 'occurred at index Population1' Everything in the df is a number. I assume the error is due to the extra…
Caribgirl
  • 375
  • 2
  • 3
  • 10
20
votes
3 answers

Simultaneously melt multiple columns in Python Pandas

wondering if pd.melt supports melting multiple columns. I have the below examples trying to have the value_vars as list of lists but i am getting an error: ValueError: Location based indexing can only have [labels (MUST BE IN THE INDEX), slices of…
Martin Petrov
  • 293
  • 1
  • 3
  • 13
1
2 3
99 100