2,211,838 questions
0
votes
0
answers
7
views
How to select python interpreter for .ipynb file while using uv for python environment creation?
For test.ipynb file i am trying to select the python environment for kernel. However my environment created from uv is not being displayed as an option and upon trying to manually paste the path is ...
0
votes
0
answers
16
views
Equivalent to Case when (SQL) in Python
I have a simple question relating to creating 'case when' SQL equivalent in Python.
I have a list of twitter statements from which I need to extract and categorize windows version in new column.
...
0
votes
0
answers
16
views
Continue colour flow to 3rd strand of a sankey diagram
I have created this code for a sankey diagram, but I can't get the colours to flow through the middle to the right side. The left side has distinguished fuel types and the right side has combinations ...
1
vote
2
answers
27
views
AttributeError: Messagebox can't take multiple attributes?
I tried to add multiple attributes to a messagebox in my program:
from Tkinter import *
from Tkinter import messagebox as msgbox
*some code...*
input1 = msgbox.askyesno.showwarning('title', '...
-3
votes
0
answers
25
views
YouTube video download fails due to bot detection — issue with Y2Mate pytube or yt-dlp [closed]
I'm developing a YouTube downloader web tool similar to Y2Mate, and recently started facing issues where YouTube blocks or detects the script as a bot when trying to download videos.
The flow is:
User ...
1
vote
1
answer
34
views
NumPy array assignment gives different result from direct computation despite identical formula - floating-point issue?
Problem Description
I'm performing linear interpolation between two arrays x1 and x2 using weights i/N. The calculation is mathematically simple:
x[i] = (1 - i/N) * x1[i] + (i/N) * x2[i]
However, ...
1
vote
2
answers
34
views
How to await messages and not affect the main event loop?
I am writing a simple websocket script which registers & unregisters clients and then broadcasts random messages to them in a interval of 5s.
This is the code:
import asyncio, websockets, random, ...
-3
votes
1
answer
37
views
I want to write a simple python code for sliding window (3) of a list of numbers [closed]
I am trying the below python code
lst = [1,2,3,4,5,6,7,8]
lst2=[]
def sliding_window(elements, window_size):
for i in range(len(elements)):
a= lst[i]+lst[i+1]+lst[i+2]+lst[i+3]+lst[i+4]
...
-2
votes
0
answers
40
views
Python code problem in Visual Studio with joblib library [closed]
I have a problem, the solution to which is not on the Internet. After painstakingly recalculating all combinations at a certain point this error pops up regardless of n _jobs. I am attaching the code ...
-3
votes
0
answers
40
views
The most efficient way in Python to test if an element belongs to certain category [closed]
So I have a loop in Python and I want to test if elements belong to some category:
for element in some_iterator():
if element in collection:
do_something()
Question: what should be the ...
0
votes
0
answers
14
views
`make_scorer(needs_sample_weight=True)` wrongly injects `needs_sample_weight` into the scoring function
When using make_scorer(..., needs_sample_weight=True), the generated scorer unexpectedly passes needs_sample_weight=True as a keyword argument to the scoring function itself, leading to TypeError.
...
0
votes
0
answers
29
views
How can I change the language of a QFileDialog to French in a PySide6 project?
I'm working on a PySide6 project and I'm trying to change the interface language to French. While I've managed to translate most of my application, the QFileDialog widget stubbornly remains in English ...
-1
votes
1
answer
29
views
ImportError: cannot import name 'executor' from 'aiogram.utils'
Before I tried to reinstall pip and I also tried to import executor this way
from aiogram.utils import executor but I still have ImportError.
from aiogram import Bot, Dispatcher, types
from aiogram....
2
votes
2
answers
56
views
2 Laser beams number of intersections in a mirror problem
I've got an algorithmic problem that I've not been able to solve. Would appreciate any help with this
The main problem:
Two laser beams, blue and red color, are shot into a mirror and bounces around. ...
-4
votes
0
answers
35
views
Emotion detection from Facial Expression [closed]
I’m working on a facial expression-based emotion detection project using images collected from different datasets. The challenge I'm facing is that the images have different resolutions, such as:
...