2,209,292 questions
2
votes
1
answer
78
views
numpy 2.2.6 tries to build on Windows 11 x64 instead of using wheel
originally I was trying to install opencv-python which fails on trying to install numpy:2.2.6
So I am trying to just install this numpy and for some obscure reason it tries to build it! instead of ...
2
votes
1
answer
63
views
Change color of single line in altair line chart based on other indicator column
Imagine having the following polars dataframe "df" that contains the temperature of a machine that is either "active" or "inactive":
import polars as pl
from datetime ...
1
vote
1
answer
66
views
Format y-axis as percentage in a seaborn.objects plot
I found a suggestion to use ticker.PercentFormatter. This changed the decimal numbers on the y-axis to percentages like I want, but the style formatting (grid, background, etc.) is lost, and the ...
1
vote
1
answer
64
views
Sqlalchemy mapped_column typing issues with pylance
I am currently defining ORMs and DTOs in my fastapi application, and using SQLAlchemy 2.0 for this job.
Many sources, including the official docs, specify that the way to use mapped types with ORMs is ...
1
vote
0
answers
54
views
How to remove white space between QTableView and QHeaderView?
Does anyone know how to remove this white space? This is my current stylesheet:
QTableView {
background-color: #EEEEEE;
}
QTableView::item {
background-color: transparent;
}
QHeaderView::...
1
vote
0
answers
52
views
Cannot connect Cursor to my remote MCP server
I'm trying to connect Cursor to my custom MCP server, but it doesn’t work.
How can I fix this?
MCP Server Code
from starlette.applications import Starlette
from starlette.routing import Mount
from mcp....
Advice
0
votes
0
replies
43
views
Migrating large codebase from SQLAlchemy 1.4 to 2.0 in 2025
I need to migrate an insanely large code base that extensively uses SQLAlchemy 1.4 to 2.0. I am sure there is something I can do to automate or simplify at least a piece of this task, but I haven't ...
Advice
0
votes
1
replies
57
views
How to Automate Extraction and Standardization of Multilingual Name/Username Data Without Modifying the Original Database?
We’re working with a user table populated from multiple SSO sources, and the data has inconsistencies that hinder generating standardized names. I need a persistent, automated way to extract and ...
1
vote
0
answers
75
views
Is it possible to drop/select columns where col.n_unique > 1 with native polars syntax [duplicate]
I have a table that looks like this
import polars as pl
df = pl.DataFrame(
{
"col1": [1, 2, 3, 4, 5],
"col2": [10, 20, 30, 40, 50],
"col3": [...
Advice
0
votes
7
replies
104
views
High volume URL parsing in Python
I use the polars, urllib and tldextract packages in python to parse 2 columns of URL strings in zstd-compressed parquet files (averaging 8GB, 40 million rows). The parsed output include the scheme, ...
3
votes
3
answers
104
views
Numerically finding the minimum value of a variable where a function equals a value
I have a black box function baseball that determines the magnitude of the distance that a baseball travels when launched. It takes the initial speed, the angle of launch and the initial spin. Assuming ...
-3
votes
1
answer
52
views
Getting error "TypeError: unsupported operand type(s) for /: 'list' and 'list'"
This is my code:
def q_f_a(t_p):
x1 = t_p[0][0]
y1 = t_p[0][1]
x2 = t_p[1][0]
y2 = t_p[1][1]
x3 = t_p[2][0]
y3 = t_p[2][1]
a = [ x1 * ( y3 - y2) + x2 * ( y1 - y3 ) + x3 * ( ...
2
votes
0
answers
44
views
libstdc++.so links error when try to use pybind11/3.0.1 of conan-2 and cpp23 in wsl
In WSL (Ubuntu 24.04), when using Conan to create a package that links pybind11/3.0.1, the resulting executable in the test_package fails to run.
Even if the executable doesn't directly call any ...
5
votes
2
answers
278
views
Why are C++ and Python giving me different answers, when given (I think) the same precision?
I have this code in C++:
#include <iostream>
#include <iomanip>
#include <limits>
#include <boost/multiprecision/mpfr.hpp>
using namespace boost::multiprecision;
template<...
0
votes
2
answers
74
views
Horizontal and vertical scrollbars using TKinter and Python almost working
I wanted to try to use tkinter for the first time, and had a little program I wanted to try.
It needed some text in a "table" and because of the number of rows and columns, I needed ...
0
votes
0
answers
20
views
Introducing new dimension in xarray apply_ufunc
There has been at least one other question regarding the introduction of new dimensions in the output of xarray.apply_ufunc; I have two problems with this answer: First, I feel like the answer avoids ...
-1
votes
1
answer
37
views
Minimal Python program to upload data to Postgres using psygopg3 COPY does not appear to run the COPY operation
I have written a minimal test example to try and debug some issue I have been having where COPY does not appear to do anything when used to copy data to a postgres database.
This is my Python code:
...
0
votes
1
answer
43
views
AWS MQTT connect from Python - receive not working
I'm learning how to use MQTT on AWS IoT - the goal is to simply publish and receive between AWS IoT MQTT test client and a Python script.
I can successfully publish from my Python code but I am unable ...
1
vote
2
answers
128
views
How to get a true/false without duplicates when comparing two Pandas dataframes?
I have one dataframe with sessions - one session, one row, so SID is unique. The session has a doctor name.
SID
Doctor
Patient
1
robby
david
2
langdon
sara
3
langdon
michael
I have another dataframe ...
0
votes
1
answer
53
views
How to run .py script with windows cmd without having python pop up?
I had this script for automated solving of a little daily game thing. I used to be able to run it by typing cmd into the folder where the script was, and then running the script by entering scriptname....
0
votes
1
answer
82
views
set states to indicate on and off with timestamp
def prepare_dataframe(df):
# Map original CSV column names to internal aliases for easier access
df.rename(columns={
'Bomba Calor - Temperatura de Aire (°C)': 'temp_aire',
'...
1
vote
1
answer
73
views
Scipy Hessian with Numpy cross product
I need to compute the Hessian of a function involving cross products in Python. As an experiment, I consider the simple function
def func(x):
return np.sum(np.cross(x[0:3], x[3:6]))
and compute the ...
2
votes
2
answers
43
views
VSCode/Pylance highlights "Import could not be resolved" after moving files from a subfolder to the root
I’m working on a Python project on Windows 11 using VSCode.
I recently reorganized my project by moving all files from a subfolder to the root folder so that the code can be executed directly from the ...
Advice
0
votes
0
replies
22
views
Precedence implementation - compressed sparse row (CSR)
I'm doing a model for scheduling personnel through VRP formulation and I would like to know how can I integrate precedence binary matrix, using the CSR to accelerate the data processing.
My precedence ...
0
votes
1
answer
47
views
Getting maximum performance on Google Cloud Run for a single thread Python script
I’m running a Google Cloud Run service that exposes an API endpoint performing heavy computational tasks (CPU-bound).
The API will be called very occasionally and for now there will never be ...