2,207,884
questions
1
vote
0
answers
5
views
Streamlit (python) App button issue: Showing Previous Number After Button Click Instead of New Random Number
I'm building a simple Streamlit app as a demonstration of a larger project I'm working on. The goal is to display a random number between 0-100 and let the user select whether they "like" ...
2
votes
1
answer
12
views
Why do class methods shadowing names from outer scope in python class method type hints?
For example:
In [4]: In [17]: class X:
...: def not_shadow(self, x: list[int]):
...: pass
...:
...: def list(self):
...: list()
...:
...: def ...
0
votes
0
answers
16
views
Merge intervals based on condition
This is the classical approach to merge intervals:
def merge(intervals: List[List[int]]) -> List[List[int]]:
result = []
intervals.sort()
prev_interval = intervals[0]
for ...
0
votes
0
answers
2
views
Issue with creating a custom layer in Tensorflow
When I try to create a simple implementation of a custom layer in Tensorflow I get the error:
File /opt/anaconda3/lib/python3.11/site-packages/tensorflow/python/util/lazy_loader.py:178 in __getattr__
...
1
vote
0
answers
6
views
Getting the model source from loaded Pytorch pt2 file
I am trying to debug a pytorch model that has been pretrained and exported as a .pt2 file but I only have access to the inference code that loads the model.
Is there any way to recover the class file ...
0
votes
1
answer
16
views
Change the horizantal axis crosses in a python bar chart
I apologize if this is an easy and simple question that has already been answered. I have some data I am trying to chart as a clustered bar graph using a pandas dataframe in python and so far it has ...
0
votes
0
answers
8
views
CTkComboBox Dropdown Closes Immediately for Large Lists
I'm using CustomTkinter to create a GUI in Python, and I'm facing an issue with the CTkComboBox widget. When I populate the ComboBox with a large list of items, the dropdown menu shows the options, ...
-3
votes
0
answers
11
views
I am remaking Roblox in Python what should i add to it? [closed]
The Name of it its Pyblox and its in Development it will have online but How do i make Players show in a server and what i'll add to it. Welp i Tried Adding some stuff but didnt go Well anything you ...
0
votes
0
answers
19
views
I have SVG file contain a normal rectangle
I have SVG file containing a normal rectangle
<polygon id="REC1" class="cls-1" points="227.02 .25 141.98 .25 141.98 385 227.02 385 227.02 .25"/>
my question is how ...
0
votes
0
answers
10
views
How to best link back predictions to the original observations of a test set using Pandas and sklearn?
I have data in the form below:
target
feature1
feature 2
feature3
field 1
field 2
field 3
I'm modeling using lasso regression in sklearn.linear_model. Field 1 through Field 3 are dropped before ...
3
votes
1
answer
18
views
Why does `ismethod` return False for a method when accessed via the class?
Define a simple method:
class Foo:
def bar(self):
print('bar!')
Now use inspect.ismethod:
>>> from inspect import ismethod
>>> ismethod(Foo.bar)
False
Why is this? Isn'...
1
vote
0
answers
13
views
ftp nlst command runs in Python, but not in Windows Command Line
I have exposed an API via python that connects to my ftp server via ftplib:
from ftplib import FTP
@app.route('/api/ftp/list', methods=['GET'])
def ftp_list():
remote_dir = request.args.get('...
0
votes
1
answer
16
views
Selenium headless broke after Chrome update
After updating google chrome this weekend, headless mode using Selenium python API is bringing up a blank window when running in windows. The identical code I had running on a Debian VM does not work ...
0
votes
0
answers
8
views
function to deduplicate data using pyspark partition, windowing and row by coalescing resulting in dropped rows of single element partition
I am trying to deduplicate a dataset based on partitions on a specific key, within that partition I want to take the most recent non-null values of all the other rows. There are a lot of columns so ...
1
vote
1
answer
36
views
Does numpy implement indexed choice function
Here is an indexed choice function
def np_ifelse(
x: np.ndarray[float] | float,
ind: bool | np.ndarray[bool],
v1: float,
v2: float
) -> float | np.ndarray[float]:
if isinstance(...