2,207,067 questions
1
vote
1
answer
28
views
Pytorch engine saves the batch size : how do I save the model in a way allowing me to input one image at a time?
I'm using pytorch ignite to be able to get metrics easily, so I'm using their checkpoint system to save my model.
I want to be able to test one image at a time for a user interface, but when I try to ...
0
votes
0
answers
35
views
Extracting 7zip archives within flatpak using py7zr
I am currently developing a linux mod manager, and I am having major issues trying to extract 7z archives from within the flatpak.
There is a library called "py7zr" available but I simply ...
Advice
0
votes
0
replies
26
views
How to minimize mdf file size, created in python using asammdf
Hello I'm looking for advice/best practice how to minimize the size of an mdf file created using python/ asammdf.
I have an MDF file created by a data logger and file size is 2.4MB. It contains time ...
0
votes
1
answer
77
views
Extracting information from dictionaries in pandas
Say I have a dataframe of the following form
import pandas as pd
d1 = str([{"Alice": "1/2"}, {"Bob": "3/11"}, {"Charlotte": "5/2"}])
d2 = ...
0
votes
2
answers
65
views
Pygame performance troubleshooting [duplicate]
I've been making this frogger clone in PyGame. So far I have created my own pixel art, implemented a tilemap and a couple sprites. The issue is performance, when having my car sprite move across the ...
Advice
0
votes
2
replies
66
views
Python mandelbrot set iteration slider
I've got a class project to do, it's supposed to display the mandelbrot set with a customizable colour map and a max_iter slider. I've got the colour map radio buttons working, but I can't manage the ...
1
vote
0
answers
61
views
Let CMake use the default Python of your $PATH
tl;dr: How to set up cmake's Python locator, so that it uses the first python3 in $PATH?
I am involved in a software project, which should be buildable with different cmake versions form different ...
Advice
0
votes
4
replies
75
views
Anomaly detection
I want to start my job in industry and I need to learn more about the ML for anomaly detection! As I want to stay up to dated could you please introduce some useful websites or documentations that can ...
Advice
0
votes
1
replies
51
views
Character-level BPE
This is probably a stupid question, but.
I'm building a character-level BPE algorithm for use in a Language Model. I am training it on 10k articles I got from Wikipedia Dump, the code used to get the ...
-8
votes
1
answer
137
views
How do I use __str__ and __repr__ correctly in python tkinter? [closed]
I'm having trouble to implement __str__ in my tkinter application. Can somebody please help me?
-1
votes
0
answers
26
views
"TypeError: object.__init__() takes exactly one argument" when inheriting builtin types [duplicate]
I am trying to implement a type that inherits the built-in float type:
class Percent(float):
def __init__(self, x):
super().__init__(x / 100)
print(float(Percent(12)))
# I want 0.12
...
Best practices
0
votes
1
replies
36
views
Appium Android: How to scroll down only (prevent scrolling up) to find an alement
I'm new to Appium automation on Android and running into a scrolling performance issue.
My current code:
python
driver.find_element(
AppiumBy.ANDROID_UIAUTOMATOR,
'new UiScrollable(new ...
Advice
1
vote
5
replies
66
views
How to Verify WordPress Password Hash in Python/Django?
I have a WordPress database that I am accessing from a Django site. I'd like to be able to log users in with their WordPress passwords. Is there a good way to do this in Python? I have tried these ...
0
votes
0
answers
34
views
DES - Salabim - Animation interaction with animation time
I'm trying to run a DES simulation in python with Salabim, and would like to make it interactive with buttons that change simulation behavior.
Currently I can make changes to resource levels while the ...
-1
votes
0
answers
59
views
How do I tell Claude Code about my Hatch environment?
I tend to prefer Hatch as my Python environment manager. The one challenge with Hatch is that it keeps its per-project virtual environments in a non-obvious system directory. Working standalone, I'...
1
vote
2
answers
148
views
How to type a decorator as a callable on Python
I want to type a decorator, that is a callable that returns a callable.
I want to type this on a way that validate at the moment of decoration that the args and returns type are correct, but also ...
Advice
0
votes
6
replies
126
views
How to create a dynamic todo list app using Flask, SQL, CSS, JavaScript, HTML, in Pycharm
I'm trying to create a specific to-do list that has the Google keep kind of tick boxes, but I want to create it with Flask so I can store it with the current price of the written list in the database, ...
-6
votes
0
answers
51
views
Speech To Text Model Recommendation [closed]
Hi I have developing a real time speech to text. But i can't found a better real time stt model. I have tried whisper, microsoft vibevoice etc... But unable to cover the 100%. Could you please suggest ...
-5
votes
3
answers
154
views
How can I remove unnecessary layers from a nested array? [closed]
I have a "deeply nested" NumPy array like this:
array = [
[
[
[ "data . . . "],
]
],
[
...
2
votes
2
answers
95
views
FastAPI response model for env-dependent variable return type
_Item = TypeVar("_Item", BaseItem)
@app.get(path="items")
def get_items() -> list[_Item]:
return _get_items()
Pylance complains:
TypeVar "_Item" appears only ...
Best practices
0
votes
2
replies
64
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
1
vote
0
replies
72
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 ...
-2
votes
2
answers
141
views
Why does this work on windows but not mac? [closed]
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
3
replies
45
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
45
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
2
replies
81
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
48
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
49
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
91
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 ...
0
votes
1
answer
47
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
1
vote
9
replies
124
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
127
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
67
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
76
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
64
views
Streamlit is not rendering markdown properly [closed]
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
67
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
87
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 ...
Advice
1
vote
5
replies
109
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
108
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 ...
1
vote
1
answer
59
views
Polars expr: rolling_mean with chained .over() yields inconsistent results compared to step-by-step execution, while sum works fine
I found that in Polars, when using a single expression with multiple chained .over() calls, rolling_mean behaves differently from sum.
The following expression returns all null (expected non-null ...
2
votes
1
answer
130
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
180
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
110
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
1
answer
113
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 ...
-1
votes
0
answers
82
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
81
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
110
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
217
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
52
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&...