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 ⌀ |
|---|---|---|---|---|---|---|---|---|
79,725,756 | 6,916,032 | How to avoid double checks with asyncio.Lock | <p>I have a piece of code, that checks if the redis db has data updates and loads them to the memory. I want only one corouitine to execute this load.</p>
<pre><code>
class MyService:
def __init__(self):
self.lock = asyncio.Lock()
self.latest_timestamp = None
async def _check_latest_timestamp_f... | <python><locking><python-asyncio><primitive> | 2025-08-05 07:41:48 | 1 | 417 | Artem Ilin |
79,725,721 | 9,593,060 | Input audio from microphone not collected when audio is reproduced | <p>I'm developing a simple real-time voice bot using the OpenAI real-time API, specifically integrating with Semantic Kernel. The code is written in an async manner, and it initially works well. However, I'm facing issues with task synchronization and the event loop, preventing me from interrupting the bot or audio pla... | <python><audio><python-asyncio><real-time><python-sounddevice> | 2025-08-05 07:07:54 | 0 | 1,618 | Mattia Surricchio |
79,725,442 | 11,580,138 | Why am I getting this RecursionError? | <p>I'm working on making a program to read a <a href="https://www.investopedia.com/terms/c/chart-accounts.asp" rel="nofollow noreferrer">chart of accounts</a> and turn it into a tree of <code>Account</code> objects, which I will be doing stuff with later. The chart of accounts in question has several levels of sub-acco... | <python><recursion><infinite-recursion> | 2025-08-04 22:34:01 | 1 | 549 | In Hoc Signo |
79,725,439 | 1,086,777 | Python packages not autocompleting in Pycharm for one project, but works fine for another | <p>I'm using Pycharm 2025.1.3.1. I created a new project that uses the random package and the turtle package.</p>
<p>In one project, turtle classes and methods autocomplete, and in the other, they don't. I've checked the interpreter settings for both and neither has a turtle interpreter. From what I've read, since tur... | <python><pycharm> | 2025-08-04 22:26:06 | 0 | 4,374 | jzadra |
79,725,340 | 7,475,838 | Order of columns in a plotnine bar plot using a polars dataframe | <p>I'm quite new to the packages polars and plotnine and have the following code:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
import polars.selectors as cs
from plotnine import *
df = pl.read_csv('https://raw.githubusercontent.com/Brinkhuis/Zorguitgaven/refs/heads/master/zorguitgaven.csv')
... | <python><dataframe><python-polars><plotnine><polars> | 2025-08-04 19:59:50 | 3 | 4,919 | René |
79,725,307 | 34,747 | How to pass vector from Python to Duckdb for vector similarity search | <p>I am using Duckdb with the VSS extension to store document embeddings, it works normally however when I try to do a similarity search to a vector passed from Python, I am getting a TypeError. The query looks like this:</p>
<pre class="lang-py prettyprint-override"><code>query = text(
"""
selec... | <python><sql><duckdb> | 2025-08-04 19:22:01 | 1 | 6,262 | fccoelho |
79,725,144 | 15,263,876 | The conditional edge in LangGraph causes the reduce function to be invoked twice | <p>I am a beginner with LangGraph and am learning to create a graph to compute the Fibonacci sequence. The program has two nodes: one responsible for updating the Fibonacci sequence, and the other for controlling the loop. The complete code is as follows:</p>
<pre><code>from langchain_core.runnables import Runnable
fro... | <python><langgraph> | 2025-08-04 15:56:25 | 2 | 323 | lei hu |
79,725,066 | 804,184 | How to use the default value of a param when import a rule in Snakemake? | <p>I am trying to generalize my snakemake workflow, but I see a weird behavior, which I am not sure if I am doing something wrong or if it is by default.
I created a file <code>analysis.smk</code> rules and the evariable I tried to make a generic rule, to import it in many of my snakemake workflows, so I have, for inst... | <python><snakemake> | 2025-08-04 14:41:40 | 1 | 5,276 | Alejandro |
79,725,035 | 12,485,974 | fvcore multiple arguments forward modules? | <p>I have a model that take more than one arguments in forward.
Recently I'm trying to query some informations my model by fvcore module in python, but I can't find any <a href="https://detectron2.readthedocs.io/en/latest/modules/fvcore.html" rel="nofollow noreferrer">document</a> for multiple forward arguments!</p>
<p... | <python><torch> | 2025-08-04 14:20:34 | 1 | 586 | H.M |
79,725,017 | 2,801,187 | ttk.Combobox selected text vanishes when focus is lost (clam theme, readonly) | <p>I'm new to python and recently started coding a combobox using the "clam" UI theme.
However, the selected text vanishes when focus is lost from the dropdown? It seems confined to "clam" as other UI themes such as "alt" work fine.</p>
<p>For example, the initial screen shows</p>
<p><a hr... | <python><tkinter><combobox><tk-toolkit> | 2025-08-04 14:05:15 | 1 | 2,457 | vengy |
79,724,899 | 4,108,376 | Running Visual Studio Code Python debugger in Pixi shell | <p>I'm using <em>Pixi</em> to set up a Python environment that a python project needs to run in.</p>
<p>So I first do <code>pixi shell</code>, which sets several environment variables defined in the <code>pyproject.toml</code> file and also runs a <code>.bat</code> script. After this I run <code>python.exe ./script.py<... | <python><visual-studio-code><vscode-debugger><pixi-package-manager> | 2025-08-04 12:16:03 | 0 | 9,230 | tmlen |
79,724,877 | 12,633,371 | polars implementation for creating objects selecting specific attributes | <p>The <code>stanza</code> annotation <a href="https://stanfordnlp.github.io/stanza/getting_started.html#annotating-a-document" rel="nofollow noreferrer">pipeline</a> processes a text and it creates <code>Sentence</code>s which in turn comprise of <code>Word</code>s. These are objects created by Stanza. I want to selec... | <python><dataframe><stanford-nlp><python-polars> | 2025-08-04 11:51:19 | 1 | 603 | exch_cmmnt_memb |
79,724,845 | 7,456,317 | Convert Decimal values to float64 when creating a Pandas DataFrame | <p>I'm working with a dictionary that contains a list of <code>decimal.Decimal</code> values as one of its fields:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
from decimal import Decimal
data = {
'Item': ['Apple', 'Banana', 'Orange'],
'Price': [Decimal('1.25'), Decimal('0.75'), Deci... | <python><pandas><dataframe><type-conversion> | 2025-08-04 11:23:13 | 2 | 913 | Gino |
79,724,774 | 13,314,132 | How to download protected PDF (ViewDocument) using Selenium or requests? | <p>I'm trying to download a protected PDF from the New York State Courts NYSCEF website using Python. The URL looks like this:</p>
<pre><code>https://iapps.courts.state.ny.us/nyscef/ViewDocument?docIndex=cdHe_PLUS_DaUdFKcTLzBtSo6zw==
</code></pre>
<p>When I try to use <code>requests.get()</code> or even navigate to the... | <python><selenium-webdriver><web-scraping><pdf><python-requests> | 2025-08-04 10:28:11 | 2 | 655 | Daremitsu |
79,724,772 | 9,021,547 | How to set starting condition for airflow task group | <p>I have the following dag structure:</p>
<pre><code>from datetime import datetime, timedelta
from airflow import DAG
from airflow.utils.task_group import TaskGroup
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
with DAG(
'irb_test',
description='irb_test',
tag... | <python><airflow> | 2025-08-04 10:27:34 | 1 | 421 | Serge Kashlik |
79,724,694 | 7,078,356 | How to step into C++ code from Python using pybind11 in VSCode when using Python C++ Debugger? | <p><strong>Question:</strong></p>
<p>I am trying to debug a Python script that calls a C++ function through <strong>a .pyd</strong> module built with <strong>pybind11</strong> (compiled using MSVC). I want to set a breakpoint in Python, and when I press Step Into (F11,step into) in VSCode, I want it to step into the C+... | <python><c++><debugging><pybind11> | 2025-08-04 09:16:20 | 1 | 1,327 | Ringo |
79,724,624 | 17,510,144 | How to generate aadhaar card data from qr code | <p>I'm trying to generate user data from aadhaar qr code, i'm trying the 2 methods</p>
<pre><code>from aadhaar.secure_qr import extract_data
extracted_data = extract_data(int(qrData))
print(extracted_data.text_data)
# and
from pyaadhaar.decode import AadhaarSecureQr
secure_qr = AadhaarSecureQr(int(normal_int))
prin... | <python><aadhaar> | 2025-08-04 08:15:49 | 0 | 432 | Shubham Singhvi |
79,724,473 | 4,107,349 | Xlsxwriter custom data labels with custom data label positions | <p>We're trying to customize data label positions of individual data points on an xlsxwriter graph but can only work out how to set data label positions for entire series.</p>
<p>Simplified reproducible example:</p>
<pre class="lang-py prettyprint-override"><code>import xlsxwriter
workbook = xlsxwriter.Workbook("... | <python><excel><xlsxwriter> | 2025-08-04 04:10:56 | 1 | 1,148 | Chris Dixon |
79,724,168 | 3,646,845 | Create Action Button in Open edx Admin panel using tutor plugins | <p>I created and enabled a tutor plugin successfully using this <a href="https://docs.tutor.edly.io/plugins/v0/gettingstarted.html#python-package" rel="nofollow noreferrer">command</a></p>
<blockquote>
<p>cookiecutter <a href="https://github.com/overhangio/cookiecutter-tutor-plugin.git" rel="nofollow noreferrer">https:... | <python><django><django-admin><openedx><cookiecutter> | 2025-08-03 16:15:51 | 0 | 2,137 | Paullo |
79,724,122 | 1,155,237 | Modifying timestamps on Windows reparse points | <p>I need to copy timestamps (modified time) between NTFS reparse points of type junction, directory symlink and file symlink.</p>
<p>I can get the timestamp of a reparse point with <code>os.lstat()</code>. But to apply that timestamp I would need to use <code>os.utime()</code> but its parameter <code>follow_symlinks</... | <python><timestamp><symlink><ntfs><reparsepoint> | 2025-08-03 15:17:58 | 0 | 3,610 | mcu |
79,724,059 | 1,155,237 | Robocopy algorithm for /FFT and /DST options | <p>Microsoft's <code>Robocopy</code> program has these two options:</p>
<pre><code>/FFT :: assume FAT File Times (2-second granularity).
/DST :: compensate for one-hour DST time differences.
</code></pre>
<p>What is the exact algorithm that Robocopy uses for this?</p>
<p>If I wanted to implement this in Python for exa... | <python><timestamp><timezone><dst><robocopy> | 2025-08-03 13:38:35 | 0 | 3,610 | mcu |
79,723,933 | 989,803 | GLPK sensitivty result parsing with PULP | <p>I am trying to figure out how to read the GLPK sensitivity results back into Python</p>
<p>An example of how i am generating it:</p>
<pre><code>import pulp
from pulp import LpStatus, value
from glpk_sensitivity_parser import parse_sensitivity
prob = pulp.LpProblem("TEST", pulp.LpMaximize)
D = pulp.LpVari... | <python><parsing><pulp><glpk> | 2025-08-03 09:56:15 | 0 | 303 | user989803 |
79,723,724 | 3,840,940 | Apache Flink sinkfunction python code throws exception | <p>The Apache Flink 2.1 does not support mongodb python connectors. So I make the sample python codes by using SinkFunction.</p>
<pre><code>from pyflink.datastream import StreamExecutionEnvironment
from pyflink.datastream.functions import SinkFunction
from pymongo import MongoClient
import json
class MongoSink(SinkFun... | <python><apache-flink><pyflink> | 2025-08-03 01:00:05 | 0 | 1,441 | Joseph Hwang |
79,723,653 | 27,596,369 | Pygame image not facing the mouse | <p>Here is my rotating code:</p>
<pre><code>pos = pygame.mouse.get_pos()
x_dist = pos[0] - self.rect.centerx
y_dist = -(pos[1] - self.rect.centery)
self.angle = math.degrees(math.atan2(y_dist, x_dist))
self.image = pygame.transform.rotate(self.original_image, self.angle)
</code></pre>
<p>Here is my image:</p>
<p><a hre... | <python><math><pygame><degrees><radians> | 2025-08-02 20:53:13 | 1 | 1,512 | Aadvik |
79,723,518 | 3,208,351 | How to set up a simple hello-world example where a C function calls a Cython function calling a Python function? | <p>I am having trouble making a simple "Hello World" python function which I can call from a C program.</p>
<p>Here is the contents of my <code>helloworld.py</code> file:</p>
<pre class="lang-python prettyprint-override"><code>def hw():
print("Hello World")
</code></pre>
<p>Here is the contents of... | <python><c><python-3.x><cython> | 2025-08-02 16:59:55 | 2 | 585 | vibe |
79,723,508 | 5,732,745 | RuntimeWarning: coroutine <aiortc> was never awaited | <p>I am trying to use two Python libraries together: <a href="https://github.com/NiiightmareXD/windows-capture/tree/main/windows-capture-python" rel="nofollow noreferrer">windows-capture</a> and <a href="https://github.com/aiortc/aiortc" rel="nofollow noreferrer">aiortc</a></p>
<p>Below is the code in my server.py:</p>... | <python><aiortc> | 2025-08-02 16:44:15 | 0 | 347 | Dzenis Zigo |
79,723,457 | 1,096,196 | Is this Sumtracker API request correct? | <p>I wish to use the Sumtracker API, and I want to connect and do a basic get for <a href="https://inventory-api.sumtracker.com/api/version/2025-03/products/" rel="nofollow noreferrer">this endpoint</a>.</p>
<p>Let's say that my API key is <code>1234567890abc</code>. The code is here:</p>
<pre><code>import requests
ur... | <python><rest><python-requests> | 2025-08-02 15:17:32 | 1 | 741 | TheFaithfulLearner |
79,723,447 | 10,078,148 | How to add automatic attributes to the Python Markdown library | <p>I'm trying to import CSS styles into my HTML file exported by the Markdown library, but for some reason the attributes are basic, or so to speak, to generate a clean layout. Is it possible to add these attributes to the entire layout?</p>
<pre class="lang-py prettyprint-override"><code>from markdown import markdown
... | <python><markdown> | 2025-08-02 15:07:20 | 1 | 645 | royer |
79,723,352 | 1,035,783 | Close terminal window opened by .command Python script | <p>I have a Python script. I'd like to double click a file on my desktop (macOS) to run it. I'd like the terminal window opened by running the script to close.</p>
<p>To start, I changed the file extension of my script from <code>.py</code> to <code>.command</code> and gave it the following permissions: <code>chmod a+x... | <python><macos><terminal> | 2025-08-02 12:18:14 | 2 | 1,474 | chrisallick |
79,723,041 | 5,125,230 | Find roman numerals case-insensitively in regular text | <p>The regexes found in the answers to <a href="https://stackoverflow.com/questions/29586972/match-only-roman-numerals-with-regular-expression">this</a> SO question have various problems with finding only valid roman numbers that are within regular text (not on a line by themselves). (To be clear, that wasn't a require... | <python><regex><roman-numerals> | 2025-08-02 00:02:10 | 1 | 614 | vr8ce |
79,722,918 | 5,322,739 | Python Selenium: How can I specify a "no timeout" WebDriverWait? | <p>I'm using <a href="https://pypi.org/project/selenium/" rel="nofollow noreferrer">Selenium</a> <a href="https://www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.wait.html" rel="nofollow noreferrer">WebDriverWait</a> in a Python function decorated with <code>@timeout()</code>. Since ... | <python><selenium-webdriver><webdriverwait> | 2025-08-01 20:04:18 | 1 | 532 | Geoff Alexander |
79,722,891 | 2,957,581 | Not all files have gcno with bazel --coverage | <p><strong>NB</strong>
I have the custom targets which run by python scripts. So I couldn't use <code>bazel coverage</code> directly for this one.</p>
<p>1.</p>
<ul>
<li>I defined in <code>.bazelrc</code></li>
</ul>
<pre><code>build:coverage --collect_code_coverage
build:coverage --instrumentation_filter="^//src[/... | <python><code-coverage><bazel> | 2025-08-01 19:18:06 | 1 | 372 | Ulrich Von Rekkenin |
79,722,771 | 1,970,300 | Using a model property (list of dictionaries) as an input to django's format_html_join() yields KeyError | <p>I am attempting to use Django's <code>format_html_join()</code> util to return an html formatted version history for one of my models. But I cannot get <code>format_html_join()</code> to accept my list of dictionaries.</p>
<p>Here is what the documentation suggests:</p>
<pre><code>format_html_join(
"\n"... | <python><html><django><django-reversion> | 2025-08-01 16:40:22 | 1 | 504 | robline |
79,722,764 | 3,853,504 | Polars bug using windowed aggregate functions on Decimal type columns | <h1>Windowed aggregate functions on Decimal-types move decimals to integers</h1>
<p>I found a bug in <code>polars</code> (version 1.21.0 in a Python 3.10.8 environment) using windowed aggregate functions. They are not properly handling the decimal, essentially multiplying the result by 100. Here is a minimum reproducib... | <python><dataframe><window-functions><python-polars> | 2025-08-01 16:34:31 | 0 | 935 | jpm_phd |
79,722,626 | 3,554,065 | Python class attribute: How to refer to parent class attribute implicitly? | <p>I can't understand why this isolated code don't work :</p>
<pre><code>class SwitchSchema():
CONF_CONST_POWER = "constant_power"
class LightSchema(SwitchSchema):
TestVar = CONF_CONST_POWER
print(LightSchema.TestVar)
</code></pre>
<p>Error: <code>File "main.py", line 7, in &... | <python> | 2025-08-01 14:18:39 | 1 | 3,155 | Alsatian |
79,722,617 | 11,580,831 | pd.api.types.is_string_dtype() is misleading | <pre><code>df = pd.DataFrame({
'col_str': ["a", "b", "c"],
'col_lst_str': [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]],
'col_lst_int': [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
'col_... | <python><pandas><string><type-inference><dtype> | 2025-08-01 14:08:08 | 1 | 1,663 | Alexis |
79,722,555 | 1,306,892 | How to reliably download 1969 “Gazzetta Ufficiale” PDFs (Italian Official Gazette) with Python? | <p>I’m trying to programmatically download the full “pubblicazione completa non certificata” PDFs of the Italian <em>Gazzetta Ufficiale – Serie Generale</em> for <strong>1969</strong> (for an academic article). The site has a 1946–1985 “Formato grafico PDF” search and an archive index:</p>
<ul>
<li>Year index (1946–198... | <python><selenium-webdriver><web-scraping><pdf><beautifulsoup> | 2025-08-01 13:13:38 | 2 | 1,801 | Mark |
79,722,449 | 243,031 | Python gpt4all gives error for libllama.so python:3.12-slim image | <p>I am trying to use <a href="https://pypi.org/project/gpt4all/" rel="nofollow noreferrer"><code>gpt4all</code></a> in <code>python:3.12-slim</code> image.</p>
<p>I created <code>Dockerfile</code> as below.</p>
<pre><code>FROM python:3.12-slim
RUN pip install setuptools gpt4all
CMD ["python", "-c"... | <python><docker><gpt-4> | 2025-08-01 11:39:03 | 0 | 21,411 | NPatel |
79,722,429 | 232,888 | Limit number of stack levels shown | <p>In Python pdb, can I limit number of stack levels shown by "where", around my current position in the stack?</p>
<p>In my specific use case, I want to investigate an maximum recursion problem, where the original problem is maybe on stack level 20, but the stack trace shows all 500 levels.</p>
<p>I know I c... | <python><pdb> | 2025-08-01 11:21:33 | 1 | 4,722 | quazgar |
79,722,280 | 9,182,414 | Turning off constructor addition reordering b+a => a+b | <p>In Sympy, I'm trying to get some symbolic expressions to look exactly like my source material, but it appears that constructors do some rearrangements, most simply <code>Add</code>:</p>
<pre><code>>>> a, b = symbols("a b")
>>> b+a
a + b
>>> srepr(b+a)
Add(Symbol('a'), Symbol('b')... | <python><sympy> | 2025-08-01 09:04:51 | 1 | 449 | jonathanjo |
79,722,131 | 1,059,860 | How to properly escape UNC paths for string literals in Python while avoiding double prefixes? | <p>I'm working on a Python function that converts Windows file paths to UNC extended-length format and properly escapes them for string literal representation in configuration files. However, I'm running into issues with detecting existing UNC prefixes and avoiding double-escaping.</p>
<p>Here is what I've tried</p>
<p... | <python> | 2025-08-01 06:20:59 | 1 | 2,258 | tandem |
79,722,098 | 12,096,670 | How do I align the nodes in a Sankey Diagram in Python? | <p>Need some help aligning my Sankey diagram properly.</p>
<p>I've been working on a Sankey diagram project but can't seem to get the nodes aligned properly, they seem to be a bit off. I've tried to manually set and x/y coordinates, but still not up to what I want. Here is a bit of the generated data I am working with,... | <python><sankey-diagram> | 2025-08-01 05:38:31 | 1 | 845 | GSA |
79,721,938 | 3,595,972 | How to shuffle inner dimensions /axis of an array without disturbing the internal structure/data? | <p>It seems like the standard <code>numpy.random.shuffle</code> function shuffles (in place) only the first dimension / axis. I want a similar functionality for inner dimensions.</p>
<p>Note that <code>numpy.random.default_rng().permuted(axis)</code> works on any axis, but distorts the data i.e., mixes data from multip... | <python><numpy> | 2025-08-01 00:11:12 | 1 | 547 | omsrisagar |
79,721,816 | 1,358,422 | Is there an elegant way to use a class attribute as a type annotation? | <p>Using the same paradigm as in RDF, I'm modelling a class and its non-literal attributes as the id to the referenced object, like a URI in RDF.</p>
<p>For example:</p>
<pre class="lang-py prettyprint-override"><code>GUID = NewType("GUID", int) # create a subclass of int
print(GUID.__name__) # prints 'GUID... | <python><python-typing> | 2025-07-31 20:32:25 | 1 | 1,798 | ticapix |
79,721,780 | 5,094,589 | Using Asyncio for downloading big files: 10 times slower than threading | <p>The goal is to download images from the URLs asynchronously.</p>
<p>Here is the code for threading, which works fine:</p>
<pre><code>import requests
import threading
import os
import time
import concurrent.futures as futures
def download_image(url, folder):
os.makedirs(folder, exist_ok=True)
filename = url... | <python><async-await><concurrency><python-asyncio> | 2025-07-31 19:50:06 | 1 | 1,106 | Daniil Yefimov |
79,721,713 | 496,289 | How to read empty string as well as NULL values from a csv file in pyspark? | <ul>
<li><a href="https://stackoverflow.com/questions/64317510/read-spark-csv-with-empty-values-without-converting-to-null">Read spark csv with empty values without converting to null</a> doesn't answer this one because:</li>
</ul>
<blockquote>
<ol>
<li>That one's scala and this is pyspark.</li>
<li>Scala solution <cod... | <python><csv><apache-spark><pyspark> | 2025-07-31 18:41:50 | 1 | 17,945 | Kashyap |
79,721,627 | 5,432,667 | Why does the ProtBERT model generate identical embeddings for all non-whitespace-separated (single token?) inputs? | <p>Why do non-identical inputs to ProtBERT generate identical embeddings when non-whitespace-separated?</p>
<p>I've looked at answers <a href="https://stackoverflow.com/questions/78309756/mistral-model-generates-the-same-embeddings-for-different-input-texts">here</a> etc. but they appear to be different cases where the... | <python><nlp><bioinformatics><huggingface-transformers><bert-language-model> | 2025-07-31 17:17:15 | 1 | 397 | Maximilian Press |
79,721,552 | 21,691,539 | Importing some symbol from a Python script into its test script | <p>I've got the following project tree:</p>
<pre class="lang-none prettyprint-override"><code>SomeDir
|- script.py
|- TestDir
| |- test.py
</code></pre>
<p><code>script.py</code> is designed to be called in CLI and contains several classes: notably one that does the actual job and one that is a <code>class exit_codes(... | <python><pytest><python-import> | 2025-07-31 15:55:42 | 1 | 3,479 | Oersted |
79,721,529 | 13,147,413 | mlflow cannot fetch model registered on GitLab model registry | <p>I’m trying to download artifacts and a model that has been saved using MLflow on GitLab model registry.
That's the working part of my code, where I set up the client, create model and version and upload artifact previously saved on a local folder:</p>
<pre><code># Running client
import os
from mlflow import MlflowCl... | <python><gitlab><mlflow><model-registry> | 2025-07-31 15:32:11 | 0 | 881 | Alessandro Togni |
79,721,444 | 12,633,371 | transformers Pylance reportPrivateImportUsage | <p>I use VS Code and for every <code>import</code> from the <code>transformers</code> library - for example</p>
<pre><code>from transformers import AutoTokenizer
</code></pre>
<p>I get the message</p>
<pre><code>"AutoTokenizer" is not exported from module "transformers"
Import from "transformer... | <python><python-typing><pyright> | 2025-07-31 14:33:13 | 1 | 603 | exch_cmmnt_memb |
79,721,439 | 3,782,911 | Remote debugging of python webserver cannot listen on debug port | <p>Setup:</p>
<ul>
<li>FastAPI running inside Docker container, python3.12 image.</li>
<li>Connection to it via VSCode remote attach debugger</li>
</ul>
<p>This works if the application is started via
<code>python -m debugpy --listen 0.0.0.0:5680 --wait-for-client main.py</code></p>
<p><code>docker run --mount type=bin... | <python><docker><fastapi><remote-debugging> | 2025-07-31 14:31:08 | 0 | 2,795 | David Boshton |
79,721,399 | 2,545,680 | reveal_type in python as of python 3.10 in runtime | <p>When using mypy playground, this works fine:</p>
<pre class="lang-py prettyprint-override"><code>def f():
x = 123
reveal_type(x)
</code></pre>
<p>However, at run time, it generates the error</p>
<blockquote>
<p>NameError: name 'reveal_type' is not defined</p>
</blockquote>
<p>I've seen many discussions as to... | <python><python-typing><mypy><python-3.10> | 2025-07-31 14:01:01 | 1 | 106,269 | Max Koretskyi |
79,721,365 | 6,314,254 | Why is pandas not formatting dates with date_format? | <p>Why is pandas not formatting dates with <code>date_format</code> argument of <code>to_csv</code>?</p>
<pre><code>pandas.DataFrame([datetime.datetime.now().date()]).to_csv(date_format="%Y %b")
',0\n0,2025-07-31\n'
</code></pre>
| <python><pandas><csv><date> | 2025-07-31 13:41:58 | 3 | 2,101 | Hugo Trentesaux |
79,721,125 | 8,290,689 | Trying to update context variable from included template in Jinja2 | <p>I am trying to update variable from an included template in Jinja 2</p>
<p>base.j2:</p>
<pre><code>{% set ns = namespace(indent_lvl = 5) %}
{% filter indent(width=4*ns.indent_lvl, first=True) %}
base_indent_lvl: {{ns.indent_lvl}}
{% include template_file with context %}
base_indent_lvl: {{ns.indent_lvl}}... | <python><jinja2> | 2025-07-31 10:12:46 | 1 | 312 | Tradjincal |
79,721,033 | 3,446,927 | Python Azure Function failing with `cannot convert value of field 'x' in trigger metadata into int` | <p>I am developing a Service Bus Trigger function in Python that is failing with the following error message:</p>
<blockquote>
<p>Exception while executing function: Functions.servicebus_trigger_name Result: Failure
Exception: ValueError: cannot convert value of field 'State' in trigger metadata into int: invalid liter... | <python><azure><azure-functions> | 2025-07-31 08:52:07 | 1 | 539 | Joe Plumb |
79,721,010 | 14,720,380 | Uvicorn not getting trace id from otel in error logs (trace_id=0) | <p>I have a test FastAPI application:</p>
<pre class="lang-py prettyprint-override"><code>from fastapi import FastAPI, Request
from opentelemetry.exporter.otlp.proto.grpc import trace_exporter
from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
from opentelemetry.sdk.resources import Resource
from op... | <python><logging><fastapi><uvicorn><otel> | 2025-07-31 08:30:35 | 0 | 6,623 | Tom McLean |
79,720,805 | 546,888 | Python UnpicklingError: invalid load key, '\xef' | <p>I am new to python and came across a object deserialisation issue (unpickling) while testing a program on jupyter lab.</p>
<p>I am trying to serialize and deserialize object of Employee class as below.</p>
<p><strong>- Definition of Employee class:</strong></p>
<pre><code>class Employee:
def __init__(self, id, n... | <python><deserialization><upickle> | 2025-07-31 05:06:05 | 1 | 5,178 | Gunjan Shah |
79,720,634 | 1,854,821 | How to navigate from exception to the code that caused it in interactive Python window in VSCode | <p>My understanding is that the "Interactive Window" is the <a href="https://github.com/microsoft/vscode-python/issues/22139" rel="nofollow noreferrer">supported/best practice way to do REPL in VSCode</a>. So I click the "Run or Debug" menu from my Python file and select "Run current file in i... | <python><visual-studio-code> | 2025-07-30 23:36:40 | 0 | 473 | Timothy W. Hilton |
79,720,414 | 3,286,743 | Rolling quantile with lots of groups | <p>I have a dataset with more than 300 million rows and 7 columns. I want to compute rolling quantiles over lots of groups, but I run out of memory.
I use the following code:</p>
<pre class="lang-py prettyprint-override"><code>(
lf.sort('time')
.rolling(
index_column='time',
group_by=['id1', 'id... | <python><python-polars> | 2025-07-30 19:03:06 | 0 | 1,177 | robertdj |
79,720,251 | 12,011,020 | Polars schema_override for Datetimes as string | <h2>Issue</h2>
<p>I have data in form of a list of dicts (see MRE below). To make everything type strict I would always like to pass in the expected schema (dtypes) when I read in this data. This option is given in the <code>pl.DataFrame</code> constructor with either <code>schema</code> or <code>schema_overrides</code... | <python><datetime><python-polars> | 2025-07-30 16:05:15 | 0 | 491 | SysRIP |
79,720,198 | 12,423,732 | NiceGUI AgGrid Flashing Cell Background | <p><strong>Background</strong></p>
<p>I’m using NiceGUI to render an AG Grid table from a Pandas DataFrame in a Python web app. I want cells whose values change to flash in red when I update my data, similar to the “flashing cells” examples in AG Grid and Plotly Dash:</p>
<p>AG Grid docs on cell flashing: <a href="http... | <python><nicegui> | 2025-07-30 15:28:46 | 1 | 319 | Iain MacCormick |
79,720,124 | 4,948,719 | uv `required-environments`: only require that some extras build in some environments | <p><a href="https://github.com/astral-sh/uv/issues/14974#issue-3277304321" rel="nofollow noreferrer">cross-posted to the uv issue tracker</a></p>
<p>As all dependency problems, this one originates from <code>torch</code>.</p>
<p>I need to support cuda 12.4 on x86_64, and cuda 12.8 on arm64. Importantly, pytorch does ... | <python><pyproject.toml><uv> | 2025-07-30 14:28:04 | 1 | 1,834 | tbrugere |
79,720,031 | 13,435,688 | Plot characters on a graph using matplotlib without spaces | <p>I want to plot some data, but the problem that I am facing is that I am unable to plot the data without spaces between them.</p>
<p>The data should print out a letter like this:</p>
<p><a href="https://i.sstatic.net/GsqVr1wQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GsqVr1wQ.png" alt="enter imag... | <python><matplotlib> | 2025-07-30 13:27:29 | 2 | 952 | Franco |
79,719,672 | 9,974,205 | Problem refreshing excel data from Python Script | <p>I have a python code that theoretically downloads data to an excel file and then uses the refresh all command for it to execute some Power Query on the downloaded data.</p>
<pre><code>import os
import shutil
import win32com.client
staging_dir = r"C:\\XXX\\XXX\\XXX\\StagingFolder"
if not os.path.exists(sta... | <python><excel><windows><time><refresh> | 2025-07-30 08:47:37 | 0 | 503 | slow_learner |
79,719,547 | 1,648,712 | Can't convert geometry from back to WKT after exporting from MySQL | <p>I have a MySQL table with a <code>multipolygon</code> column, which has OSM geometry for each country's territorial waters. This is exported (by AWS) to a parquet file every night, which I then download - but I can't load it back into MySQL locally through a Python script.</p>
<p>Here is my code:</p>
<pre><code>from... | <python><mysql><shapely><geo> | 2025-07-30 06:46:33 | 0 | 414 | jimbofreedman |
79,719,484 | 9,223,023 | Does python STORE_SUBSCR bytecode instruction push back to the stack? | <p>The official description of STORE_SUBSCR bytecode instruction (<a href="https://docs.python.org/3/library/dis.html" rel="nofollow noreferrer">https://docs.python.org/3/library/dis.html</a>) gives the following explanation of how it works:</p>
<pre class="lang-py prettyprint-override"><code>STORE_SUBSCR:
key = STACK... | <python><bytecode> | 2025-07-30 05:43:27 | 0 | 1,203 | Petras Purlys |
79,719,460 | 13,946,204 | How to use yaml_file parameter for pydantic settings | <p>Here is my example code:</p>
<pre><code>from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
yaml_file=Path('c.yaml'),
yaml_config_section='blah',
)
port: int
s = Settings()
</code></pr... | <python><yaml><pydantic> | 2025-07-30 05:03:21 | 1 | 9,834 | rzlvmp |
79,719,422 | 1,269,634 | Python Wand: MagickReadImage returns false, but did not raise ImageMagick exception | <p>I've got some long-standing code in a Django code base that reads in a PDF and uses <a href="https://docs.wand-py.org/" rel="nofollow noreferrer">Wand</a> to take a screenshot of the first page of the PDF, which is then displayed on the website. We recently migrated servers (an upgrade from Ubuntu 22 LTS to 24 LTS),... | <python><django><nginx><imagemagick><wand> | 2025-07-30 03:55:18 | 1 | 2,441 | Geoff |
79,719,282 | 619,804 | How do I update my get_history() function to use langchain_postgres.PostgresChatMessageHistory instead of langchain_community? | <p>I’m updating a LangChain-based app to use the new langchain_postgres package instead of the deprecated langchain_community.chat_message_histories.</p>
<p>Previously, my function looked like this:</p>
<pre><code>from langchain_community.chat_message_histories import PostgresChatMessageHistory
import os
def get_histo... | <python><langchain> | 2025-07-29 22:30:57 | 1 | 2,366 | user619804 |
79,719,041 | 2,417,578 | How to use a Python regular expression which depends on pre-initialised back-references? | <p>I want to have a regular expression which includes back-references to strings it hasn't actually seen in the current string.</p>
<p>That is, I've already figured out what the literal values of the references should be, but they keep changing at run-time, so if I were to dynamically insert them into the regular expre... | <python><python-3.x><regex> | 2025-07-29 17:51:00 | 1 | 4,990 | sh1 |
79,718,887 | 2,071,807 | Filter Django RangeField by comparing to a point, not to another range | <p>The <a href="https://docs.djangoproject.com/en/5.2/ref/contrib/postgres/fields/#comparison-functions" rel="nofollow noreferrer">PostgreSQL specific model fields</a> docs are very specific about how to compare one <code>RangeField</code> to another range. But how do you compare a range to a single point?</p>
<p>For e... | <python><django><postgresql> | 2025-07-29 15:42:37 | 1 | 79,775 | LondonRob |
79,718,724 | 1,484,601 | How to create RGB healpix fits image? | <p>This python function creates 3 fits files, one per RGB channel:</p>
<pre class="lang-py prettyprint-override"><code># HealpixFullArray is a numpy array of shape (N,3) and dtype uint8.
# N: number of healpix pixels (in my case corresponding to nside 1024)
def save_fits(healpix_map: HealpixFullArray, output_base: Path... | <python><fits><healpy><ds9> | 2025-07-29 13:48:16 | 1 | 4,521 | Vince |
79,718,720 | 5,539,707 | Python lambda returns 0 | <p>Is there a simple way to return 0 with a <code>lambda</code> function using <code>and</code> and <code>or</code> operators?
For example, consider this function to sum elements in an array:</p>
<pre><code>sum = lambda tab: tab == [] and 0 or tab[0] + sum(tab[1:])
</code></pre>
<p>Neutral element for number addition i... | <python><recursion><lambda><sum> | 2025-07-29 13:43:56 | 1 | 1,593 | david |
79,718,582 | 9,785,316 | In pandas, how to write the word "nan" as string with to_excel? | <p>I have the reverse problem as described in <a href="https://stackoverflow.com/questions/33952142/prevent-pandas-from-interpreting-na-as-nan-in-a-string">Prevent pandas from interpreting 'NA' as NaN in a string</a>.</p>
<p>I work with older English text data and want to write the word "nan" (i.e. Mo... | <python><pandas><string><nlp><nan> | 2025-07-29 12:08:41 | 2 | 525 | Mat |
79,718,375 | 2,540,336 | Why grouping a pandas series using the same series makes no sense? | <p>In the code example below I am grouping a pandas series using the same series but with a modified index.</p>
<p>The groups in the end make no sense. There is no warning or error.</p>
<p>Could you please help me understand what is going on? The modified index has clearly an effect but what exactly happens?</p>
<pre c... | <python><pandas><group-by> | 2025-07-29 09:24:01 | 2 | 597 | karpan |
79,718,256 | 14,098,258 | How to automatically convert objective expression from pyomo model to use as fitness_func for pygad? | <p>I use <a href="https://pyomo.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">pyomo</a> to formulate optimization problems and tyically use solvers like for example IPOPT. Now I would like to apply metaheuristic solvers to those optimization problems. I have already heared of frameworks like <a href="h... | <python><optimization><pyomo><pygad> | 2025-07-29 07:29:30 | 1 | 383 | Andre |
79,718,144 | 326,439 | How to identify issue with my PIP installation | <p>Is there a reason I see a "zsh: permission denied: pip" when I try using pip from command line?
I am still able to use pip3 fine.</p>
<p>I am sort of doing a patch by creating an alias for pip in my .zshrc file.</p>
<p>Question: I really want to understand what's going on with my python installations.</p>
... | <python><pip> | 2025-07-29 05:17:00 | 1 | 8,772 | Ayusman |
79,718,085 | 4,107,349 | Pandas dt accessor or groupby function returning decimal numbers instead of integers in index labels where some series values NA | <p>We're trying to group up date counts by month and index values are returning as decimals instead of integers when series contain any number of NaTs / na values.</p>
<p>Simplified reproducible example:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
df = pd.DataFrame({"A": ["20... | <python><pandas><dataframe><group-by> | 2025-07-29 03:54:56 | 2 | 1,148 | Chris Dixon |
79,717,980 | 16,389,095 | Python Supabase: Unable to update user password | <p>I'm trying to reset the password of an already registered user, which is currently not authenticated. I wrote a simple Python script which is based on:</p>
<ul>
<li>defining a supabase client object</li>
<li>sending a reset link to the inserted email</li>
<li>verifying the token from the received link</li>
<li>updat... | <python><supabase><supabase-py> | 2025-07-28 23:36:41 | 1 | 421 | eljamba |
79,717,971 | 18,920,490 | Python asyncio: execute an asyncronous function while the main thread is blocked | <p>I'm coding a python project split into two parts:</p>
<ol>
<li>a <a href="https://doc.qt.io/qtforpython-6/" rel="nofollow noreferrer">PySide6</a> GUI interface that needs to run on the main thread synchronously, and consequently block it,</li>
<li>a <a href="https://playwright.dev/python/" rel="nofollow noreferrer">... | <python><multithreading><asynchronous><pyside6><playwright-python> | 2025-07-28 23:16:47 | 1 | 304 | Sisyffe |
79,717,821 | 27,596,369 | PIL getcolors returning None for some particular images | <p>I am getting weird behaviour when using PIL, here is my code:</p>
<pre><code>main_img = Image.open(image_url)
all_colors = main_img.getcolors(maxcolors=100000)
</code></pre>
<p>when I use this image:</p>
<p><a href="https://i.sstatic.net/82kJPkbT.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/82kJPkb... | <python><python-imaging-library> | 2025-07-28 19:52:23 | 1 | 1,512 | Aadvik |
79,717,750 | 2,453,904 | Multiprocessing pool with stop flag | <p>I am trying to implement a stop flag that gracefully prevents new parallel jobs from being started.
Specifically, I am running a large number of simulations that each takes a few to many hours; in order not to lose intermediate results, I would like the ability to tell my code to finish the ones that are currently r... | <python><python-multiprocessing> | 2025-07-28 18:31:28 | 0 | 468 | barceloco |
79,717,729 | 10,305,444 | pyinstaller not adding matplotlib error, not linking qt6 deps warning | <p>I have a Python application. And I want to distribute as <code>.exe</code> file. It's quite small application. Here are all my deps:</p>
<pre><code>PyQt6==6.9.1
PyQt6-Qt6==6.9.1
PyQt6_sip==13.10.2
qt-material==2.17
pyinstaller==6.14.2
</code></pre>
<p>Here is my <code>.spec</code> file for py-installer:</p>
<pre><co... | <python><windows><matplotlib><pyinstaller><qt6> | 2025-07-28 18:10:12 | 1 | 4,689 | Maifee Ul Asad |
79,717,580 | 4,025,458 | How to call R's stlm() from Python using rpy2, getting "missing value where TRUE/FALSE needed" error | <p>I’m using rpy2 in Python to call R's forecast::stlm() function from within a custom wrapper function defined in R. My goal is to fit a seasonal time series model (STL + ARIMA) on a univariate time series without any external regressors (xreg).</p>
<p>Here is a minimal working version of my Python code:</p>
<pre><cod... | <python><pandas><rpy2> | 2025-07-28 15:45:40 | 0 | 765 | RSK |
79,717,324 | 12,263,674 | Chart Title is in middle/between my bar graph plotted using openpyxl BarChart module | <p>I am using openpyxl (python module) to dynamically plot a bar graph with data from respective cells, but the chart title gets in between my bar graph.</p>
<p>Code used to create the bar graph:</p>
<pre><code>#sheet_velocity is the worksheet selected
# Chart object
chart_velocity = BarChart()
# Data and labels
char... | <python><excel><bar-chart><openpyxl> | 2025-07-28 12:29:27 | 1 | 535 | Sagar Kulkarni |
79,717,221 | 2,894,535 | Is there a short way to write "import" and "from import" for the same module? | <p>I find myself mixing both <code>import x</code> and <code>from x import y</code> forms for the same module, depending how often a particular object is used and whether it is clear which modules it comes from.</p>
<p>For example I might write the following:</p>
<pre><code>import dataclasses
from dataclasses import da... | <python><python-import> | 2025-07-28 10:53:29 | 1 | 3,116 | Dominik Kaszewski |
79,717,106 | 2,894,535 | pdb.set_trace() fails inside test with monkeypatched open | <p>I have a test monkeypatching builtin <code>open</code> to test a class which expects to read a file. When trying to debug it, I see:</p>
<pre><code>TypeError: test_unique.<locals>.<lambda>() got an unexpected keyword argument 'encoding'
</code></pre>
<pre class="lang-py prettyprint-override"><code>import... | <python><debugging><pytest><monkeypatching> | 2025-07-28 09:15:39 | 2 | 3,116 | Dominik Kaszewski |
79,716,880 | 19,459,262 | How to change and load a png file without refreshing the app? | <p>I have a Shiny for Python app which displays an image. Whenever I regenerate the image from within the app, the entire app reloads, losing the input settings (the slider value resets). Is there a way to refresh the image itself without reloading the app, or is this impossible? I'm using the png library to generate t... | <python><py-shiny> | 2025-07-28 04:12:22 | 0 | 784 | Redz |
79,716,705 | 1,018,226 | Transform Ansible list of dictionaries to dictionary | <p>Many Ansible Modules return a set of objects. When these objects do not have a unique identifying attribute, the data is often returned as a list of dictionaries. For example, the built-in <em>setup</em> module returns mount points this way. (I omitted some attributes for better readability.)</p>
<pre><code>"an... | <python><ansible><ansible-filter> | 2025-07-27 21:22:52 | 2 | 2,574 | XZS |
79,716,674 | 5,495,304 | Why does monkey patching a class's `__new__` not (always) work? | <p>I am trying to do some monkey patch work on an existing third-party library I am using.</p>
<h2>Summary</h2>
<h3>This sequence does not work:</h3>
<ol>
<li>Monkey patch <code>A.__new__</code> using <code>mynew</code></li>
<li>Monkey patch <code>A.__new__</code> again using <code>object.__new__</code> to reset the pr... | <python><python-3.x><metaprogramming> | 2025-07-27 20:23:29 | 1 | 6,659 | Gerges |
79,716,478 | 1,592,008 | Performance issue with Python, Mongo, Redis and pingpong threshold? | <p>I faced the issue that my integration tests get 3x performance boost on Ubuntu 20.04 with Kernel 5.4 but on Ubuntu 22.04+ and all Linux kernels after 5.10.135 there is not such boost.</p>
<p>Integration tests is PyTest testing Python 3.12 application using MongoDB(PyMongo and Motor) and Redis.
Tests, application its... | <python><linux><mongodb><redis><linux-kernel> | 2025-07-27 14:46:30 | 0 | 10,382 | Oleg Neumyvakin |
79,716,359 | 6,293,886 | singledispatchmethod for different list types (e.g. list[str] or list[int]) | <p>I'm trying to overload a method with <a href="https://docs.python.org/3/library/functools.html#functools.singledispatchmethod" rel="nofollow noreferrer"><code>singledispatchmethod</code></a>. It works great for simple types like <code>int</code> and <code>str</code>, but for different types of nested lists like <cod... | <python><overloading><single-dispatch> | 2025-07-27 11:15:12 | 1 | 1,386 | itamar kanter |
79,716,280 | 17,580,381 | Efficient extraction of first/only key in a dictionary | <p>Assumption is that we have a dictionary containing exactly one key/value pair. Objective is to extract the only key.</p>
<p>I can think of four ways to do this (there may be more).</p>
<pre><code>import timeit
def func1(d):
"""
Convert to a list and return the first element
""&... | <python><performance><dictionary><optimization><micro-optimization> | 2025-07-27 09:15:34 | 3 | 28,997 | Ramrab |
79,716,247 | 1,469,954 | Unable to send mail from Godaddy registered email server using Python | <p>We have a Godaddy account where we have registered our domain and configured an email address for sending and receiving mails. We are trying those credentials to send mail programatically using Python. This is the code we are trying:</p>
<pre><code>import smtplib
from email.mime.multipart import MIMEMultipart
from e... | <python><python-3.x><email><smtplib> | 2025-07-27 08:33:50 | 1 | 5,353 | NedStarkOfWinterfell |
79,716,150 | 20,087,266 | Treesitter-based Python code folding not applied when initially loading file in Neovim | <p>Every time a Python file is loaded, no folds are automatically applied based on the fold options that have been set (see below). Instead, I have to manually press <kbd>zx</kbd> to force the folds to be applied.</p>
<p>This problem is limited to Python files and the use of the Treesitter-based expression folding meth... | <python><lua><editor><neovim><code-folding> | 2025-07-27 04:58:37 | 1 | 4,086 | Kyle F. Hartzenberg |
79,716,103 | 6,312,979 | Can save Plotly image to Cloudinary? | <p>Is it possible to write a Plotly chart directly into Cloudanary without first saving to a file?</p>
<p>So Plotly is something like this.</p>
<pre><code>fig.write_image("fig1.png")
</code></pre>
<p>I want to upload the fig straight into Cloudinary. Which is something like this.</p>
<pre><code>cloudinary.upl... | <python><plotly><cloudinary> | 2025-07-27 02:12:07 | 1 | 2,181 | diogenes |
79,716,069 | 9,208,758 | How to resolve the type error in pomegranate? | <p>I am trying to set up a dummy code for the pomegranate (below), but for some reason I am getting an error when I try to run the ConditionalCategorical(). How do I resolve it?</p>
<pre><code>from pomegranate.distributions import ConditionalCategorical
import numpy as np
prob_table = [
[1.0, 0.0], # parent = 0 -... | <python><reinforcement-learning><pomegranate> | 2025-07-27 00:28:48 | 1 | 589 | Isaac A |
79,716,059 | 27,596,369 | Getting most common colors in an image using Pillow Image.get_colors() gives wrong result | <p>I have code which finds the top 10 colors from an image, so for that I used PIL to find all of the colors and then processed it and found the 10 most common ones, but when I try it online, results are completely different. Does PIL process colors differently or what exactly what is going on here?</p>
<p>Here is my c... | <python><python-imaging-library> | 2025-07-26 23:53:34 | 1 | 1,512 | Aadvik |
79,715,882 | 1,232,660 | Exclusive group of arguments with optional values | <p>The following code</p>
<pre><code>from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--foo', nargs='?')
parsed_args = parser.parse_args()
</code></pre>
<p>creates an optional argument with an <a href="https://docs.python.org/3/library/argparse.html#nargs" rel="nofollow noreferrer">op... | <python><argparse> | 2025-07-26 17:56:39 | 2 | 3,558 | Jeyekomon |
79,715,814 | 6,843,153 | Altair fails to render chart out of pandas dataframe on Streamlit | <p>I have the following code in <em>Python</em>, using <em>Streamlit</em> as framework:</p>
<pre><code>try:
native_data = data.copy()
# Create Altair chart with native data
st.write(f"Debug: Native data type: {type(native_data)}")
chart = alt.Chart(native_data).mark_bar().encode(
... | <python><pandas><streamlit><altair> | 2025-07-26 16:01:09 | 1 | 5,505 | HuLu ViCa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.