2,207,062 questions
Best practices
0
votes
2
replies
33
views
What is the best way to modify values in a slice of a column with .iloc in Pandas
With ChainedAssignmentErrors being enforced in Pandas 3.0 I was wondering what the best way to modify values in a slice of a column where the slicing is done with .iloc[] is.
For example this causes a ...
Advice
0
votes
0
replies
35
views
Book Recommendation in PyTorch
I am looking to find a book on PyTorch that is suitable for beginners, Ive used sklearn in the past for ML its a simple workflow for me prepare the X and Y data, fit/train a model, and make ...
-1
votes
2
answers
101
views
Why does this work on windows but not mac?
I'm using flask to run a website, working across my personal imac (running macos 26) at home, and a windows PC (running win11) at college to code, storing all the code in github. I run app.py from the ...
Advice
0
votes
4
replies
92
views
How I'm learning Python
I'm new. I started learning with YouTube, then with W3Schools, and lately I've been doing Exercism exercises.
I also started uploading what I learn on GitHub, everything I learn. I'd like to know any ...
Advice
0
votes
3
replies
38
views
How can I prevent Dash reloader from re-running database connection on every file save?
I'm building a Dash dashboard that loads data from a remote database (Redshift) on startup. The loading takes ~2 minutes. When I use use_reloader=True, every time I save any .py file in the project (...
-2
votes
0
answers
35
views
How do I connect my selenium-webdriver Webscrapper API to my python file under scrape.py so that it works properly with AI calls with LangChain?
I have all the accounts set up, and I am trying to debug my code as I keep encountering errors when I try to use the scraper.
scrape.py
The problem is I run the the program, but the original code is ...
Advice
0
votes
1
replies
54
views
Multi-word autocomplete for custom IDE
I'm trying to create a simple code editor for an old custom programming language used by a single Company's product, as part of an effort to make some custom tools to avoid using the Company's ...
Best practices
0
votes
1
replies
36
views
Redis Streams as ingestion buffer vs. dual async writes to db and redis at 50k msg/sec
Building a python pipeline ingesting ~50k WebSocket messages/sec. Each message needs to hit PostgreSQL and a live frontend. Two options:
Option A — write both in the handler at the same time
WS ...
0
votes
0
answers
42
views
Matplotlib figsize has no visible effect in Spyder plots pane
I am using Matplotlib in Spyder and I am trying to change the figure size with figsize, but it does not seem to make any visible difference no matter what values I use.
For example, even if I change:
...
-1
votes
0
answers
77
views
Python debug problems
I need to enable debugging in VS Code to debug a Python file but, due to the specific nature of my .py file, I need to do this not from the project directory, but from a directory one level above my ...
3
votes
1
answer
75
views
connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: sorry, too many clients already
I'm using celery with django to run some task that runs multiple threads querying the database. The example below is a simplified version of the original one in a larger project, but the logic and ...
0
votes
1
answer
39
views
Why does asyncio.gather with pandas DataFrame rows not run concurrently?
I'm processing a large pandas DataFrame (500k rows) where each row requires an HTTP request. I switched from requests to aiohttp + asyncio expecting a significant speedup, but the async version runs ...
Advice
0
votes
9
replies
98
views
Learning coding from scratch
I wanted to start learn how to code from scratch without using the help from AI. What should I know about coding, like which programming language I should start with, how to test the code if it works ...
0
votes
1
answer
118
views
Can I install mathutils on Python 3.14?
Mathutils is a Python library maintained by ideasman42. I have been using it on older versions of Python and want to update an old project to a more recent version of Python.
When I try to install ...
-2
votes
0
answers
62
views
Tkinter notes app not saving to JSON file — notes disappear on restart [closed]
I am building a Google Keep-style notes app in Python using tkinter. Notes appear on screen while the app is running, but when I close and reopen it they are gone. The JSON file is either not being ...
0
votes
1
answer
70
views
Organizing elements in a frame w/ tkinter
I am a novice Programmer learning GUI and Tkinter for the first time, attempting to make a productivity app for myself. I am trying not to use AI as much as possible.
I have created a Frame within the ...
0
votes
0
answers
47
views
Issue running facebook prophet model
I am using the Jupyter notebook to run the Facebook Prophet model using Python code.
Below are the steps I followed:
1. Import Libraries
import pandas as pd import numpy as np
import matplotlib....
-1
votes
1
answer
63
views
Streamlit is not rendering markdown properly
I am trying to render markdown by using .markdown method for the following markdown:
**Stellar Bank** requested a finance vertical campaign focused on **in‑view rate** with a budget of **$80,000**. We ...
Advice
0
votes
4
replies
61
views
Dynamic data fetching system
I am trying to write my first project using python which is a recipe administrator, which contains a programm that fetches url given a keyword, and fetches them back and add them dynamically to a ...
-1
votes
1
answer
79
views
Why can’t Google Colab kernel (via VS Code) access files from my local machine? [closed]
I was trying to connect Google Colab to my VS Code and I successfully did that but when connected to Colab kernel, I can't read files that are in my local machine. But in local Python environment the ...
Best practices
0
votes
1
replies
72
views
Looking for feedback on my FastAPI project
I'm fairly new to programming and just finished my first backend project. I'm using FastAPI with PostgreSQL and JWT authentication.
I know the functionality is basic, but I'd really appreciate ...
Advice
1
vote
3
replies
82
views
I want to create 2 gems in Gemini , please suggest me the most suitable prompts
I want to create two Gems (custom LLMs in Gemini that respond based on specific instructions) for two different tasks. Please suggest the most suitable prompts, based on your experience in both ...
Advice
0
votes
3
replies
90
views
I want to create two Gems - please suggest the most suitable prompts
I want to create two Gems (custom LLMs in Gemini that respond based on specific instructions) for two different tasks. Please suggest the most suitable prompts, based on your experience in both ...
2
votes
1
answer
114
views
OpenCV unable to read uncompressed AVI video files in python even though it can open and read metadata
I am unable to use opencv cap.read() on .avi files since it crashes there. There seems to be some problem with fourcc since it returns 0.0 and cap.IsOpened returns true. The fps, width, height are ...
Best practices
0
votes
4
replies
158
views
Programmer owns the architecture, AI implements crate-level modules in Rust — how does this compare to other languages?
After working on several Rust projects with AI assistance, I want to share a division of responsibility that has worked well in practice, and ask whether others have found the same — or a better ...
2
votes
0
answers
81
views
Infinite sum involving a parameter
How do I persuade SymPy to evaluate an infinite sum which converges and I know SymPy should be able to do? For example, the following just gives back the unevaluated infinite sum:
a = Symbol('a',real=...
-4
votes
2
answers
105
views
adding a float dictionary value to a variable that is a float [closed]
Basically the dictionary I am using has a bunch of floats as the values to each key, I have everything down just my issue is that my variable is only saving the most recent value I pulled. I am sure ...
-3
votes
2
answers
87
views
How do I change the footprint variable? [closed]
I'm trying to learn basic programing in khan academy. But I get this unexpected result when I run the program:
Do you have a pet (yes/no)? yes
Does your pet food contain meat (yes/no)?yes
How many ...
-1
votes
0
answers
75
views
Issues with Importing Numpy [closed]
I use Python. I've tried to import matplotlib and numpy into my Jupyter notebook, but I have received this error message. How can I rectify this issue, preferably the exact lines of code I should type?...
0
votes
2
answers
72
views
How to convert query results into dict using Python?
I need to convert the query output into dictionary, currently the output type is tuple. There is 3 Table output, how to convert into a single Dictionary output with the Column name respectively.
I ...
Advice
0
votes
2
replies
100
views
Coding parts of a 61131-3 source Program in an external language: one that 61131 does not define
I'm looking for a sample of an IEC 61131 PLC source program that explicitly contains routines in a 'foreign' textual language. 'Foreign' here means a language whose definition is not part of 61131.
...
Advice
3
votes
17
replies
189
views
First text based game
I've started work on my first text based game and would like advice on how to streamline it. I'm programming it entirely in python 3.12. This is only my second personal project and I've never done ...
1
vote
2
answers
47
views
How to add string signal to mdf file asammdf python
I am creating a an mdf file from a pandas dataframe with time series data. I have string channels that I am not sure how to add, I get an error using the code below.
data = {
"GLOBAL_TIME&...
-3
votes
0
answers
67
views
How to solve cannot import name 'MapTextRunner' from 'mapreader' error in Python? [closed]
I'm trying out the spot text pipeline from mapreader. I have an Anaconda environment and use a Jupyter notebook (ipykernel, mr_py does not recognize the installed packages) to go through the steps. I ...
-3
votes
0
answers
65
views
Checking Python interpreter in Ansible [duplicate]
When I'm trying to run playbook it seems like the Python version in use is one the latest one (>3.11).
I have set interpreter_python = /usr/bin/python3.9 in ansible.cfg.
Is there another priority ...
-1
votes
0
answers
47
views
Jupyter differences between Completer and IPCompleter
The right way to change Jedi status in a Jupyter notebook seems to be
%config Completer.use_jedi=False
However the right way to check whether Jedi is enabled seems to be
%config IPCompleter.use_jedi
...
-2
votes
0
answers
40
views
'TreeNode' object has no attribute 'is_exhausted' Error while running simple python program using hypothesis [closed]
Code
from hypothesis import given, strategies as st
@given(st.integers())
def test_integers(n):
print(f"called with {n}")
assert isinstance(n, int)
test_integers()
Exception Stack
...
0
votes
0
answers
56
views
Why does PyQt5 block write access to another program ("server-based")?
I have been working to integrate a PyQt5 GUI with a third-party software from HighFinesse (makes wavemeters). I am using the minimal Python library here on Python 3.9 on a Windows 11 computer.
In ...
3
votes
2
answers
74
views
How to visualize a dense, gappy time series with spikes in Python?
I have a sensor time series with these properties:
~250,000 data points at high sampling rate over ~12 hours
~11 continuous segments separated by 30-40 minute gaps (sensor goes offline periodically)
...
Advice
1
vote
4
replies
80
views
How can I train an AI model to extract Arabic and French text from PDFs?
I want to train my own AI model that can extract text from PDF files, specifically supporting both Arabic and French languages.
Does anyone have suggestions on how I can start this project or which ...
-4
votes
0
answers
81
views
Speak fn issue, Python [closed]
import speech_recognition as sr
import webbrowser
import pyttsx3
import musicLabrary
recognizer = sr.Recognizer()
engine = pyttsx3.init('sapi5')
def speak(text):
engine.say(text)
engine....
Advice
0
votes
4
replies
67
views
ai agentic engineer path
Goal:
I want to become a highly skilled AI Agentic Engineer and build real-world, impactful systems.
Current Situation:
I am actively learning and building projects
I am consistent and genuinely ...
-1
votes
1
answer
41
views
How to do a multiline merge-request-description from the commandline
I'm working on a script to create an MR (merge-request) from the command-line.
I already came across this issue, which led me to these docs.
I'm running this in python via subprocess, scince this is ...
Tooling
0
votes
8
replies
64
views
What is the easiest way to convert nested JSON to Python dataclasses automatically?
I'm working with complex nested JSON responses from an API and want to convert them into strongly-typed Python dataclasses for better code completion and type safety.
Currently, I'm manually creating ...
1
vote
2
answers
72
views
Missing minus signs in symlog scale
I have the following plot, using a symmetric log scale:
from matplotlib import pyplot as plt
from matplotlib import ticker
(_, ax) = plt.subplots()
ax.plot([-100, -1, -0.5, 0, 0.5, 1, 100], marker='o')...
-1
votes
1
answer
73
views
Tkinter Splash Screen Load Button Scope Issues
I am trying to make a splash screen with 2 buttons that either Load an old project or Start a new one. I am having trouble adding command functions to the "New" and "Load" buttons ...
0
votes
0
answers
35
views
How to read custom extras / user data from a GLB file using pythonOCC
I'm exporting a 3D model to GLB format using pythonOCC. During export, I store custom metadata on each face using TDataStd_NamedData:
...
user_data = TDataStd_NamedData.Set(some_shape_label)
user_data....
2
votes
3
answers
125
views
Rotating NumPy indices to produce a rotated image works only in two of four segments
I'm working on a Python program that calculates images by some function frame by frame to create a video.
Sometimes images need to be rotated (without cropping them). First, I rotated images as ...
Advice
0
votes
0
replies
53
views
Solving maximal set packing using OrTools in Python
I have a list of sets which I need to group into pairwise disjoint
families. I know this is a set packing problem akin to the maximum
independent set and thus NP-hard. One way to solve it is to ...
Best practices
0
votes
2
replies
48
views
OCR output contains “garbage” characters after special symbols (mojibake / control chars) — how to reliably clean before returning from LLM?
I have an on-prem OCR pipeline that returns extracted text inside a JSON blob. I parse the LLM response and call a local normalizer before returning the text to callers. Example call site:
result = ...