1,798 questions
3
votes
0
answers
129
views
h3.cells_to_h3shape ValueError('Non-empty LatLngPoly loops need at least 3 points.')
I am attempting to convert a set of hexcodes to a h3shape using h3.cells_to_h3shape and get the following error:
Traceback (most recent call last):
File "~/temp.py", line 221, in <...
0
votes
0
answers
51
views
Layer "dense" expects 1 input(s), but it received 2 input tensors
Environment
Raspberry Pi 4: 8 GB RAM
Relevant Dependencies:
keras 3.11.3
numpy 1.26.4
opencv-python 4.12.0.88
pillow 11.3.0
tensorflow ...
2
votes
2
answers
518
views
ValueError: variable agent_scratchpad should be a list of base messages, got of type <class 'str'>
This is a very basic example how I am trying to use langchain to invoke a llm and find the tool to use:
import asyncio
import json
from langchain.agents import AgentExecutor, ...
0
votes
1
answer
74
views
Using pd.from_dummies to get the values in target variable back (after one-hot encoding) but getting Value Error
I'm participating in the curent Kaggle playground series and I decided to use a neural network for the binary classification problem because I am practicing making simple ones. I converted the target ...
3
votes
1
answer
48
views
ValueError: zero-size array to reduction operation maximum which has no identity in SVAR Mode
I'm trying to fit a Structural Vector Autoregression (SVAR) model using statsmodels in Python, but I'm encountering the following error ValueError: zero-size array to reduction operation maximum which ...
0
votes
0
answers
41
views
Alphalens get_clean_factor_and_forward_returns throws Length mismatch: Expected axis has 34 elements, new values have 36 elements
I'm using alphalens.utils.get_clean_factor_and_forward_returns() to compute forward returns from a factor series and price DataFrame. But I'm hitting the following error:
ValueError: Length mismatch: ...
2
votes
1
answer
155
views
How to correct a ParserError when respecting the CSV delimiter and a second ParserError on URL string not expected with the delimiter defined?
I'm new here so I hope that I will put all needed information
As the CSV is a huge one (10Go), the URL link is in the code below if needed
URL link to the data description (column type...)
Delimiter ...
0
votes
0
answers
91
views
MESA Solara missing required model parameter
I'm using Solara to visualize a MESA simulation but I always get this message:
ValueError: Missing required model parameter: initial_fire_positions
Can someone help me figure out why it is happening?...
0
votes
0
answers
27
views
Issue with Input Array on Random Forest Model with Both Numerical and Categorical Features
I am obtaining a ValueError regarding the input arrays and there dimension. I am trying to create a Random Forest Regression Model for price prediction using both numerical features and categorical ...
-1
votes
1
answer
90
views
ValueError: axes don't match array when trying to transpose
I'm fetching a frame correctly from webcam:
success, image = self.video.read()
But when I try to change the mode of my frame to grayscale using the following code:
gray_image = cv2.cvtColor(image, ...
1
vote
1
answer
68
views
ValueError: too many values to unpack Python when creating Dictionary from a String
I am trying to create a dictionary from a string. In this case I have posted my sample code (sorry its not that clean, just hardcoded values), the first str1 works fine and is able generate a ...
-1
votes
2
answers
65
views
Subtract value of one dictionary from the list of values of another dictionary. The keys should match
Here are my two dictionaries
dict1 = {'AUD': 1.55453513945, 'CAD': 1.3458501245, 'EUR': 0.97729005765, 'PKR': 289.48832734625, 'USD': 1.0}
dict2 = {'AUD': [1.6090702789, 1.5], 'CAD': [1.451700249, 1....
0
votes
1
answer
26
views
Input 0 of layer "conv2d" is incompatible with the layer: expected min_ndim=4, found ndim=2. Full shape received: (None, 4)
I'm making a CNN and I don't know the full ins and outs of coding. When i try to add the layers, it constantly gives me a "NotImplmentedError" and a "ValueError" that says ...
0
votes
0
answers
16
views
Incorrect Traceback on pandas ValueError [duplicate]
I saw some unexpected behavior during a ValueError when using pandas. When incorrectly using and instead of & to provide a boolean argument to a pandas series in a loop, the traceback points at ...
0
votes
2
answers
73
views
How can I change the format of a string date in pandas dataframe to an integer?
Python (venv) 3.12.2 from VSCode (1.96.2) within Anaconda (2.6.4) on an intel iMac, Sequoia 15.1.1.
I'm working on a downloaded model (not my original work) for predicting MLB scores. One of the 17 ...
6
votes
0
answers
679
views
How can I use dict in response_schemas using Gemini API?
I'm attempting to enforce a schema on a prompt response from Gemini. As made clear is supported in the 'structured output' docs.
For important implementation reasons, my schema contains dictionaries ...
1
vote
1
answer
1k
views
Invalid value of type 'builtins.str' received for the 'color' property of scatter.line Received value: 'rgba(166, 206, 227, np.float64(1.0))'
I am using this set of imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from chart_studio import plotly
# import plotly.plotly as pl
import plotly.graph_objs as go
import ...
3
votes
1
answer
90
views
Python Date Time missing month but it is there
I've been trying to create this machine learning tool to make predictions on the amount of orders in the next year per month but I have been getting this error:
ValueError: to assemble mappings ...
1
vote
1
answer
1k
views
Matplotlib's plt.show() throwing "ValueError: object __array__ method not producing an array"
I'm trying to run the following simple lines of Python code:
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1, 2, 3])
y = np.array([4, 5, 6])
plt.plot(x, y)
plt.show()
But 'm ...
0
votes
0
answers
89
views
Issue with datetime after updating packages
I've updated to python 3.12.4 and I'm getting an error on the code:
test=pd.DataFrame(['2024-09-10 15:40:27+00:00','2024-09-10 18:13:50.201000+00:00'])
pd.to_datetime(test[0]).dt.tz_localize(None)
...
0
votes
1
answer
977
views
ValueError: Arguments `target` and `output` must have the same rank (ndim)
I've been testing a code ("main.py") for image classification using a CNN model lately (whetehr a picture is a cat or a dog), and I've kept getting this error:
File "c:\Users\UserPC\...
0
votes
0
answers
256
views
"ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions."
I'm running a python file "data_prep.py" in which it prepares and load image data for use in a machine learning model, particularly for classification tasks involving images of different ...
0
votes
2
answers
101
views
fsolve (scipy) results in ValueError
I am solving so called Blasius problem. I use the following code (copied from youtube lecutre https://www.youtube.com/watch?v=0L4h-hqZY2Y , timecode: 8:35):
import numpy as np
from scipy.integrate ...
2
votes
0
answers
306
views
Pympler ValueError: invalid option: reset(base=-2147483504)
I have this numpy array 'dat' which is a 3d array of size 2048 MB and of shape (512,1024,512) when I do asizeof.asizeof(dat) from pympler, I get the error: ValueError: invalid option: reset(base=-...
0
votes
2
answers
487
views
Replace Null in Big Query
“How to replace zero values with null in BigQuery for weather data analysis?”
Missing values were incorrectly entered as zeroes, and I need to change them to null values. The code I used was Update (...
-1
votes
1
answer
51
views
while reading a value by using a for loop it gives me this error (ValueError: invalid literal for int() with base 10: '')
I am trying to make a chess game that can be ran on terminal and a variable that should have a value doesn't have a value and i don't know what is that cousing the problem
I want to make a chess ...
0
votes
1
answer
278
views
ValueError: The column label 'NPC' is not unique in Pandas DataFrame
I am working with a Pandas DataFrame that contains optimization results from HOMER software. I am encountering a ValueError indicating that the column label 'NPC' is not unique when I attempt to sort ...
-2
votes
1
answer
70
views
Is there a way to replace a float element in an array with a string element in python? [closed]
I have two arrays in my code. One is a grid that is just filled with zero and the other is an array of characters with positions they need to be placed in on the grid. I included an image with my ...
0
votes
1
answer
172
views
ValueError using Medaka: Expected 96 from C header, got 88 from PyObject
Firstly, I'd like to apologize if I have broken any rules since this is the first time I ask a question in this forum.
So I wanted to add medaka in my Pipeline in order to polish some genome ...
0
votes
1
answer
94
views
Using solve_ivp inside root or fsolve gives ValueError: setting an array element with a sequence
I need to solve a system of equations with a certain parameter p, and then I need to find the value of p that gives me the desired results. My code looks like (in a simplified version)
import numpy as ...
1
vote
1
answer
2k
views
TensorFlow - ValueError: Argument `output` must have rank (ndim) `target.ndim - 1`
I'm trying to train a sequential model on the TinyImageNet dataset, using TensorFlow.
TinyImageNet has 200 classes, 100k rows for training and 10k for validating. It has two columns, image and label.
...
2
votes
4
answers
2k
views
when model summary() show 'ValueError: Undefined shapes are not supported.'
I facing a problem when defining layers, the model summary for sequential model got error
Images
This problem only show when I run the code on jupyter notebook, when using google colab to run this ...
0
votes
0
answers
534
views
ValueError in Tensorflow that cannot convert to a shape
Trying to fix a tensorflow model from an older version of tensorflow than what I have. I'm getting a ValueError that seems to be from a library version issue, but I'm really not sure how to fix that.
...
-1
votes
1
answer
91
views
How I solve "ValueError: Found array with 0 sample(s) (shape=(0, 5)) while a minimum of 1 is required by LinearRegression."
I have built a drought prediction algorithm. The inputs of this model are future year range such as Start year and end year, Month, and City. The output of this model is a bar chart, its Y axis ...
0
votes
1
answer
187
views
ValueError: Invalid classes inferred from unique values of `y`. Expected: [0 1 2], got ['Dropout' 'Enrolled' 'Graduate']
I'm working on a classification task using the XGBoost classifier model. My dataset contains categorical variables, my target classes ('Dropout', 'Enrolled', 'Graduate').
from xgboost import ...
0
votes
1
answer
50
views
reshape numpy matrix where each element is a matrix of different sizes
I have a matrix with 4 elements, where each element is a matrix of different sizes. I am trying to reshape the matrix but it keeps showing me this error: ValueError: could not broadcast input array ...
2
votes
0
answers
87
views
Function to Oversample - Undersample instances in dataset
I want to create a function, that takes data instances, labels, and a target-proportion.
The function should determine the proportion of classes in the given dataset/labels, and resample the data into ...
2
votes
1
answer
62
views
Trying get a table from a website (ValueError: If using all scalar values, you must pass an index)
I'm trying to make a function that automatically takes a table from a website(Wikipedia) cleans it a bit and than displays it, everything worked well with my first 2 tables but the third one is giving ...
-2
votes
2
answers
65
views
why python doesn't calculate the result as per formula I provided
I am working on python, what is wrong with the following code:
try:
x, y = input("fraction: ").split("/")
result = int(f"{x}* 100/{y}%")
if result <= 1:
...
0
votes
0
answers
154
views
Calculating distance between rows of Pandas dataframe and adding to list
The question I'm asking is similar to the one I posted here a while ago: Comparing 2 Pandas dataframes row by row and performing a calculation on each row
I got a very helpful answer to that question ...
0
votes
1
answer
1k
views
ValueError: One of the requested xi is out of bounds in dimension 0
I am trying to interpolate a 48 x 86 grid that has wind speed data (the grid being time x height) to a 71 x 81 grid (also time x height). I am trying to use the interpn function from scipy.interpolate ...
0
votes
0
answers
55
views
Why is unittest returning ValueError (not in list) when the element is in the list?
I have a function which searches a Bank for a specific Account object. If it finds a matching account, the function replaces the Account object with None. If it finds no match, it returns. This works ...
0
votes
0
answers
117
views
Dealing with I/O exceptions beyond OSError
I have an endless program that needs to write to daily log files. Below is basically my Message class that opens a file at startup and closes/opens a new file daily. Now I'm testing for error handling,...
0
votes
0
answers
45
views
Scatter Plot: Value Error, Unable to Coerce to Series
I am currently working on a residual plot visualization for my perceptron. As the title states I am running into an error when calling pyplot.scatter. It seems as though the function wants n_samples ...
1
vote
1
answer
1k
views
Jax ValueError: Incompatible shapes for broadcasting: shapes
I'm trying to write a weighted cross-entropy loss to train my model with Jax. However, I think there are some issues with my input dimension. Here are my codes:
import jax.numpy as np
from functools ...
0
votes
0
answers
29
views
Value Error: Data is ambiguous (for some reason, all x values are 1)
So I was coding an AI model that generates music based on text. I checked all the preprocessing functions, and they seem to work just fine. The x samples are the preprocessed text for training, and ...
0
votes
1
answer
58
views
ValueError: time data "2020-04-29T17:18:25.574824Z" doesn't match format "%Y-%m-%dT%H:%M:%S%z", at position 3 - I am changing object dtype to datetime
I am trying change object dtype to datetime
# My Code:
import pandas as pd
# Sample data
data = {'Channel_Started': ['2013-05-18T04:46:00Z', '2018-01-16T15:55:22Z', '2016-12-12T05:00:55Z', '2020-04-...
-1
votes
2
answers
874
views
I keep getting TensorFlow ValueError and I dont know what is causing it
So i installed everything to run a jupyter notebook in Visual studio code and have tensorflow and python fully updated. However, I keep running into an error when I run one of the Kernels. ...
1
vote
1
answer
454
views
What's causing the ValueError: could not interpret identifier: loss?
Within the code below, please help me understand why the loss metric is not being parsed
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.impute ...
0
votes
0
answers
27
views
Python ValueError in broadcasting although right shapes
I have a problem in a bigger python project.
This ist the code I'm trying to implement. I'm trying to find out in which interval of a0 the points in a lie (there will be a lot more points in the ...