2,208,366 questions
-1
votes
1
answer
45
views
Extract dictionary key values from every level into rows in dataframe with different structure on each level
How do I extract dictionary key values from every level into a dataframe? I used pd.json_normalize but it doesn't suit my needs since it puts the previous keys as prefixes. This is what I tried
import ...
0
votes
0
answers
20
views
How to find children of each node using git log
I am currently working on GitGarden, a CLI tool that draws your repos as plants. I want the branching/forking of Github repos to be mimicked in my program, like how trees branch off in real life. To ...
-6
votes
0
answers
34
views
Seeking Guidance on Implementing Real-Time Voice Interaction in Python for Onboarding Assistant Prototype [closed]
I'm working on a prototype for a voice-enabled assistant as part of my Applied Research I course project. The goal is to create a conversational system that collects user profile data (e.g., name, ...
-3
votes
0
answers
25
views
LinkedIn learning API integration with CORTEX XSIAM [closed]
I just got a requirement where we need to ingest two types of LinkedIn learning reports
”Learner summary and learning details reports “ with XSIAM in its automation & feed integration section.
...
2
votes
0
answers
27
views
Shelve sqlite3.OperationalError: disk I/O error
This is Fedora 43. Python 3.14
I can create and retrieve a shelf in a command line with no errors:
#!/usr/bin/env python
import shelve
shelf = shelve.open('/tmp/my_shelf', flag='c', writeback=True)
...
Advice
1
vote
0
replies
19
views
How to check if 1000+ Twitter users have tweeted a specific keyword without using the paid API?
I have a list of 1,000 Twitter handles and I need to check if each user has tweeted a specific keyword at least once.
Since the Twitter API Free tier no longer allows reading user timelines or ...
-3
votes
0
answers
38
views
How to fetch within python script written opinions of all family members of a national patent application? [closed]
I want to fetch within a python script all negative written opinions from all family members of an Israeli patent application, along with their corresponding set of claims. I consulted Gemini and ...
-3
votes
1
answer
112
views
Problem adding numbers 1 to 100 in python [closed]
I am trying to add all numbers from 1 to 100 using a for loop (1+2+3 etc.)
I have got this nice little function here but for some reason it seems to not work. Is there a fix?
for i in range(1, 101):
...
Best practices
0
votes
0
replies
9
views
Set status RUNNING for default automation condition sensor
I am working with Dagster to automatize a data pipeline. I have set and defined an asset, that should automatically start when there is no previous materialization or an update is needed. The ...
0
votes
0
answers
14
views
Camera fails to stream with cv2.VideoCapture after adding MediaPipe Hands (Python 3.10, Windows)
I am writing a Python program on a python 3.10 venv using cv2 and mediapipe libraries but once I add any mediapipe code my program does not open a window to my camera/ my camera does not turn on ...
2
votes
1
answer
55
views
Pillow is inverting colors on images
Making a program to automatically make cards by pasting text and images onto a template and saving it as an image.
Everything works, but the images' colors are inverted.
I have tried disabling dark ...
2
votes
0
answers
14
views
Halide python API - interleaved image format support
I wrote a simple Halide generator in python, and compiled it webAssembly. I want it to use interleaved RGB image data as input and output. Here is what it looks like:
import halide as hl
x = hl.Var('...
-4
votes
0
answers
17
views
Running start2 instead of chapter2 upon input? [duplicate]
I'm making a chapter selection area and every input leads to chapter one/start2. I don't know what I'm doing wrong.
I think the main issue is around the def and start functions. When I go to input ...
-1
votes
0
answers
63
views
Improving lookup time on Python dictionaries with string keys
I'm working on a project that involves generating random data according to a wide variety of specific distributions. The number of sample points to generate can go up to hundreds of thousands, ...
-2
votes
0
answers
17
views
pytesseract and tesseract giving errors for seemingly no reason [closed]
from googletrans import Translator, constants
from pprint import pprint
from PIL import Image
import googletrans
import pytesseract
import pyautogui
import time
import os
file_number = 1
file_name = ...
0
votes
0
answers
46
views
Is there a limit to how many variables can be processed with MANOVA in Python?
I'm trying to program a MANOVA analysis in Python, but I'm running into a problem regarding the number of variables I'm trying to analyze.
When I run the following code:
fit = MANOVA.from_formula(&...
1
vote
1
answer
37
views
Wrap lines in Spyder 6 editor
How do i wrap lines in the editor in Spyder 6? I recently updated my Spyder, and it seems the functionality to wrap lines has disappered. Here is a screenshot of Tools -> Preferences -> Editor, ...
1
vote
0
answers
37
views
Telegram OAuth with django
im trying to integrate telegram oauth into my application, currently it successfully log in in telegram, but django doesnt received any data in callback, I have tryied many methods, but without any ...
0
votes
0
answers
45
views
Convergence issue using SciPy for portfolio optimization
I am using scipy.optimize.minimize with trust-constr algorithm to run the optimization. The goal is quite standard: optimizing the weights w of a portfolio under some constraints, w0 being the weights ...
0
votes
1
answer
42
views
CSS selector on a beautifulsoup4 element does not nest correctly?
It seems that I am missing something about how Beautiful Soup (4.14.3) executes CSS selectors on its `bs4.element.Tag` objects. I select an element, call another selector on the element, and the ...
Advice
0
votes
2
replies
20
views
Automating Image Classification for Website Content Using Computer Vision
There are a large number of images that need to be uploaded to my organization’s website. Currently, it takes a significant amount of time to manually classify each image into categories such as tower,...
0
votes
2
answers
35
views
GitLab CI: Unable to download job artifact from another project – CI_JOB_TOKEN returns 404, private token returns 401
I’m facing an issue while trying to download a job artifact from one GitLab project into another using GitLab CI/CD.
What I’m trying to achieve
In the project A, I want to improve CI testing by:
...
-2
votes
1
answer
55
views
Most efficient way to merge two lists of dictionaries by a shared key in Python? [duplicate]
I have two lists of dictionaries in Python, and I need to merge them into a single list based on a shared key (e.g., id).
My Data:
Python
list_a = [
{'id': 1, 'name': 'Alice'},
{'id': 2, 'name'...
-2
votes
0
answers
22
views
Celery worker crashes after hitting memory limit in low-RAM setup [closed]
Setup details:
Celery 5.x
Command: celery -A app worker -c 5
Broker / backend: Redis
Server RAM: 1GB
Observed behavior:
Worker memory steadily grows during task execution
At ~200–250MB RSS, the ...
-1
votes
0
answers
24
views
Python TypeError in GFG Minimize Heights II – missing positional argument ‘k’
I am trying to solve the “Minimize the Heights II” problem from GeeksforGeeks using Python. The problem gives you a sequence of tower heights and requires modifying each tower height by either ...
-1
votes
1
answer
40
views
Python Call Base Class Stringification [duplicate]
I'm struggling to figure out how to call the base class implementation of stringification in Python. The following illustrates what I am attempting to do:
class A:
def __init__(self, text):
...
-2
votes
0
answers
25
views
.loc uses label based slicing [closed]
But why does it still give an output when both the start and end index are not present as index. (as in the image). This behavior is similar to position based rather than label based
enter image ...
-2
votes
0
answers
27
views
Apache Superset: Localhost refused to connect while embedding Superset through iframe [closed]
I am using version 6.0.0 in Docker Desktop and tried to embed a dashboard in a simple .html file through iframe. But it says
localhost refused to connect
whenever I am tying to execute the HTML file....
0
votes
1
answer
50
views
Cannot resolve circular reference between two models
I have these two models (I've trimmed away extra fields to keep it readable):
class Forum(LegacyBase):
__tablename__ = "forums"
id: Mapped[int] = mapped_column("forumID", ...
-9
votes
0
answers
35
views
Record Validation and Consistency Check on SCHOLAR.txt [closed]
A text file SCHOLAR.txt contains student academic records.
Each record is stored on one line in the following format:
RollNo@Name@Class@Section@SubjectCodes@Marks
Where:
RollNo → integer (no gaps ...
Best practices
1
vote
2
replies
32
views
How do I properly import a self-written module which depends on a third-party module within a program?
I am writing (in Python) a function for import and use in another program. This function takes standard Python data structures as input, e.g., list of strings, and outputs a numpy array based on the ...
-3
votes
0
answers
39
views
Dash design changed [closed]
My design in dash changed without me asking for it.
I'm using:
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
And that gave me this design:
But for some reason it changed and now ...
1
vote
0
answers
31
views
Trying to write a Python plug-in for Gimp version 3.0.8 that selects a polygon
After a lot of digging and trying to sort out the older interface API from the gimp 3 version. I find I'm stuck. I'm using the code below to try to select a triangular area. The code runs in the ...
4
votes
1
answer
81
views
is_dir() returns False for relative path, but True for resolved path
I'm on Win11 and have a relative Path instance for which is_dir() returns False:
>>> s = "../../../a/b/c"
>>> p = pathlib.Path(s)
>>> p.is_dir()
False
>>> ...
0
votes
0
answers
37
views
Why does .view() fail after permuting dimensions for a GRU?
I'm trying to train a character-level GRU on Linux kernel source but the training loop keeps crashing with this error:
RuntimeError: view size is not compatible with input tensor's size and stride (...
Advice
0
votes
2
replies
34
views
How do I extend my Python cash machine program to handle multiple accounts?
I have made a Python function that simulates a cash withdrawal from an ATM, checking for the correct PIN and sufficient balance before processing.
I have defined a function called cash_machine with ...
0
votes
0
answers
34
views
Is there a way to use sc.exe create instead of NSSM for a Uvicorn/FastAPI application?
It's not recommended in the current scope to download NSSM, and we have used sc create for other services before. However, it seems that sc create is having trouble actually accessing the API. I've ...
1
vote
2
answers
85
views
I'm tying to combine Excel files from two different years of labor costs. One of the files numerical data is doubling and I can't find the reason
I'm using two excel files (each file for the years 2024 and 2025) and combining the files through Pandas. I discovered this issue when checking the sums that my program outputs and comparing them to ...
0
votes
0
answers
42
views
cupy kernel template for elementwise reductions
I want to get the kernel template that cupy uses for its subtract function to compare with my (really simple) kernel:
subtract_kernel = cp.RawKernel(
"""
extern "C" __global__
...
0
votes
1
answer
36
views
Selenium nested for loop iteration in iteration over urls
I am trying to iterate through a list of Urls find some elements, one of which is a list of other Urls.
I then want to, in the same overarching loop iterate through the second list of Urls and find a ...
0
votes
0
answers
18
views
OTEL Auto Instrumentation for Python Logging
I have been trying to test OTEL auto instrumentation for Python and been having trouble getting metrics, traces, and logs to all be properly exporting consistently. I have been attempting this will ...
-1
votes
0
answers
26
views
How to paginate output [closed]
I want to paginate over potentially thousands of objects.
I want to offer users a list of buttons they can pick. The list depends on a search of a database and the number of buttons could be between 0 ...
Best practices
0
votes
2
replies
19
views
How to build crash-resumable, deterministic workflows in Python without a full workflow engine
I’m building a backend workflow runner where each job is a sequence of steps (mix of pure compute and side-effects like HTTP calls, DB writes, file uploads). If the process crashes mid-step, the job ...
3
votes
2
answers
65
views
Getting mypy to recognize tuple of certain length
Mypy triggers the following error:
Incompatible return value type (got "tuple[int | None, ...]", expected "tuple[int | None, int | None, int | None, int | None, int | None, int | None, ...
0
votes
0
answers
30
views
Multiple buttons to call the same function
When creating buttons, you assign them an 'action_id' and a 'value'. The action ID is also the name of the function called when the button is pressed. I want to offer multiple buttons with the same ...
0
votes
0
answers
22
views
Consume is not happening from same topic with different group ids for a specific group id
I have one scenario where the parallel airflow tasks are 5 and from same topic i am trying to consume data but with different group ids, like 0,1,2,3,4 appended to group ids
all 0,1,3,4 parallel tasks ...
1
vote
2
answers
50
views
Selenium can extract button text but can't click it
I am working in Python in a Google Colab notebook and using google_colab_selenium. Trying to push the "Load More" button on this page: https://www.rottentomatoes.com/m/inside_out_2/reviews. ...
1
vote
1
answer
39
views
Keras Loss from multiple output layers
I have a Keras model with multiple output layers. I want to have a loss function, that computes a loss based on two of the model output layers.
Can I do this in a simple way, without using a custom ...
-1
votes
0
answers
26
views
How do I get Invoke to correctly behave with GPG (by way of passwordstore)?
Consider the following:
from invoke import task
@task
def expose_secrets(c):
secrets = c.run('pass some/path/to/my/secret', pty=True)
Run this with
uvx invoke expose_secrets
And then start ...
3
votes
0
answers
48
views
Injecting .pth file for auto instrumentation
I am developing a library that requires 'zero-touch' installation to inject a .pth file directly into the environment's site-packages directory (lib/python3.x/site-packages). While I am using Poetry ...