2,208,684 questions
0
votes
0
answers
25
views
ImportError: cannot import name 'create_tool_calling_agent' from 'langchain.agents'
from langchain.agents import create_tool_calling_agent
from langchain.agents.agent_executor import AgentExecutor
executor = AgentExecutor(
agent=supervisor_agent,
tools=[insurance_subagent, ...
-4
votes
2
answers
89
views
Is it necessary your Python function should have return in?
def odd_or_even(n):
if n % 2 != 0:
return "Odd"
else:
return "Even"
#Here
I wrote a function which checks whether the number is odd or even using if ...
-5
votes
0
answers
48
views
Capturing sudoku but Selenium didn't find it with Chrome in HTML [closed]
I'm trying to capture this sudoku with Selenium and Python after accepting the cookie.
With this code I could accept the cookie in the iframe and write the main site to the output.html for debugging:
...
0
votes
1
answer
47
views
Why do Tkinter apps running under uv have strange fonts?
I have a simple Tkinter app:
import tkinter as tk
from tkinter import ttk
def main() -> None:
root = tk.Tk()
root.title('Hello world')
label = ttk.Label(root, text='Hola Mundo')
...
1
vote
1
answer
66
views
Equivalent of Python's collections.Counter in DolphinDB
I want to count the occurrences of each element in a DolphinDB array, similar to how collections.Counter works in Python.
from collections import Counter
my_list = [1, 2, 3, 2, 1, 3, 2, 1]
my_counter =...
2
votes
2
answers
61
views
Multiframe ZSTD file: how to get metadata of each frame?
I would like to compress multiple ndjson files into ZSTD file using the Python binding python-zstandard. For random seeking later on, I would like that each file is compressed independently as a frame....
0
votes
0
answers
33
views
How to access velocity/update field from DiffeomorphicDemonsRegistrationFilter?
I'm using DiffeomorphicDemonsRegistrationFilter for deformable registration and need to access the internal velocity /update field that the algorithm computes, not just the final displacement field.
...
-3
votes
0
answers
58
views
Numpy NDArray LSB Swap [closed]
In python, with a NDarray of uint8s, how could I iterate over the array, and at indexes contained in a secondary NDarray, swap the LSB of the integer with the value from a third NDarray, containing ...
1
vote
1
answer
50
views
How to scroll down and click on a link after log in using Selenium
I'm trying to get into this website and retrieve fund status data https://fundfinder.panfoundation.org
I need to log into the website (this is an open website, anybody can create username and pwd to ...
1
vote
0
answers
73
views
3D plot of trajectory given X,Y,Z points
Im trying to plot a 3D trajectory (predicted vs ground truth) but something feels wrong, i managed to get right graphs X,Y,Z in seperate graphs , with respect to time (just seq nums basically) with ...
Best practices
1
vote
1
replies
32
views
Python - accessing bounded generic type hint
mypy is unhappy with the below code due to
app.py:33: error: List comprehension has incompatible type List[TradeBar | QuoteBar]; expected List[T] [misc]
Even though we know this_type is the class ...
3
votes
1
answer
73
views
Building Python Wheel without internet connection
I am trying to setup an air-gapped VM (Win10) to build python wheels.
It works for Python versions < 3.14.
With Python 3.14 I can only build the package when I have access to the internet.
Without ...
Advice
0
votes
0
replies
16
views
hosing Python / Flask apis in RHEL with heavy IO bound tasks
below is my application design. as ou can see my back end flask/ python apis are hositng websocket APIs for some of the front end actions. the intention is to have quick communication from front end ...
Best practices
0
votes
2
replies
25
views
Visualizing categorical features with severe Class Imbalance for ML: Absolute Counts vs Normalized Percentages?
I am performing Exploratory Data Analysis (EDA) on a medical dataset (Primary Biliary Cirrhosis) to select features for a multiclass classification model. My target variable is Stage (1, 2, 3, 4).
The ...
3
votes
1
answer
61
views
How can the backward function in tensor influence the matrix in model
class SoftmaxRegission(torch.nn.Module):
linear: torch.nn.Linear
def __init__(self, num_features: int, num_classes: int):
super(SoftmaxRegission, self).__init__()
self.linear =...