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?

1219 questions
172
votes
16 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
  • 1,919
  • 2
  • 9
  • 14
102
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,595
  • 5
  • 14
  • 23
49
votes
4 answers

ValueError: object too deep for desired array while using convolution

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
  • 4,939
  • 21
  • 72
  • 125
38
votes
1 answer

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
  • 726
  • 3
  • 8
  • 14
37
votes
3 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
  • 849
  • 1
  • 11
  • 23
34
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,360
  • 2
  • 12
  • 29
17
votes
3 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
  • 415
  • 2
  • 5
  • 16
15
votes
2 answers

Python - ValueError: Cannot index with vector containing NA / NaN values

I'm trying to get the average price of products containing any substrings from a wordlist from a dataframe. I've been able to do so with the following code on multiple spreadsheets - dframe['Product'].fillna('',…
harry04
  • 837
  • 2
  • 7
  • 18
10
votes
2 answers

ValueError: Unknown label type: 'continuous'

I've seen other posts talking about this but anyone of these can help me. I am using jupyter notebook with Python 3.6.0 on windows x6 machine. I have a large dataset but I keep only a piece of it to run my models: This is a piece of code that i…
Dalila
  • 151
  • 1
  • 2
  • 8
10
votes
4 answers

ValueError: Unknown label type: while implementing MLPClassifier

I have dataframe with columns Year, month, day,hour, minute, second, Daily_KWH. I need to predict Daily KWH using neural netowrk. Please let me know how to go about it Daily_KWH_System year month day hour minute second 0 …
Anagha
  • 1,903
  • 6
  • 19
  • 37
9
votes
2 answers

ValueError with Concatenate Layer (Keras functional API)

After some search here, I still can't find a solution for this. I'm new to Keras, apologies if there is a solution and I actually didn't understand how it was related to my problem. I am making a small RNN with Keras 2/Functional API, and I have…
Maëva LC
  • 283
  • 1
  • 3
  • 8
9
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
  • 225
  • 2
  • 3
  • 8
8
votes
2 answers

ValueError: Unknown layer:name when loading a keras model

I have trained a CNN and saved it accordingly: model = Sequential() model.add(Flatten(input_shape=train_data.shape[1:])) model.add(Dense(256, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(1,…
Allan_ZA
  • 81
  • 1
  • 4
8
votes
10 answers

Google Colab-ValueError: Mountpoint must be in a directory that exists

I want to mount google drive on google Colab and I am using this command to mount the drive from google.colab import drive drive.mount('/content/drive/') but I am getting this error ValueError Traceback (most recent…
clarky
  • 309
  • 1
  • 4
  • 15
7
votes
7 answers

Error while importing Kaggle dataset on Colab

When executing the following lines, !pip install kaggle !kaggle competitions download -c dogs-vs-cats -p /content/ I got the following error messages, Traceback (most recent call last): File "/usr/local/bin/kaggle", line 7, in from…
Alan.L
  • 133
  • 1
  • 3
  • 7
1
2 3
81 82