QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,700,997 | 1,044,422 | How to generate a hierarchical colourmap in matplotlib? | <p>I have a hierarchical dataset that I wish to visualise in this manner. I've been able to construct a heatmap for it.</p>
<p><a href="https://i.sstatic.net/QsIlavSn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QsIlavSn.png" alt="enter image description here" /></a></p>
<p>I want to generate a colorm... | <python><pandas><matplotlib><seaborn> | 2024-07-03 08:53:11 | 1 | 1,845 | K G |
78,700,714 | 10,377,244 | Polars - groupby mean on list | <p>I want to make mean on groups of embeddings vectors.
For examples:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
pl.DataFrame({
"id": [1,1 ,2,2],
"values": [
[1,1,1], [3, 3, 3],
[1,1,1], [2, 2, 2]
]
})
</code></pre>
<pre><code>shape: (4, 2)
i... | <python><dataframe><python-polars> | 2024-07-03 07:50:35 | 1 | 1,127 | MPA |
78,700,332 | 7,699,611 | Tuple matching using SQLAlchemy | <p>Let's say I have a db of Customers. I want to fetch data and filter rows by exact pairs.</p>
<p>I want to do the following using sqlalchemy:</p>
<pre><code>SELECT first_name, age
FROM Customers
WHERE (first_name, age) in (('John', '31'),('Robert', '22'));
</code></pre>
<p>I know I can do this:</p>
<pre><code>
SELECT... | <python><sql><sqlalchemy><tuples> | 2024-07-03 06:09:13 | 1 | 939 | Muslimbek Abduganiev |
78,700,325 | 937,440 | Search for currency pairs using Pandas | <p>I am trying to learn more about Python. Please see the code below:</p>
<pre><code>import pandas as pd
df = pd.read_html("https://finance.yahoo.com/crypto?offset=0&count=25")[0]
symbols = df.Symbol.tolist()
test=len(symbols)
for symbol in symbols:
print(symbol)
</code></pre>
<p>The query string has... | <python><python-3.x><yahoo-finance><yfinance> | 2024-07-03 06:06:46 | 1 | 15,967 | w0051977 |
78,699,964 | 660,391 | How can one combine iterables keeping only the first element with each index? | <p>Let's say I have a number of iterables:</p>
<pre><code>[[1, 2], [3, 4, 5, 6], [7, 8, 9], [10, 11, 12, 13, 14]]
</code></pre>
<p>How can I get only each element that is the first to appear at its index in any of the iterables? In this case:</p>
<pre><code>[1, 2, 5, 6, 14]
</code></pre>
<p>Visualized:</p>
<pre><code>[... | <python><iterable> | 2024-07-03 03:32:29 | 7 | 332 | qulinxao |
78,699,894 | 6,141,238 | When using matplotlib, how can I make each figure always plot in the same location on the screen? | <p>I have a Python script that plots 3 figures using matplotlib. When I run this script, and then close the 3 figures and rerun it, the figures appear in different locations on my screen in the second run compared to the first run.</p>
<p>(For example, in the first run, the first figure might be positioned near the up... | <python><matplotlib><plot><window><figure> | 2024-07-03 02:48:35 | 1 | 427 | SapereAude |
78,699,832 | 315,820 | Get user response as speech-to-text in Twilio | <p>I am exploring Twilio programmable voice for the first time, and can't find how to get user speech input as text.</p>
<p>TwiML Gather with the speech input</p>
<pre><code> gather: Gather = Gather(
input="speech",
action=process_response_url,
action_on_empty_result=process_respons... | <python><twilio><speech-to-text><twilio-twiml> | 2024-07-03 02:10:14 | 1 | 1,657 | jprusakova |
78,699,793 | 9,744,061 | Animation for plotting y=omega*x^2 with omega varying from -3 to 3 | <p>I want to plot y = omega*x^2 with omega varying from -3 to 3 with a step size of 0.25 (and x spanning -4 to 4 with a step size of 0.001). The current version of my code (below) only has omega start at 0 and not -3. How do I adjust my code to get omega to vary over the range I want?</p>
<pre><code>import numpy as np
... | <python><matplotlib><animation><matplotlib-animation> | 2024-07-03 01:58:01 | 1 | 305 | Ongky Denny Wijaya |
78,699,760 | 4,451,521 | Error with Tokenizer parallelism when using gradio and mlflow | <p>I have written a script using gradio and sometimes (I emphasize this- only sometimes) when I run it I get</p>
<pre><code>huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avo... | <python><mlflow><gradio> | 2024-07-03 01:36:16 | 0 | 10,576 | KansaiRobot |
78,699,674 | 10,616,752 | NVD Error: Invalid API key since NIST CVSS v4.0 changes | <p>I have a process that uses the NVD API to pull down vulnerability data. It has worked fine for years.</p>
<p>Suddenly, I get periodic errors in the log, e.g. :</p>
<pre><code>Downloaded 6000 CVEs.
Process finished at 2024-07-02 11:02:55
Total duration: 173.34 seconds
Downloaded 8000 CVEs.
Error: Invalid API key
Proc... | <python><security><cve> | 2024-07-03 00:34:48 | 2 | 546 | Scouse_Bob |
78,699,642 | 298,171 | How to inspect Python file/module information without using `__file__` — perhaps in a module-level `__getattr__(…)` function? | <p>I have a utility package for Python projects I maintain and use. It’s a bundle of lightweight, common, junk-drawer tools (e.g. command parsing, app lifecycle management, document generation, &c &c). Currently, using this stuff is all very simple in one’s own project, but most modules written to work with it ... | <python><python-3.x><python-module><introspection><python-internals> | 2024-07-03 00:13:01 | 0 | 4,435 | fish2000 |
78,699,612 | 20,122,390 | How does Socket.IO work internally with AsyncRedisManager? | <p>I have an application that uses Socket.io to implement websockets and is configured with Redis. The server side is written in Python, so I have something like this:</p>
<pre><code>REDIS = f"redis://{settings.REDIS_USER}:{settings.REDIS_PASSWORD}@{settings.REDIS_HOST}:{settings.REDIS_PORT}/0"
mgr = AsyncRe... | <python><redis><socket.io> | 2024-07-02 23:54:44 | 0 | 988 | Diego L |
78,699,598 | 9,074,679 | Gunicorn: ModuleNotFoundError: No module named 'server' | <p>I am trying to deploy my Flask app (to <a href="https://railway.app/" rel="nofollow noreferrer">https://railway.app/</a>).</p>
<p>My project structure looks like this:</p>
<pre><code>myproject/server
├── Procfile
├── __init__.py
├── app.py
├── requirements.txt
├── sources
│ ├── __init__.py
│ ├── integrations
│ ... | <python><flask><gunicorn> | 2024-07-02 23:47:26 | 0 | 525 | Marco |
78,699,562 | 4,268,602 | jsonschema installed through poetry cannot import own validate submodule | <p>I have jsonschema installed through poetry.</p>
<p>When I attempt to use it, I get the following error:</p>
<pre><code>Traceback (most recent call last):
File "/Users/danielbak/hw-sys-measurements-logging/hw_sys_measurements_logging/data_log.py", line 5, in <module>
from jsonschema import valid... | <python><jsonschema><python-poetry> | 2024-07-02 23:24:50 | 0 | 4,156 | Daniel Paczuski Bak |
78,699,498 | 22,407,544 | Why is my Django app unable to find my URL pattern? | <p>My Django project is run in Docker and I use Celery to handle queuing. When a user submits an audio file the system starts an asynchronous task(that transcribes the audio), continuously checks its progress, and updates the UI once the transcription is complete, with a download button. However I've been getting an er... | <python><django><docker><celery> | 2024-07-02 22:50:51 | 0 | 359 | tthheemmaannii |
78,699,493 | 2,612,259 | What is the Pythonic way to use match/case statements with classes that only provide getter methods and computed value methods? | <p>I have several classes that I don't own. These classes provide <em>methods</em> to access internal information, rather than attributes or properties.</p>
<p>For example a class might look something like this:</p>
<pre class="lang-py prettyprint-override"><code>class Foo:
def __init__(self, a, b) -> None:
se... | <python> | 2024-07-02 22:49:21 | 3 | 16,822 | nPn |
78,699,293 | 3,486,684 | Efficiently convert Polars string column into struct containing integer then unnest | <p>Consider the following toy example:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
xs = pl.DataFrame(
[
pl.Series(
"date",
["2024 Jan", "2024 Feb", "2024 Jan", "2024 Jan"],
dtype=pl.String,
... | <python><dataframe><python-polars> | 2024-07-02 21:24:48 | 1 | 4,654 | bzm3r |
78,699,268 | 1,036,396 | Settings REST_FRAMEWORK error DEFAULT_SCHEMA_CLASS configuration | <p>I'm following along <a href="https://blog.logrocket.com/django-rest-framework-create-api/" rel="nofollow noreferrer">this tutorial</a>. I added the "REST_FRAMEWORK" object how they describe in settings.py</p>
<pre><code>REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.... | <python><django-rest-framework> | 2024-07-02 21:17:04 | 1 | 564 | Jason Spence |
78,699,259 | 14,345,989 | Sklearn NMF match input category order | <p>I'm using Non-Negative Matrix Factorization (NMF) in sklearn for unsupervised category prediction (with labels for checking accuracy), but am running into the problem where I don't have a clear map between input categories and transformed categories.</p>
<p>For example, if my categories are "A", "B&qu... | <python><scikit-learn><matrix-factorization> | 2024-07-02 21:13:31 | 1 | 886 | Mandias |
78,699,230 | 14,250,641 | How to save single Random Forest model with cross validation? | <p>I am using 10 fold cross validation, trying to predict binary labels (Y) based on the embedding inputs (X).
I want to save one of the models (perhaps the one with the highest ROC AUC). I'm not sure how to do it because the ROC AUCs are not stored and I don't know how to grab accordingly.</p>
<pre><code>X = np.array(... | <python><pandas><numpy><scikit-learn><cross-validation> | 2024-07-02 21:02:25 | 1 | 514 | youtube |
78,699,135 | 4,200,910 | Github API - How to add a repository to a team, with a particular role? | <p>I want to use Github's rest API to add a repository to a team within my organization, and add it as the admin role on said repo.</p>
<p>Now I've obviously checked <a href="https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions" rel="nofollow noreferrer">github's d... | <python><github><python-requests><github-api> | 2024-07-02 20:34:11 | 1 | 435 | Whitewind617 |
78,699,064 | 6,141,238 | When using matplotlib, how do I set the on-screen lengths of the x and y axes to be equal without changing the limits of either axis? | <p>I would like to make the axes of a matplotlib plot a square, and do so by stretching or compressing the scaling of the axes rather than by changing the axis limits. How can this be done?</p>
<p>(In other words, I am seeking a Python analog of the MATLAB command <code>axis square</code>.)</p>
<p>So far, I have tried... | <python><matplotlib><axis> | 2024-07-02 20:09:40 | 1 | 427 | SapereAude |
78,698,933 | 6,622,697 | How to validate Post arguments in Django | <p>I've seen plenty of solutions on how to validate Form field parameters, but I am not using Django templates or implementing the front-end in Django at all. I'm looking purely for server-side backend validation. Let's say I have</p>
<pre><code>@api_view(['POST'])
def my_func(request):
</code></pre>
<p>And I want t... | <python><django><validation><django-views> | 2024-07-02 19:30:18 | 1 | 1,348 | Peter Kronenberg |
78,698,840 | 2,153,235 | Get the DPI for a PyPlot figure | <p>At least in Spyder, the PyPlot plots can be low resolution, e.g., from:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
# import seaborn as sns
rng = np.random.default_rng(1)
scat = plt.scatter( *rng.integers( 10, size=(2,10) ) )
</code></pre>
<p>My web surfing has brought me to a suggested solutio... | <python><matplotlib> | 2024-07-02 19:06:34 | 1 | 1,265 | user2153235 |
78,698,804 | 14,259,505 | How to recognize an audio when i provide a list of more than 4 language in azure using recognize_once()? | <p>Azure Speech SDK has a limitation where it only supports detecting up to 4 languages simultaneously in the "DetectAudioAtStart" mode. To work around this limitation, I create batches of 4 languages from the languages_to_detect list and attempt to detect the language for each batch.But it is not able to rec... | <python><azure><speech-recognition><azure-cognitive-services><azure-speech> | 2024-07-02 18:54:42 | 1 | 391 | Yogesh Govindan |
78,698,733 | 6,622,697 | How do I get csrfToken for front-end to submit logins using Django? | <p>I've read all the issues about this, but it's still not clear to me.</p>
<p>I am not using Django templates with Django Rest Framework to handle login functions (login, logout, changepassword, create user, etc).</p>
<p>I tried POSTing to the <code>accounts/login</code> page with</p>
<pre><code>"username": ... | <python><django><django-rest-framework><django-csrf> | 2024-07-02 18:33:27 | 1 | 1,348 | Peter Kronenberg |
78,698,418 | 9,744,061 | Make animation using Python but give me an error, animation can't appear | <p>I want to plot animation of y=omega*x^2, which omega is -3 into 3 with step size 0.25, x from -4 into 4 with step size 0.001. I'm new studying plot animation in Python.
I try to make a code but give me an error as follows and no animation appear.</p>
<pre><code>UserWarning: Animation was deleted without rendering an... | <python><matplotlib><animation><plot><matplotlib-animation> | 2024-07-02 17:08:04 | 1 | 305 | Ongky Denny Wijaya |
78,698,334 | 3,366,355 | There's no Build available in Visual Studio 10 for Python code | <p>I need a custom script to run Shiv and package my python code. I know there are Build > Events that i can use to to run a PreBuild script, but this isn't available for Python, and it looks like the Build doesn't show anything useful either, is there any workaround for this?</p>
<p><a href="https://i.sstatic.net/C... | <python><visual-studio> | 2024-07-02 16:45:04 | 1 | 1,032 | martin |
78,698,202 | 2,862,945 | Rotating a vector field in an efficient way in python | <p>I need to rotate a 3D vector field by 90 degrees. I do that by first using the NumPy function <code>rot90</code> (see the <a href="https://numpy.org/doc/stable/reference/generated/numpy.rot90.html" rel="nofollow noreferrer">docs here</a>). Then I rotate each component at each position in a very inefficient way: usin... | <python><numpy><matrix><rotation><linear-algebra> | 2024-07-02 16:08:52 | 2 | 2,029 | Alf |
78,698,175 | 769,933 | compute intensive function with multiple outputs applied elementwise to polars Array column, use iter_slices? | <p>I need to apply a compute intensive function, mainly consisting of calls to numpy functions, to a column of a polars DataFrame that has the <code>pl.Array(...)</code> datatype. In need a streaming method, as my actual data is regularly larger than the computer memory. I can do it using <code>iter_slices</code>, crea... | <python><numpy><python-polars> | 2024-07-02 16:02:49 | 0 | 2,396 | gggg |
78,698,115 | 8,565,759 | Plotting multiple dataframes in a single output using Python Bokeh - how to create legends for each plot in a loop? | <p>I am trying to input a single file that contains data from different packet streams (hence, different time values). I created a dataframe for each time and the data points/columns from each dataframe are plotted in single plot. I am not being able to get how to append the items in the legend to reflect the correct c... | <python><pandas><dataframe><plot><bokeh> | 2024-07-02 15:49:59 | 1 | 420 | Brain_overflowed |
78,698,110 | 7,425,756 | Is s.rfind() in Python implemented using iterations in backward direction? | <p>Does rfind iterates over a string from end to start?</p>
<p>I read the docs <a href="https://docs.python.org/3.12/library/stdtypes.html#str.rfind" rel="nofollow noreferrer">https://docs.python.org/3.12/library/stdtypes.html#str.rfind</a> and see</p>
<blockquote>
<p>str.rfind(sub[, start[, end]])</p>
<p>Return the hi... | <python><python-builtins> | 2024-07-02 15:48:22 | 1 | 528 | Alexander Ites |
78,697,972 | 1,575,381 | TypeError: list indices must be integers, not tupl | <p>This is a common question on SO but all the examples I've looked at are fairly complicated. So I am posting the simplest example I can think of to get a straight-forward answer.</p>
<pre><code>x = [(1,2),(3,4),(5,6)]
print(x[0])
(1,2)
print(x[0,1])
TypeError: list indices must be integers or slices, not tuple
</... | <python><list><nested> | 2024-07-02 15:20:03 | 1 | 431 | someguyinafloppyhat |
78,697,965 | 1,422,096 | Write a lossless-compressed image with multiple layers | <p>How to save an image, losslessly compressed, with multiple layers (like with Photoshop PSD but rather an open format), with OpenCV <code>cv2</code> or <code>PIL</code>/<code>Pillow</code> ?</p>
<p>Note: Is seems that TIFF format can do this (see <a href="https://graphicdesign.stackexchange.com/questions/35424/is-it-... | <python><opencv><python-imaging-library><compression><image-compression> | 2024-07-02 15:18:07 | 1 | 47,388 | Basj |
78,697,903 | 2,326,627 | MonkeyPatching python submodule | <p>I want to <a href="https://en.wikipedia.org/wiki/Monkey_patch" rel="nofollow noreferrer">monkey patch</a> an external code base to check alternative versions of the same function.</p>
<p>At the moment, the project tree looks like this</p>
<pre class="lang-bash prettyprint-override"><code>.
├── mymodule
│ ├── __ini... | <python><python-3.x><monkeypatching> | 2024-07-02 15:07:57 | 1 | 1,188 | tigerjack |
78,697,859 | 24,191,255 | How to solve complex equations numerically in Python? | <p>Originally, I had the following equation:</p>
<pre><code>2mgv×sin(\alpha) = CdA×\rho(v^2 + v_{wind}^2 + 2vv_{wind}cos(\phi))^(3/2)
</code></pre>
<p>which I could express as the following non-linear equation:</p>
<pre><code>(K × v)^(2/3) = v^2 + v_{wind} + 2vv_{wind}cos(\phi)
</code></pre>
<p>To solve this, I need t... | <python><numerical-methods><equation><equation-solving><fsolve> | 2024-07-02 14:59:50 | 2 | 606 | Márton Horváth |
78,697,835 | 2,748,928 | Deepspeed : AttributeError: 'DummyOptim' object has no attribute 'step' | <p>I want to use deepspeed for training LLMs along with Huggingface Trainer. But when I use deepspeed along with trainer I get error "AttributeError: 'DummyOptim' object has no attribute 'step'". Below is my code</p>
<pre><code>import argparse
import numpy as np
import torch
from datasets import load_dataset... | <python><huggingface-transformers><large-language-model><huggingface-trainer><deepspeed> | 2024-07-02 14:53:33 | 1 | 1,220 | Refinath |
78,697,726 | 10,037,886 | Systematically turn (numpy) 1d-array of size 1 to scalar | <p>I have been scratching my head over this for the last hour.</p>
<p>Imagine I have a function that takes as argument a number, or an array up to dimension 1. I'd like it to return a scalar (not a 0d array) in the former case, and an array of the same shape in the latter case, like ufuncs do.</p>
<p>The current implem... | <python><numpy> | 2024-07-02 14:31:58 | 1 | 427 | Aubergine |
78,697,508 | 13,135,901 | Drop duplicates when querying multiple tables in Django | <p>I have a custom manager with search, which orders return results by rank:</p>
<pre><code>class MyManager(models.Manager):
def search(self, query, fa, fb=None, fc=None, fd=None, qs=None):
if not qs:
qs = self.get_queryset()
try:
if not (1 in [c in query for ... | <python><django> | 2024-07-02 13:52:55 | 1 | 491 | Viktor |
78,697,411 | 4,302,701 | How to kill all the threads in ThreadPools | <p>How can I kill all the threads in ThreadPools(threadpoolexecutor) when one thread finishes?</p>
| <python><python-3.x><threadpool> | 2024-07-02 13:32:11 | 1 | 353 | rao |
78,697,317 | 1,044,422 | How to correctly replace an element in a pd.Dataframe with a list? | <p>I have a simple <code>pandas</code> Dataframe like this:</p>
<pre class="lang-py prettyprint-override"><code>test_df = pd.DataFrame(
{
0: [
"Setup",
"Dissection",
"Specimen Removal",
"Closure",
]
}
)
</cod... | <python><pandas> | 2024-07-02 13:15:24 | 2 | 1,845 | K G |
78,697,300 | 8,284,452 | How to preprocess dataset to assign coordinates before opening with xarray.open_mfdataset? | <p>The xarray documentation for the <code>open_mfdataset</code> function states that you can use the <code>preprocess</code> argument to apply a function to each dataset before concatenation. The NetCDF datasets I have do not have coordinates assigned when you open them one-by-one, so I was attempting to assign them be... | <python><python-xarray><netcdf> | 2024-07-02 13:11:18 | 1 | 686 | MKF |
78,697,270 | 4,451,315 | Get categories of arrow chunkedarray | <p>If I have a PyArrow chunkedarray and want to know all its categories, I can go through each individual array, get the categories from there, and find the union:</p>
<pre><code>import pyarrow as pa
import functools
# setup
one = pa.array(["a", "b", None, "d"], pa.dictionary(pa.int64(), ... | <python><pyarrow> | 2024-07-02 13:04:42 | 1 | 11,062 | ignoring_gravity |
78,697,219 | 3,007,075 | How to apply rolling_map on polars and create two columns? | <p>See the code below, it's a stand-in for what I need. ChatGPT and perplexity aren't helpful here. In practice I can compute col1 and col2 one at a time, but it is unnecessarily slow.</p>
<pre><code>import numpy as np
import polars as pl
def _compute_coef1(series):
y = series[1:]
x = series[:-1]
mean_x =... | <python><python-polars> | 2024-07-02 12:57:00 | 1 | 1,166 | Mefitico |
78,697,191 | 5,431,734 | Tkinter GUI doesn't open from Crontab | <p>I have a Raspberry Pi 4 Model B, and I try to start a very basic Tkinter GUI on reboot.</p>
<pre><code>#!/home/pi/miniforge3/envs/myenv/bin/python
import tkinter as tk
def tk_gui():
root = tk.Tk()
root.geometry("200x200")
label = tk.Label(root, text="Hello")
label.pack(pady=20)
... | <python><tkinter><cron><raspberry-pi4> | 2024-07-02 12:52:23 | 0 | 3,725 | Aenaon |
78,697,177 | 1,826,893 | How to get arguments from ArgParser to write to a textfile so it can be read with `fromfile_prefix_chars` | <p>I want a script to save all arguments (whether provided or populate from defaults or read from a text file) to a text file in such a format that I can re-run the script using <code>fromfile_prefix_chars</code> with that file. This is to allow for easy reproducability and store the arguments that were used to generat... | <python><python-3.x><argparse> | 2024-07-02 12:50:42 | 2 | 1,559 | Edgar H |
78,697,154 | 2,873,337 | Django is randomly ignoring certain days when I try to bulk_create. How do I solve this? How does this even happen? | <p>How does Django randomly skip days when trying to <code>bulk_create</code>? The dataset is a CSV exported via a third party tool from a MSSQL Server.</p>
<p>Exhibit 1 - Data from my database:</p>
<p><a href="https://i.sstatic.net/Ddjz7O74.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ddjz7O74.png" a... | <python><django><pandas> | 2024-07-02 12:46:47 | 0 | 651 | chi11ax |
78,697,067 | 10,590,609 | Airflow decorated task type hinting | <p>Take this simple dag, in which one task takes the output of another:</p>
<pre class="lang-py prettyprint-override"><code>import datetime
from airflow.decorators import dag, task
@task
def task_that_returns_a_string() -> str:
return "a string"
@task
def task_that_takes_a_string(arg: str) -> None... | <python><airflow><python-typing><pyright><airflow-taskflow> | 2024-07-02 12:32:22 | 1 | 332 | Izaak Cornelis |
78,697,037 | 5,462,372 | Unable to install ploty-resampler==0.8.1 | <p>I am facing this typical error while installing <code>ploty-resampler==0.8.1</code> from a downloaded whl file in a server with RHEL 8.9 OS.</p>
<p>I am firing the following command:</p>
<pre><code>pip3 install -v plotly-resampler==0.8.1 --no-index --find-links=./mssuser_package
</code></pre>
<p>Inside the <code>ms... | <python><plotly-resampler> | 2024-07-02 12:27:14 | 2 | 3,683 | MSS |
78,697,015 | 11,628,437 | PyCharm won't let me import from folders cloned from github | <p>I am experiencing a strange error that I don't know how to characterize.</p>
<p>I am trying to import a class from a subfolder, cloned from <code>GitHub</code>. But when I do <code>from Awesome_Python_Games import class_to_import</code>, it says <code>ModuleNotFoundError: No module named 'Awesome_Python_Games'</code... | <python><module><pycharm> | 2024-07-02 12:21:10 | 1 | 1,851 | desert_ranger |
78,696,765 | 3,070,181 | Cannot locate tkinter icon file when using pyinstaller with poetry on Windows10 | <p>I am using <a href="https://stackoverflow.com/a/60945435/3070181">this answer</a> to locate my icon file. My project is organised thus</p>
<pre><code>.
│ main.spec
│ poetry.lock
│ pyproject.toml
│ README.md
│
├───my_app
│ │ pyinstaller.py
│ │ __init__.py
│ │
│ └───src
│ │ main.py
│ ... | <python><windows><tkinter><pyinstaller><python-poetry> | 2024-07-02 11:33:40 | 1 | 3,841 | Psionman |
78,696,707 | 1,285,061 | Django is unable to send email out even though conf is correct | <p>Django is unable to send email out.</p>
<p>But <a href="https://www.smtper.net/" rel="nofollow noreferrer">https://www.smtper.net/</a> was able to send a test email with same exact settings, user, pass.</p>
<p>What do I need do more in django to send email out?</p>
<p>settings.py</p>
<pre><code>## #environment varia... | <python><python-3.x><django><email><django-email> | 2024-07-02 11:23:56 | 1 | 3,201 | Majoris |
78,696,521 | 3,928,295 | import UserDict ModuleNotFoundError: No module named 'UserDict' when running a Flask app with PyJadeExtension | <p>I am upgrading my flask app from python 3.8 to 3.10 as python 3.8 is not going to reach its end of life by October 2024.
While running the <code>app.py</code> file. My code throws an exception at this line.</p>
<pre><code>app = Flask(__name__)
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension') # <-- ... | <python><flask><python-3.10><pyjade> | 2024-07-02 10:41:22 | 0 | 1,804 | Manmohan_singh |
78,696,471 | 511,976 | AWS Glue logs are corrupted | <p>I have an issue with the logs from my AWS Glue jobs being corrupted.</p>
<p>The logs are emitted from Glue Python scripts ad go to CloudWatch. I recently started posting structured JSON logs with AWS EMF, and noticed that the logs were being corrupted. Some log statements in excess of 1024 bytes are split into multi... | <python><logging><aws-glue><amazon-cloudwatchlogs> | 2024-07-02 10:31:08 | 1 | 2,380 | mhvelplund |
78,696,434 | 928,713 | Connection Timeout on External API Call on Server but Works Locally | <p>I have a Django 4.2.2 application running on Python 3.11. One of the views is as follows:</p>
<pre><code>import requests
from django.http import HttpResponse
def get_captcha(request):
response = requests.get(
"https://geoportale.cartografia.agenziaentrate.gov.it/age-inspire/srv/ita/Captcha?type=ima... | <python><django><server><python-requests><url-routing> | 2024-07-02 10:23:54 | 0 | 420 | m.piras |
78,696,343 | 10,746,597 | Read a CSV file with Pandas in Databricks workspace | <p>I've uploaded a notebook on Databricks workspace. The workspace tree looks like this:</p>
<p><a href="https://i.sstatic.net/ovZDi3A4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ovZDi3A4.png" alt="enter image description here" /></a></p>
<p>I want to read a CSV in the data folder using pandas. I'm ... | <python><pandas><databricks> | 2024-07-02 10:06:02 | 3 | 742 | juuso |
78,696,254 | 22,400,527 | How to order migration files across different apps in django? | <p>I am working on a django project. After some time, I wanted to refactor the code. I wanted to create a new app and move some of my models to that app. Here's an example:</p>
<p>Suppose I have an app named <code>CategoryApp</code> and two models in it named <code>Product</code> and <code>Category</code>.</p>
<pre cla... | <python><django><django-migrations> | 2024-07-02 09:48:16 | 1 | 329 | Ashutosh Chapagain |
78,696,115 | 6,618,051 | Get scenario name in pytest_bdd_apply_tag method | <p>In case of <code>@todo</code> tag I need to send a request to Zephyr Scale that the test is skipped.</p>
<pre class="lang-py prettyprint-override"><code>def pytest_bdd_apply_tag(tag, function):
env = os.environ.get(ENV_VARIABLE)
if tag == 'todo':
marker = pytest.mark.skip(reason="Not implemented... | <python><pytest><bdd><pytest-bdd> | 2024-07-02 09:19:08 | 1 | 1,939 | FieryCat |
78,696,026 | 3,190,076 | Jupyter notebook. How to direct the output to a specific cell? | <p>Is there a way to specify the output cell where a function should print its output?</p>
<p>In my specific case, I have some threads running, each with a logger. The logger output is printed on any running cell, interfering with that cell's intended output. Is there a way I can force the logger to print only on <code... | <python><logging><jupyter-notebook> | 2024-07-02 09:05:46 | 2 | 10,889 | alec_djinn |
78,696,011 | 2,886,640 | How can I set all form fields readonly in Odoo 16 depending on a field? | <p>In Odoo 16, I'm trying to make all fields from a form view readonly depending on the value of other field of the same form.</p>
<p>First I've tried the following:</p>
<pre><code><xpath expr="//field" position="attributes">
<attribute name="attrs">{'readonly': [('my_field... | <python><python-3.x><xml><odoo><odoo-16> | 2024-07-02 09:01:38 | 1 | 10,269 | forvas |
78,695,836 | 4,451,521 | In a gradio tab GUI, a button calls the other tab | <p>I have the following script</p>
<pre><code>import gradio as gr
# Define the function for the first tab
def greet(text):
return f"Hello {text}"
# Define the function for the second tab
def farewell(text):
return f"Goodbye {text}"
# Create the interface for the first tab
with gr.Blocks()... | <python><gradio> | 2024-07-02 08:24:53 | 1 | 10,576 | KansaiRobot |
78,695,792 | 5,423,080 | Find local minima of array including the first element of plateau | <p>I refactored a code that finds the indices of local minima of the negative part of an array.</p>
<p>The original code identified as minima also the first element of a flat, but the new code doesn't and I couldn't find a way.</p>
<p>This is a MWE:</p>
<pre><code>import numpy as np
from scipy import signal
test = np.... | <python><scipy> | 2024-07-02 08:16:50 | 0 | 412 | cicciodevoto |
78,695,671 | 14,463,396 | apply function to two pandas columns and assign them back to the original dataframe raises future warning | <p>I have a dataframe with columns for the mean and standard deviation of different distributions of things (along with other columns irrelevant to the question). I need to apply a function to transform these numbers into mu and sigma to pass into a log normal distribution (what this function does is irrelevant to my ... | <python><pandas><dataframe> | 2024-07-02 07:50:36 | 1 | 3,395 | Emi OB |
78,695,616 | 9,348,836 | AttributeError: 'NoneType' object has no attribute 'username' in Flask application | <p>This is my API Endpoint of an Update Route for a particular URL in Flask:</p>
<pre><code># Update Route for a particular trip
@app.route('/trips/<int:trip_id>', methods=['PUT'])
def update_trip(trip_id):
trip = trips.get(trip_id) #query from the database
data = request.get_json()
trip.username... | <python><flask><postman> | 2024-07-02 07:37:38 | 1 | 1,291 | bibashmanjusubedi |
78,695,360 | 3,949,631 | Most space-efficient way of storing large number of large integers | <p>I have a large number of very large integers (in general, larger than <code>unsigned long long</code>), e.g.</p>
<pre><code>976790216313803691633662
213166167
12361374472474414331778521
74143614714316467475274141141343747437542416477224365045416
...
46247285274316436417475827426432634528582016257012061846140147206
7... | <python><numpy><compression><h5py> | 2024-07-02 06:29:21 | 2 | 497 | John |
78,695,350 | 2,049,685 | pyparsing - back to basics | <p>In attempting to put together a very simple example to illustrate an issue I'm having with pyparsing, I have found that I can't get my simple example to work - this example is barely more complex than Hello, World!</p>
<p>Here is my example code:</p>
<pre><code>import pyparsing as pp
import textwrap as tw
text = (
... | <python><pyparsing> | 2024-07-02 06:26:17 | 2 | 631 | Michael Henry |
78,695,314 | 3,896,008 | Weird behavior when updating the values using `iloc` in pandas dataframe | <p>While copying a pandas dataframe, ideally, we should use <code>.copy()</code>, which is a deep copy by default.</p>
<p>We could also achieve the same using <code>new_df = pd.Dataframe(old_df)</code>, which is also intuitive (and common style across most programming languages since in principle, we are calling a copy... | <python><pandas><dataframe> | 2024-07-02 06:13:36 | 1 | 1,347 | lifezbeautiful |
78,695,290 | 4,534,585 | Updating SentOn Date value in .msg file saved in local folder | <p>How Can I update the SentOn date in a .msg file located in local folder on my machine? Can this be done using python, VBA or any other tool?</p>
| <python><vba><outlook><com> | 2024-07-02 06:08:27 | 1 | 647 | Prashant Mishra |
78,695,142 | 3,244,618 | Python requests Selenium issue with ChromeDriver headless mode only | <p>I want to scrape a facebook ads website using requests library and Selenium with ChromeDriver (because I need to run it on pythonanywhere which has chromedriver).</p>
<p>so I do:</p>
<pre><code>
chrome_options = ChromeOptions()
arguments = [
"--disable-notifications",
"--start-maximized"... | <python><selenium-webdriver><selenium-chromedriver> | 2024-07-02 05:18:53 | 1 | 2,779 | FrancMo |
78,695,080 | 8,205,705 | How to debug Triton Python, especially Triton-JIT compiler passes? | <p>I would like to do the following:</p>
<ol>
<li>Build triton Python (which run from Python script):
<ul>
<li>Into specific directory</li>
<li>Build all cpp files with debug symbol</li>
<li>LLVM which used by triton should also be built with debug symbols</li>
</ul>
</li>
<li>Run a Python file to debug:
<ul>
<li>Relat... | <python><debugging><triton> | 2024-07-02 04:52:08 | 0 | 1,049 | Shore |
78,695,057 | 9,870,211 | Pyodbc auto running CREATE PROCEDURE | <p>I am connecting to a SQL Server using pyodbc - nothing fancy.</p>
<p>I have been flagged by a DBA that I have long running queries on the DB, however, I know the query I am running takes between 1-3 seconds long because if I run it in SSMS it takes this long.</p>
<p>When we added a trace to the DB, it seems there ar... | <python><sql-server><pyodbc> | 2024-07-02 04:41:14 | 0 | 2,415 | DDV |
78,694,885 | 6,670,097 | How to rename the array of StructType fields in PySpark? | <p>I need to read a JSON in French language and want to convert it English column names.</p>
<p>e.g. The Schema is like this</p>
<pre><code> |-- unites: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- id: string (nullable = true)
| | |-- score: integer (nullable = true)
|... | <python><apache-spark><pyspark><apache-spark-sql> | 2024-07-02 03:04:19 | 1 | 831 | kklo |
78,694,739 | 8,105,437 | Why does flask seem to require a redirect after POST? | <p>I have an array of forms I want rendered in a flask blueprint called fans. I am using sqlalchemy to SQLLite during dev to persist the data and flask-wtforms to render. The issue appears to be with DecimalRangeField - if I have two or more fans and change the slider on just one, the other slider appears to move to ... | <python><flask><flask-sqlalchemy><flask-wtforms> | 2024-07-02 01:31:36 | 1 | 6,080 | dmcgrandle |
78,694,642 | 6,622,697 | How to retrieve an object with a foreign key in many-to-many | <p>I have a many-to-many relationship.</p>
<pre><code>class Module(BaseModel):
name = models.TextField(unique=True, null=False)
groups = models.ManyToManyField(ModuleGroup, db_table='module_group_members')
class ModuleGroup(BaseModel):
name = models.TextField(unique=True, null=False)
</code></pre>
<p>I wan... | <python><django> | 2024-07-02 00:21:10 | 2 | 1,348 | Peter Kronenberg |
78,694,641 | 1,615,521 | Pydantic field validation against Enum name | <p>I have an Enum:</p>
<pre><code>class DataType(Enum):
TIMESTAMP = MyClass("ts")
DATETIME = MyClass("dt")
DATE = MyClass("date")
</code></pre>
<p>and a Pydantic Model with a field of the type of that Enum:</p>
<pre><code>class Aggregation(BaseModel):
field_data_type: DataT... | <python><enums><pydantic> | 2024-07-02 00:21:04 | 1 | 1,135 | Onca |
78,694,406 | 82,156 | Using pip to install a github pull request (404 not found) | <p>According to <a href="https://stackoverflow.com/questions/13561618/pip-how-to-install-a-git-pull-request">pip: how to install a git pull request</a> I should be able to use pip to install a library with an unmerged pull request, eg.</p>
<pre><code>python3 -m pip install git+https://github.com/jamalex/notion-py.git@r... | <python><pip> | 2024-07-01 22:21:28 | 1 | 100,604 | emmby |
78,694,380 | 18,758,987 | Is there a way to automatically overload functions with a 1-to-1 input-output type correspondence? | <p>Let's say I have this function</p>
<pre class="lang-py prettyprint-override"><code>from typing import reveal_type
def func(x: str | list[str]) -> int | list[int]:
"""
Some docstring that should show up.
"""
if isinstance(x, str):
return 0
return list(ran... | <python><overloading><python-typing><pylance> | 2024-07-01 22:09:49 | 0 | 472 | chicxulub |
78,694,344 | 16,778,949 | How to efficiently apply a `spacy` model to encode an entire `pandas` dataframe? | <p>I am trying to implement a semantic search where I have to match a query string over a corpus that is present in a pandas dataframe. I am trying to use <code>spacy</code> and its <code>similarity</code> function to compute the similarity between two items of text. To pass it to the <code>similarity</code> function, ... | <python><pandas><dataframe><spacy> | 2024-07-01 21:53:40 | 0 | 534 | phoney_badger |
78,694,172 | 16,778,949 | How to read data validation rules from an excel sheet using Python? | <p>I have a template Excel sheet with some data validation rules that I need to populate with data from another source. I need to read the template Excel sheet with Python and populate the rows and then write it out while preserving the data validation rules that used to exist in the original excel sheet. The template ... | <python><excel><validation><openpyxl> | 2024-07-01 20:49:39 | 0 | 534 | phoney_badger |
78,693,985 | 1,234,419 | Ignoring request for not matching predefined routes | <p>I have some Sanic Python app code where following routes are defined:</p>
<pre><code>
def create_inspector(app):
inspector = Sanic(configure_logging=False)
inspector.config['KEEP_ALIVE'] = False
inspector.app = app
inspector.add_route(render_status, '/')
inspector.add_route(get_status, '/api/stat... | <python><rest><crud><sanic> | 2024-07-01 19:39:13 | 2 | 1,403 | vector8188 |
78,693,934 | 5,001,432 | How to supply **kwargs with an variable that has the same name as a keyword argument? | <p>This has already been asked <a href="https://stackoverflow.com/q/61746117/5001432">here</a>, but the answers ignore that this is in the scenario where the functions are a part of a library, and therefore the user has no control over the API (outside of submitting an issue, which I will do for my case). However, I'm ... | <python><keyword-argument> | 2024-07-01 19:18:01 | 2 | 1,445 | cadams |
78,693,875 | 9,751,001 | How do I create a regex dynamically using strings in a list for use in a pandas dataframe search? | <p>The following code allows me to successfully identify the 2nd and 3rd texts, and only those texts, in a pandas dataframe by search for rows that contain the word "cod" or "i":</p>
<pre><code>import numpy as np
import pandas as pd
texts_df = pd.DataFrame({"id":[1,2,3,4],
... | <python><pandas><regex> | 2024-07-01 19:04:09 | 1 | 631 | code_to_joy |
78,693,782 | 6,843,153 | Pandas get the row with a max field from a groupby result | <p>I have the following dataframe:</p>
<pre><code>col_a, col_b, col_c
1 01 34
1 02 23
1 03 567
1 04 425
2 01 234
2 02 54
2 03 56
3 01 56
3 02 567
</code></pre>
<p>I want to select the rows with the max value in <code>col_b</code> for each ... | <python><pandas><group-by> | 2024-07-01 18:38:31 | 0 | 5,505 | HuLu ViCa |
78,693,717 | 606,025 | Python : ModuleNotFoundError: No module named ...? | <p>I am trying to run a very simple python project on VScode/Pycharm.</p>
<p>Directory Structure</p>
<pre><code>PythonAnalyticalProject/
├── sales_analysis/
│ ├── __init__.py
│ ├── cli.py
│ ├── constants.py
│ ├── db.py
│ ├── sales_analysis.py (contains main)
├── images/
│ ├── image1.png/
│ └── image2.pn... | <python> | 2024-07-01 18:22:58 | 3 | 1,453 | frewper |
78,693,687 | 8,190,068 | Align title to the left in an AccordionItem | <p>I am using an Accordion widget within my sample app (used for learning Kivy). In my KV code, I have:</p>
<pre><code> Accordion:
orientation: 'vertical'
AccordionItem:
title: '2024/12/20 00:00 <reference>'
...
</code></pre>
<p>The title is displayed centered with... | <python><kivy><accordion> | 2024-07-01 18:17:09 | 1 | 424 | Todd Hoatson |
78,693,682 | 2,181,977 | apply list-returning function to all rows in a pandas DataFrame | <p>I need to apply a function and have the returned list's values inserted into columns in the (new) dataframe. That is, if I have this:</p>
<pre><code>import pandas as pd
def fu(myArg):
return {"one":myArg,"two":20}
li = [10,20]
df = pd.DataFrame(li,columns=["myArg"])
</code></pre>
<p... | <python><pandas><dataframe><apply> | 2024-07-01 18:15:43 | 3 | 587 | Fredrik Nylén |
78,693,600 | 8,190,068 | Change image in a BoxLayout when an action occurs in another Box Layout | <p>I have a sort of note-taking app I'm putting together. It has a horizontal BoxLayout which contains an image and another BoxLayout (which happens to be vertical). This embedded BoxLayout contains a TabbedPanel.</p>
<p>I want to change the image in the main BoxLayout whenever the user selects a different tab in the... | <python><kivy><handler> | 2024-07-01 17:55:42 | 2 | 424 | Todd Hoatson |
78,693,574 | 5,527,646 | Creating a dictionary from a subset of a list | <p>Suppose I have python list like this:</p>
<pre><code>master_list = ['a_1', 'b_4', 'd_2', 'c_3',
'a_2', 'c_1', 'd_4', 'b_3',
'd_3', 'c_2', 'a_4', 'b_1',
'c_4', 'a_3', 'b_1', 'd_1']
</code></pre>
<p>Each item in the list is a letter, underscore, and number. I want a diction... | <python><list><dictionary><nested> | 2024-07-01 17:44:50 | 3 | 1,933 | gwydion93 |
78,693,523 | 1,711,271 | How to concatenate two dataframes of one row each without generating NaN | <p>I have two dataframes:</p>
<pre><code>import pandas as pd
import numpy as np
n=10
df = pd.DataFrame(
{
"A": 1.0,
"B": pd.Timestamp("20130102"),
"C": pd.Series(1, index=list(range(n)), dtype="float32"),
"D": np.array([3]... | <python><pandas><dataframe><concatenation> | 2024-07-01 17:26:27 | 1 | 5,726 | DeltaIV |
78,693,316 | 25,874,132 | how do I find the dimension of the span of the intersection/union of two null spaces of different sizes of matrices using numpy/scipy? | <p>I need to find $dim(span(H\cap G))$ and $dim(span(H\cup G))$ where H and G are defined the following way:</p>
<p><a href="https://i.sstatic.net/e8HMmqZv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e8HMmqZv.png" alt="enter image description here" /></a></p>
<p>I have no idea how to find the interse... | <python><numpy><scipy><linear-algebra> | 2024-07-01 16:24:25 | 1 | 314 | Nate3384 |
78,693,142 | 6,622,697 | How to express the reverse of a Many-to-One in Django | <p>I realized that Django has Many-to-One and not One-to-Many, but how to you express the opposite relationship?</p>
<p>I have a table which has 2 foreign keys to another table. The table Validation_Run has 2 foreign keys to Calibration_Run Django complains that that the reverse relationship has a conflict</p>
<p><co... | <python><django><django-models><many-to-one> | 2024-07-01 15:46:17 | 1 | 1,348 | Peter Kronenberg |
78,693,106 | 3,688,293 | Converting between two sets of constants | <p>I have two enums <code>NAME</code> and <code>ALIAS</code> which are guaranteed to have the same number of constants, and I need a way to convert each constant from <code>NAME</code> to its corresponding one from <code>ALIAS</code>, and vice-versa. For example:</p>
<pre><code>def name_to_alias(name):
if name == N... | <python><dictionary> | 2024-07-01 15:38:27 | 1 | 989 | Martin |
78,693,026 | 2,071,807 | Django subquery with static VALUES expression | <p>Is it possible using the Django ORM to write a subquery which SELECTs from a set of fixed values?</p>
<pre class="lang-sql prettyprint-override"><code>SELECT
id,
name,
(
SELECT
new_ages.age
FROM
(VALUES ('homer', 35), ('marge', 34)) AS new_ages(name, age)
WHERE new_ages.name = ages.name
)... | <python><django> | 2024-07-01 15:18:09 | 1 | 79,775 | LondonRob |
78,692,959 | 20,591,261 | Polars truncates decimals | <p>I'm trying to truncate floating point numbers in my DataFrame to a desired number of decimal places. I've found that this can be done using Pandas and NumPy <a href="https://stackoverflow.com/questions/56780561/pandas-dataframe-how-to-cut-off-float-decimal-points-without-rounding">here</a>, but I've also seen that i... | <python><dataframe><precision><python-polars> | 2024-07-01 15:04:30 | 2 | 1,195 | Simon |
78,692,950 | 5,049,813 | Why is no warning thrown for indexing a Series of values with a bool Series that's too long? | <p>I have the following code:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
series_source = pd.Series([1, 2, 3, 4], dtype=int)
normal_index = pd.Series([True, False, True, True], dtype=bool)
big_index = pd.Series([True, False, True, True, False, True], dtype=bool)
# Both indexes give back: p... | <python><pandas><dataframe><indexing><series> | 2024-07-01 15:02:53 | 2 | 5,220 | Pro Q |
78,692,910 | 6,227,035 | Pymongo: automatic IP | <p>I am writing an application using Pymongo to access a database on MongoDb Atlas using some basic syntax such as:</p>
<pre><code>import pymongo as pm
url = "mongodb+srv://user:password@clusterName.ecc.."
client = pm.MongoClient(url)
db = client.get_database('name_db')
</code></pre>
<p>My problem is that... | <python><mongodb><ip> | 2024-07-01 14:54:53 | 1 | 1,974 | Sim81 |
78,692,863 | 20,460,267 | Python Function Losing List Element After Recursion? | <p>I've just started learning Python and I'm getting a weird error in an exercise program I have just written. The program takes in a list of tuples (freq_i, value_i) representing a histogram of distinct value_is, and is supposed to output a list of list of first permutations which I could then permute in turn to get a... | <python><recursion> | 2024-07-01 14:45:26 | 1 | 2,007 | Simon Goater |
78,692,641 | 9,749,118 | Hide injected parameter by a decorator from function parameter hinting in PyCharm | <p>I have a function that has a parameter injected by a decorator like so:</p>
<pre><code>def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
return func('hello', *args, **kwargs)
return wrapper
@decorator
def func(hello_string: str, a: int, b: int):
<some code>
</code></pre>
... | <python><pycharm><decorator> | 2024-07-01 13:59:17 | 1 | 537 | INTODAN |
78,692,458 | 7,563,454 | Extract the closest two numbers that multiply to create a given number | <p>I made a CPU based raytracer in PyGame which uses a tile per thread to render each section of the screen. Currently I divide the screen vertically between lines, this doesn't give me the best distribution: I want to divide threads in even boxes covering both the X and Y directions. For example: If my resolution is <... | <python><algorithm><math><2d> | 2024-07-01 13:14:32 | 3 | 1,161 | MirceaKitsune |
78,692,403 | 108,390 | ElementTree.find() seems to miss recently appended elements | <p>I can't wrap my head around this one. Why is find() not finding the appended element when it can find the exact same element when it is loaded from an XML string?</p>
<p>The following function creates an element and adds subelements to it.</p>
<pre><code>def create_element():
d_004 = ET.Element("marcx:dataf... | <python><elementtree> | 2024-07-01 13:02:35 | 1 | 1,393 | Fontanka16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.