33 questions from the last 1 days
-5
votes
0
answers
39
views
Unexpected regex behavior [closed]
re.search(
r"(\d{1,4}[^\d:]{1,2}\d{1,4}[^\d:]{1,2}\d{1,4} | \w{3,10}.{,6}\d{4})",
'abc2024-07-08'
)
Why does this regex extract the second pattern, "abc2024", not "...
0
votes
0
answers
21
views
Noiseless Gausian Proces regression not crossing the training points
I'm trying to perform a Gaussian Process Regression on the following series of data points (X and Y):
X Y
0.00001 -6.8200000000000003
0.00014 -6.8073846153846160
0.00042 -6.6818333333333326
...
-5
votes
0
answers
40
views
How should I approach my CSV cleaning project for my OCBC bank statements? [closed]
I am new to programming, and I am trying to start a project on cleaning my CSV file into different formats that I want. How should I go about doing that, and what resources can I use to do it?
0
votes
1
answer
43
views
How to Create a Pandas Dataframe from JSON Nested Objects
I'm trying to create a Pandas DataFrame from a JSON file that looks like this:
{
"GameID": "1,218,463,841",
"Date - Start": "1761097369",
"Date - End&...
-2
votes
0
answers
79
views
How'd you make algorithm that'll find shortest way to sort sequence of numbers just by applying function f(x) that will make x to closest lower prime? [closed]
Imagine you get sequence of integers:
[a1 a2 a3 ... an]
where:
1 <= a <= 10^6
1 <= n <= 10^6
You are given a function f(x) that can change a number to the closest lower prime number, or ...
Best practices
0
votes
3
replies
64
views
Searching through Unicode text with an ASCII keyboard in Python
I have a corpus of text which includes some accented words, such as épée, and I would like people to be able to easily search through it using an ASCII keyboard. Ideally, they would simply type ...
0
votes
2
answers
54
views
pytorch Module B=A, A.to('cpu'), but the tensor in B is still in GPU, why?
After converting module A to CPU, the origin parameter tensor still stays on the GPU? When it is released? Is it wrong if I reuse the parameter?
My code:
import torch.nn as nn
class A(nn.Module):
...
Advice
2
votes
2
replies
42
views
Chapel-Python interopability - export records (or interface with Python dataclasses)
I have the following use case. My main program is written in Python, and I want to accelerate some parts of it. The Python program makes use of dataclasses (~structures) to store parameters, arrays, ...
1
vote
0
answers
61
views
Running a tool with uvx from a private repo using an access token
I want to frequently test a Python application I'm developing with uv, which I publish to a private repository on a GitLab instance. I've generated an access token with read access to the repo and I ...
Advice
1
vote
3
replies
44
views
Python library recommendation for the implementation of a neural network modification algorithm
I want to implement in python some algorithms from a paper that allow for a pre-trained neural network to be modified (adding or removing neurons or layers) conserving (theoretically) the outputs of ...
Advice
0
votes
6
replies
77
views
How to import an editable package?
I've installed a package from a cloned repository, in "editable" mode (pip install -e .). I can't import the package in a script in the virtual environment where the package in installed (...
1
vote
0
answers
45
views
Detecting human presence in a WhatsApp chat to pause a chatbot (Python)
I'm developing a WhatsApp chatbot in Python and want to implement a human handover feature. The goal is to temporarily pause the bot's automated responses when a human administrator opens the chat to ...
-2
votes
0
answers
36
views
What is the recommended way to extend Python modules with custom functionality without modifying source code? [closed]
I maintain a large scientific Python application that uses several third-party modules like PyQtGraph (for plotting) and PyMeasure (for instrument control). I frequently need to add small custom ...
0
votes
0
answers
25
views
Error throwing while building opencv with gstreamer support
I am trying to build opencv from source to enable GStreamer support. I have followed this instructions here, but an error occurred. More specifically, the error occurred in this step:
make -j$(nproc)
...
-3
votes
0
answers
24
views
Why does VS Code sometimes say "trust this notebook" [duplicate]
I'm new to coding. I'm in VS Code, working with geopandas, leaflet, etc. I'm using the .explore() method to show interactive maps. Sometimes, after I run the .explore() method, the output tells me I ...
0
votes
0
answers
24
views
How to replace a Twine upload with uv publish?
We have an internal tool that was distributed simply by users cloning the git repository. The purpose of the tool is to configure newly created virtual machines for later testing our "real" ...
Advice
0
votes
0
replies
13
views
How do I list all tags for a Docker image in a private registry using existing Docker CLI credentials
Similar to How can I list all tags for a Docker image on a remote registry? but I am asking specifically how to do it using existing Docker credentials (i.e. I already did docker login private.repo)
...