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,422,077 | 10,537,579 | Final file content rolled back to initial file content in streamlit | <p>I have created a simple <code>streamlit</code> application to browse files and folders and written the Python code as:</p>
<pre class="lang-py prettyprint-override"><code>import streamlit as st
import tkinter as tk
from tkinter import filedialog
import os
import pandas as pd
from pathlib import Path
uploaded_files ... | <python><python-3.x><file-upload><directory><streamlit> | 2025-02-07 20:14:25 | 0 | 357 | ankit |
79,422,061 | 2,969,880 | Problem with FastAPI, Pydantic, and kebab-case header fields | <p>In my FastAPI project, if I create a common header definition with Pydantic, I find that kebab-case header fields aren't behaving as expected. The "magic" conversion from kebab-case header fields in the request to their snake_case counterparts is not working, in addition to inconsistencies in the generate... | <python><fastapi><openapi><swagger-ui><pydantic> | 2025-02-07 20:05:40 | 1 | 1,461 | sql_knievel |
79,422,054 | 20,771,478 | Check if string only contains characters from a certain ISO specification | <p>Short question:
What is the most efficient way to check whether a <code>.TXT</code> file contains only characters defined in a selected ISO specification?</p>
<p>Question with full context:
In the German energy market EDIFACT is used to automatically exchange information. Each file exchanged has a header segment whi... | <python><algorithm><iso><edifact> | 2025-02-07 20:01:52 | 1 | 458 | Merlin Nestler |
79,422,048 | 99,089 | Organizing Python source files for two related projects with some shared code in one git repository | <p>I'm writing a system in Python that has to components: a compiler and a runtime. I could organize the files like:</p>
<pre class="lang-none prettyprint-override"><code>project/
compiler/
runtime/
</code></pre>
<p>When a user uses the runtime, the compiler is not needed at all and doesn't even need to be ins... | <python><python-3.x><code-organization> | 2025-02-07 20:00:36 | 0 | 7,171 | Paul J. Lucas |
79,422,025 | 1,951,507 | How to nest generic type definitions? | <p>Say I have:</p>
<ul>
<li>class <code>A</code></li>
<li>class <code>B</code> that is parameterized by a type with upper bound <code>A</code></li>
<li>class <code>C</code> that is parameterized by a type with upper bound <code>B</code>.</li>
</ul>
<p>How should I define these classes in Python 3.12 such that static ty... | <python><generics><python-typing> | 2025-02-07 19:53:09 | 0 | 1,052 | pfp.meijers |
79,421,833 | 9,848,968 | Google Drive API: Starred folder update does not reflect in Google Drive | <p>I am trying to update the starred value of a Google Drive folder using the Google Drive API but it is not reflecting in Google Drive.</p>
<p>The name is getting updated but the starred value is not getting updated. There is an <a href="https://stackoverflow.com/questions/21761853/starred-file-using-drive-api-doesnt-... | <python><google-drive-api> | 2025-02-07 18:25:20 | 0 | 385 | muw |
79,421,811 | 4,027,688 | Writing map types with pyiceberg | <p>I'm not sure if this is a bug or I'm just not structuring the data correctly, I couldn't find any examples for writing maps.</p>
<p>Given a table with a simple schema with a map field</p>
<pre class="lang-py prettyprint-override"><code>from pyiceberg.schema import Schema
from pyiceberg.types import StringType, MapTy... | <python><apache-iceberg><pyiceberg> | 2025-02-07 18:16:50 | 0 | 3,175 | bphi |
79,421,790 | 19,467,973 | How to change the configuration elementFormDefault and attributeFormDefault fields in Python spyne SOAP wsdl service | <p>Thank you in advance for your help and for reading my question.</p>
<p>I have a WSDL file, for which I want to disable the explicit relation of the transmitted data to the namespace.</p>
<p>The service is written in spyne, which does not have such an explicit feature. It automatically generates xml in which there is... | <python><xml><soap><wsdl><spyne> | 2025-02-07 18:08:06 | 0 | 301 | Genry |
79,421,702 | 3,153,928 | Working with python unit tests, tring to patch a class but is not working | <p>I have code with below functionality</p>
<p>src/client.py</p>
<pre><code>class Client1(object):
def foo(self, t):
return f"foo-{t}"
def get_foo(self, type):
return self.foo(type)
</code></pre>
<p>src/get_foos.py</p>
<pre><code>
from .src import Client1
client = Client1()
def get_... | <python><mocking><python-unittest.mock> | 2025-02-07 17:28:45 | 1 | 1,423 | uday8486 |
79,421,661 | 29,295,031 | How to customize the textposition of a bubblechart label | <p>I managed to set a fixed label for each bubble in my chart. Hereβs the code:</p>
<pre><code>import plotly.graph_objects as go
import plotly.express as px
import pandas as pd
margin_factor = 1.6
data = {'x': [1.5, 1.6, -1.2],
'y': [21, -16, 46],
'circle-size': [10, 5, 6],
'circle-color': [&qu... | <python><pandas><plotly> | 2025-02-07 17:07:47 | 1 | 401 | user29295031 |
79,421,610 | 8,329,213 | How to find the most common frequeny in Time series | <p>I have a TimeSeries shown below. We can clearly see that there is a <code>cyclical behavior</code> in the data, where rise and fall happens every 12 months and so on, irrespective of if trend is rising/falling. I am struggling to find how to extract this <code>frequency</code> of 12 from the data using <a href="http... | <python><fft><continuous-fourier> | 2025-02-07 16:44:58 | 1 | 7,707 | cph_sto |
79,421,531 | 6,029,488 | Python Pandas: Groupby multiple columns and linearly interpolate values of column Y based on another X column | <p>Consider the following pandas dataframe</p>
<pre><code> reference sicovam label id date TTM price
0 SCOM_WTI 68801903 WTI Nymex BBG:CL 2015-01-02 18 52.69
1 SCOM_WTI 68801903 WTI Nymex BBG:CL 2015-01-02 30 NaN
2 SCOM_WTI 68801903 WTI Nymex BBG:CL 2015-0... | <python><pandas><group-by><interpolation> | 2025-02-07 16:15:56 | 1 | 479 | Whitebeard13 |
79,421,434 | 4,317,594 | Trying to download YouTube video using yt_dlp I get error: Error: '__files_to_merge' | <p>I want to download a YouTube video, I did but the audio is not merged with the video(audio is not audible). How can I fix that using yt-dlp?</p>
<p><code>Error: '__files_to_merge'</code></p>
<pre><code>import os
import yt_dlp
def download_video(video_url, save_path):
if not save_path.endswith('.mp4'):
s... | <python><yt-dlp> | 2025-02-07 15:41:47 | 1 | 3,019 | Kaleab Woldemariam |
79,421,422 | 11,613,489 | Failed to Build Installable Wheels for OpenCV-Python on macOS | <p>I'm trying to install the <code>opencv-python</code> library on macOS using <code>pip</code></p>
<pre><code> pip install opencv-python
</code></pre>
<p>I keep encountering this error:</p>
<blockquote>
<p>ERROR: Failed to build installable wheels for some pyproject.toml
based projects (opencv-python)</p>
</blockquot... | <python><macos><opencv> | 2025-02-07 15:35:57 | 1 | 642 | Lorenzo Castagno |
79,421,406 | 16,891,669 | Are there any builtin frozen modules in python | <p>I was going through the python <a href="https://docs.python.org/3/reference/import.html" rel="nofollow noreferrer">import process</a> and found out about frozen modules. The only thing I understood after searching is that frozen modules are files that can be directly executed without python installed on the system.<... | <python> | 2025-02-07 15:30:42 | 1 | 597 | Dhruv |
79,421,373 | 16,891,669 | Understanding import in python (initalization of sys.modules) | <p>I recently came to know that modules like <code>os</code> are <a href="https://stackoverflow.com/questions/79420610/undertanding-python-import-process-importing-custom-os-module">imported way before</a> a user python program starts running and therfore we cannot import a custom file named <code>os</code> even though... | <python><python-import> | 2025-02-07 15:21:53 | 1 | 597 | Dhruv |
79,421,358 | 2,532,408 | chromedriver in headless mode incorrectly sets opacity to 0 for MUI component using fade | <p>I'm seeing an issue in selenium using chromedriver in headless mode with a MUI component that uses fade in where the transition doesn't seem to trigger.</p>
<p>If you run the following script against the <a href="https://react-w7zntifk-wnhs8qae.stackblitz.io/" rel="nofollow noreferrer">sample</a> url, the script wil... | <python><material-ui><selenium-chromedriver> | 2025-02-07 15:17:25 | 1 | 4,628 | Marcel Wilson |
79,421,290 | 5,265,038 | Reassigning Values of Multiple Columns to Values of Multiple Other Columns | <p>For the following <code>df</code> I wish to change the values in columns <code>A</code>,<code>B</code> and <code>C</code> to those in columns <code>X</code>,<code>Y</code> and <code>Z</code>, taking into account a boolean selection on column <code>B</code>.</p>
<pre><code>columns = {"A":[1,2,3],
... | <python><pandas><dataframe> | 2025-02-07 14:54:04 | 2 | 605 | mmTmmR |
79,421,254 | 13,674,431 | Python Error while executing "from selenium import webdriver" | <p>I used to execute my code normally without any problems.
But today when I executed</p>
<pre><code>import selenium
from selenium.webdriver.common.by import By
</code></pre>
<p>it's okay, but when I run this line, it's suddenly showing an error</p>
<pre><code>from selenium import webdriver
</code></pre>
<p><strong>_TY... | <python><selenium-webdriver><selenium-chromedriver><spyder> | 2025-02-07 14:43:28 | 0 | 315 | Ruser-lab9 |
79,421,201 | 4,767,670 | Select the largest available data type in Numpy | <p>I'm working on numerical algorithms and I have a Numpy backend for fast, fixed-precision calculations.</p>
<p>During the initialization of the interface I let the user choose among the complex data types <code>np.complex128</code>, <code>np.complex192</code>, <code>np.complex256</code>, <code>np.complex512</code>.</... | <python><numpy> | 2025-02-07 14:25:38 | 0 | 1,807 | NYG |
79,420,818 | 1,358,829 | Clearing tf.data.Dataset from GPU memory | <p>I'm running into an issue when implementing a training loop that uses a <code>tf.data.Dataset</code> as input to a Keras model. My dataset has an element spec of the following format:</p>
<pre class="lang-py prettyprint-override"><code>({'data': TensorSpec(shape=(15000, 1), dtype=tf.float32), 'index': TensorSpec(sha... | <python><tensorflow><machine-learning><keras> | 2025-02-07 12:02:12 | 1 | 1,232 | Alb |
79,420,684 | 6,467,567 | Inconsistent conversion from Euler to quaternions and back | <p>I am trying to debug my code but I'm confused why converting from Euler angles to quaternions and back is not giving me consistent results. How can I resolve this?</p>
<pre><code>import numpy as np
from scipy.spatial.transform import Rotation as R
# Define test rotation in degrees
testrotation = np.zeros([2, 2, 3])... | <python><scipy> | 2025-02-07 11:17:34 | 1 | 2,438 | Kong |
79,420,610 | 16,891,669 | Undertanding python import process (importing custom os module) | <p>I was reading through the <a href="https://docs.python.org/3/tutorial/modules.html#the-module-search-path" rel="nofollow noreferrer">python docs</a> for how import is resolved and found this</p>
<blockquote>
<p>... the interpreter first searches
for a built-in module with that name. These module names are listed in
... | <python><python-3.x><python-import> | 2025-02-07 10:53:57 | 1 | 597 | Dhruv |
79,420,563 | 4,539,582 | pymupdf4llm get 1 table format | <p>I want to get all text include table inside pdf file using <code>pymupdf4llm</code></p>
<pre class="lang-py prettyprint-override"><code>import pymupdf4llm
import pathlib
md_text = pymupdf4llm.to_markdown("my_file.pdf")
pathlib.Path("result.md").write_bytes(md_text.encode())
</code></pre>
<p>But ... | <python><pymupdf> | 2025-02-07 10:38:00 | 0 | 979 | newbie |
79,420,346 | 8,135,029 | Syntax error at or near ':'(line 1, pos 2) - PARSE_SYNTAX_ERROR - == SQL == | <p>I'm trying to read two JSON files at a time from AWS S3 bucket. getting error PARSE_SYNTAX_ERROR</p>
<p>but when i'm reading single file, it is working fine.</p>
<p>Using AWS Glue for execution.</p>
<pre><code>file_paths = [
"s3://test_bt/data/batch_date=20241217/20241217/data_0_0_0.json.gz",
"... | <python><amazon-web-services><apache-spark><amazon-s3><pyspark> | 2025-02-07 09:24:54 | 1 | 922 | abhimanyu |
79,420,135 | 7,002,525 | pySMT using deprecated setup.py | <p>I have installed <a href="https://github.com/pysmt/pysmt" rel="nofollow noreferrer">pySMT</a> for Python 3.12 using PyCharm package manager with a conda environment in Ubuntu 22.04.5 LTS:</p>
<pre><code>$ pip show pysmt
Name: PySMT
Version: 0.9.6
Summary: A solver-agnostic library for SMT Formulae manipulation and ... | <python><ubuntu><conda><setup.py><pysmt> | 2025-02-07 08:04:28 | 1 | 706 | teppo |
79,420,118 | 4,105,601 | Incorrecto version of pip when using pkg_resources | <p>I'm trying to gather information about several machines, each one of them running different Python versions and installed modules.</p>
<p>I tried the pkg_resources way, but after updating pip on one of them I'm seeing that the reported pip version is not correct: pkg_resources</p>
<pre class="lang-none prettyprint-o... | <python><pip><pkg-resources> | 2025-02-07 07:55:29 | 1 | 507 | HΓ©ctor C. |
79,419,787 | 11,850,322 | Call another jupyter notebook, passing variables and receiving variables | <p>Let say I have two jupyter notebook files called: <code>main</code> and <code>sub</code></p>
<p>Here are my needs:</p>
<ol>
<li>Call and run <code>sub</code> from <code>main</code></li>
<li>Each notebook has its own variables space. For example, if <code>x=1</code> in <code>main</code>, but <code>x=2</code> in <code... | <python><python-3.x><jupyter-notebook><jupyter><jupyter-lab> | 2025-02-07 01:37:11 | 0 | 1,093 | PTQuoc |
79,419,739 | 13,395,230 | Optimized binary matrix inverse | <p>I am attempting to invert (mod 2) a non-sparse binary matrix. I am trying to do it with very very large matricies, like 100_000 by 100_000. I have tried libraries, such as sympy, numpy, numba. Most of these do this with floats and don't apply mod 2 at each step. In general, numpy reports the determinant of a random ... | <python><matrix><optimization> | 2025-02-07 00:48:36 | 1 | 3,328 | Bobby Ocean |
79,419,588 | 6,703,783 | How to import `wikipedia` module in Python | <p>I am running a Python script which downloads articles from Wikipedia. I have tried to install <code>wikipedia</code> and <code>wikipedia-api</code> but none seem to work.</p>
<pre><code>#!/usr/bin/env python
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This script down... | <python><wikipedia><wikipedia-api> | 2025-02-06 23:14:39 | 1 | 16,891 | Manu Chadha |
79,419,480 | 1,122,185 | Using Python to replace triple double quotes with single double quote in CSV | <p>I used the pandas library to manipulate the original data down to a simple 2 column csv file and rename it to a text file. The file has triple double quotes that I need replaced with single double quotes. Every line of the file is formatted as:</p>
<pre><code>"""QA12345""",""... | <python><csv> | 2025-02-06 22:12:50 | 4 | 577 | ResourceReaper |
79,419,312 | 3,045,351 | Service in a virtualenv calling nodes in their own virtualenv's | <p>I have a situation where I have a large code base, that I did not author, only have a surface level understanding of and cannot substantially change. There is a parent service running in it's own virtualenv. This is importing various third party nodes, each with their own code base and dependencies. The nodes are im... | <python><python-3.x> | 2025-02-06 20:46:56 | 0 | 4,190 | gdogg371 |
79,419,279 | 13,971,251 | How to use django-allauth for Google API? | <p>How is <a href="https://pypi.org/project/django-allauth/" rel="nofollow noreferrer"><code>django-allauth</code></a> implemented to obtain authorization using Oauth2 for a <a href="https://developers.google.com/identity/protocols/oauth2" rel="nofollow noreferrer">Google API</a> (in my case the <a href="https://develo... | <python><django><google-oauth><django-allauth><django-oauth> | 2025-02-06 20:34:26 | 1 | 1,181 | Kovy Jacob |
79,419,072 | 13,971,251 | Manage django-allauth social applications from admin portal | <p>In all the tutorials I've seen, the <a href="https://pypi.org/project/django-allauth/" rel="nofollow noreferrer"><code>django-allauth</code></a> settings are all in the <code>settings.py</code> file. However, this ends up being kind of messy:</p>
<pre class="lang-none prettyprint-override"><code>SOCIALACCOUNT_PROVID... | <python><django><google-oauth><django-allauth><django-oauth> | 2025-02-06 19:03:31 | 2 | 1,181 | Kovy Jacob |
79,418,903 | 271,789 | Using subscribe() method in an asyncio stack | <p>I want to use pubsub in an application that uses asyncio as a basic way of achieving I/O concurrency. The default Google SDK, however doesn't offer async methods (I have tried gcloud-aio-pubsub, but it only supports pull methods, so the latency is very bad).</p>
<p>With publishing and topic/subscription management I... | <python><multithreading><python-asyncio><google-cloud-pubsub> | 2025-02-06 17:53:17 | 1 | 2,066 | zefciu |
79,418,852 | 1,110,442 | How to build a url with path components in Python securely | <p>In Python, how do I build urls where some of the path components might be user input or otherwise untrusted?</p>
<p>Is there a way to use <a href="https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals" rel="nofollow noreferrer">f-strings</a> that automatically provides escaping, similar to Ja... | <python><security><url> | 2025-02-06 17:33:35 | 1 | 5,439 | Tim |
79,418,812 | 861,164 | select random representative from a list in python (axiom of choice) | <p>I have a very large (1M or more elements) list of elements that occur repeatedly. I want for each unique element an index pointing to a random representative of that element in the list.
For example, the list</p>
<pre><code>lst = ['b', 't', 'm', 'a', 'c', 'k', 'm', 't', 'm', 'l']
</code></pre>
<p>contains the elemen... | <python> | 2025-02-06 17:21:07 | 1 | 1,498 | Michael |
79,418,754 | 4,986,615 | A recursive property defined as a property_column in SQLAlchemy | <p>I am looking for a proper way to manage a recursive object using SQLAlchemy.</p>
<p>The <code>column_property</code> syntax looks very promising, but I could not make it work to load the children.</p>
<p>Below is an MRE:</p>
<pre class="lang-py prettyprint-override"><code>from sqlalchemy import (
Column,
For... | <python><sqlalchemy> | 2025-02-06 16:59:02 | 0 | 2,916 | guhur |
79,418,598 | 9,863,397 | How to do install my custom package in editable mode, with uv | <p>My colleagues told me to try 'uv'. It is true that it is handy, but I quickly faced a huge problem: I can't install my custom sources.</p>
<p>Usually, my projects' structures look like this:</p>
<pre class="lang-none prettyprint-override"><code>my_project/
βββ src/
β βββ backend/
β β βββ __init__.py
β β ββ... | <python><pip><uv> | 2025-02-06 16:05:57 | 4 | 457 | ava_punksmash |
79,418,418 | 467,366 | How to use ebooklib to create a nested chapter hierarchy? | <p>I am trying to create an EPUB that has a nested chapter structure. There are top-level sections, with sub-chapters, and then subheadings below those sub-chapters. I would like this to be reflected in the TOC. Here is an example of what it looks like:</p>
<blockquote>
<h1>Section 1</h1>
<p>Here is some preamble about... | <python><epub><ebooklib> | 2025-02-06 15:07:08 | 1 | 10,943 | Paul |
79,418,256 | 29,295,031 | Why I do not see the x axis when I use plotly with streamlit | <p>when I use only plotly I got this :</p>
<p>code :</p>
<pre><code>import plotly.graph_objects as go
import plotly.express as px
import pandas as pd
data = {'x': [1.5, 1.6, -1.2],
'y': [21, -16, 46],
'circle-size': [10, 5, 6],
'circle-color': ["red","blue","green&quo... | <python><pandas><plotly><streamlit> | 2025-02-06 14:12:25 | 1 | 401 | user29295031 |
79,418,236 | 829,412 | Can't buf generate generate folders with dots? | <p>We use protobuf and the buf CLI to create and generate the shared files between a Go and a Python project (for ensuring structured data to be transmitted between the projects in a common way).</p>
<p>We want to build the generator commands as simple as possible, as the generation is done using GitHub workflows and t... | <python><protocol-buffers><buf> | 2025-02-06 14:04:11 | 1 | 461 | Kim Rasmussen |
79,418,235 | 9,318,323 | Msgraph-sdk-python get sharepoint site id from name | <p>I want to work with SharePoint sites using Python. For now, I just want to ls on the site. I immediately ran into an issue where I need site id to do anything with it.</p>
<p>How do I get site id from the site name?
I did retrieve it using powershell:</p>
<pre class="lang-bash prettyprint-override"><code>$uri = &quo... | <python><azure><sharepoint><microsoft-graph-api> | 2025-02-06 14:03:35 | 2 | 354 | Vitamin C |
79,418,188 | 25,413,271 | Get indices of edge points computed with extract_feature_edges() | <p>I have a non-closed surface in STL. I read it as <code>PolyData</code> with PyVista and I want to get edge points indices. I go this way:</p>
<pre class="lang-py prettyprint-override"><code>bot_surf_file = r'bottom.stl'
bot_surf_mesh = pv.PolyData(bot_surf_file)
points = bot_surf_mesh.points
triangles = bot_surf_me... | <python><pyvista> | 2025-02-06 13:46:54 | 1 | 439 | IzaeDA |
79,418,004 | 5,044,921 | How to force all terms in 1-D Gaussian mixture model to have the same mean? | <p>I have a one-dimensional set of data points, of which I want to parameterise the probability density. I have reasons to believe that a Gaussian mixture model would be a good way to accomplish this, so I'm trying to use scikit-learn's <a href="https://scikit-learn.org/stable/modules/generated/sklearn.mixture.Gaussian... | <python><scikit-learn> | 2025-02-06 13:04:05 | 1 | 4,786 | acdr |
79,417,996 | 24,696,572 | efficient matrix inversion/multiplication with multiple batch dimensions in pytorch | <p>In my framework, I am having an outer loop (here mocked by the variable <code>n</code>) and inside the loop body I have to perform matrix inversions/multiplications for multiple batch dimensions. I observed that manually looping over the batch dimensions and computing the inverse is measurable faster than passing al... | <python><pytorch><batch-processing> | 2025-02-06 13:02:06 | 2 | 332 | Mathieu |
79,417,824 | 607,407 | How to tell pylance to correctly read identifiers loaded by their full module name? | <p>I have a file that depends on a tool from another directory. The structure is:</p>
<ul>
<li><code>my_subproject</code>
<ul>
<li><code>util</code>
<ul>
<li><code>__init__.py</code></li>
<li><code>my_tool.py</code></li>
</ul>
</li>
<li><code>__init__.py</code></li>
<li><code>my_main_file.py</code></li>
</ul>
</li>
</u... | <python><pylance> | 2025-02-06 12:02:00 | 0 | 53,877 | TomΓ‘Ε‘ Zato |
79,417,790 | 8,315,819 | Python script for process injection | <p>I need to do a process injection using python. Tried the below script. My objective is to see if the script is working and if working then can it be used to evade EDR detection</p>
<pre><code>import pymem
import os
import subprocess
notepad = subprocess.Popen(['notepad.exe'])
pm = pymem.Pymem('notepad.exe')
pm.inj... | <python><security><process-injection> | 2025-02-06 11:50:13 | 1 | 445 | Biswa |
79,417,729 | 6,618,051 | PyInstaller add additional files | <p>How to add additional files into the <code>dist</code>-folder during a compilation (<code>python -m PyInstaller tlum.spec</code>)?</p>
<p>I've added them to <code>datas</code>, but it's not helping</p>
<pre><code>a = Analysis(
['..\\src\\main.py'],
pathex=[],
binaries=[],
datas=[
("..\\a... | <python><kivy><pyinstaller> | 2025-02-06 11:30:00 | 1 | 1,939 | FieryCat |
79,417,642 | 3,365,532 | How to implement Softmax of a Polars LazyFrame using expressions? | <p>I'm relatively new to using polars and it seems to be very verbose compared to pandas for what I would consider even relatively basic manipulations.</p>
<p>Case in point, the shortest way I could figure out doing a softmax over a lazy dataframe is the following:</p>
<pre class="lang-py prettyprint-override"><code>im... | <python><dataframe><python-polars> | 2025-02-06 11:03:06 | 1 | 443 | velochy |
79,417,386 | 9,128,863 | Pytorch Convolution Network: problem with floating point type | <p>I'm trying to train the CV-model with standard MNIST-data:</p>
<pre><code> import torch
from torchvision.datasets import MNIST
import torchvision.transforms as transforms
img_transforms = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.1305,), (0.3081,))
])
train_dataset = MNIST(... | <python><pytorch><floating-point> | 2025-02-06 09:34:44 | 1 | 1,424 | Jelly |
79,417,370 | 17,580,381 | How can iterating over a BufferedReader of binary data give line number results? | <p>Numerous propositions for counting the number of lines in a file can be found <a href="https://stackoverflow.com/questions/845058/how-to-get-the-line-count-of-a-large-file-cheaply-in-python">here</a></p>
<p>One of the suggestions is (effectively):</p>
<pre><code>with open("foo.txt", "rb") as hand... | <python> | 2025-02-06 09:29:31 | 2 | 28,997 | Ramrab |
79,417,362 | 10,680,954 | VSCode Remote SSH: Canβt Install βms-python.pythonβ (Incompatibility Error & Infinite Loop) | <p>Iβm working with VSCode on a remote server via SSH and having issues installing the Python and Jupyter extensions. When I try to install ms-python.python, I sometimes get the following error message:</p>
<pre><code>Canβt install βms-python.pythonβ extension because it is not compatible.
</code></pre>
<p>Other times,... | <python><visual-studio-code><vscode-extensions><vscode-remote> | 2025-02-06 09:26:45 | 1 | 1,611 | zwithouta |
79,417,209 | 6,013,016 | Clean up unused pip packages that my project is not using | <p>I'm using <code>pip</code> to install necessary packages for my project. And my project is working fine on my pc. Next step is deploying it on client's device. But, I see some packages are installed, not being used though.</p>
<p><strong>So, what is the best (optimal) way to clean up those unused pip packages before... | <python><pip> | 2025-02-06 08:30:56 | 0 | 5,926 | Scott |
79,417,096 | 6,734,243 | how to force the reinsall of my local package with uv? | <p>I'm starting to use <code>uv</code> for my CI as it's showing outstanding performances with respect to normal pip installation. for each CI run I (in fact <code>nox</code> does it on my behalf) create a virtual environment that will be used to run the tests. In this environment I run the following:</p>
<pre><code>uv... | <python><packaging><uv> | 2025-02-06 07:37:55 | 1 | 2,670 | Pierrick Rambaud |
79,417,079 | 7,156,008 | Django ORM sporadically dies when ran in fastAPI endpoints using gunicorn | <p>Other related Questions mention using either
<code>django.db</code>'s <code>close_old_connections</code> method or looping through the django connections and calling <code>close_if_unusable_or_obsolete</code> on each.</p>
<p>I've tried doing this as a a fastapi middlewear and the issue persists just the same:</p>
<p... | <python><django><fastapi><django-orm><starlette> | 2025-02-06 07:31:39 | 0 | 4,144 | George |
79,416,950 | 3,825,996 | Python: Initializing extra members in a subclass without overriding/obfuscating the base class' __init__ | <p>Say I am for example subclassing Popen which has roughly a million <code>__init__</code> parameters and I want to initialize an extra class member. The standard way (I think) would be this:</p>
<pre class="lang-py prettyprint-override"><code>from subprocess import Popen
class MyPopen(Popen):
def __init__(self, ... | <python><python-typing><mypy> | 2025-02-06 06:29:11 | 1 | 766 | mqnc |
79,416,850 | 219,153 | How to reduce verbosity of self-documenting expressions in Python f-strings? | <p>This script:</p>
<pre><code>import numpy as np
a = np.array([2, 3, 1, 9], dtype='i4')
print(a)
print(f'{a=}')
</code></pre>
<p>produces:</p>
<pre><code>[2 3 1 9]
a=array([2, 3, 1, 9], dtype=int32)
</code></pre>
<p>Is there a way to get just <code>a=[2 3 1 9]</code> from <code>{a=}</code> f-string as in the standard... | <python><numpy-ndarray><f-string> | 2025-02-06 05:22:39 | 2 | 8,585 | Paul Jurczak |
79,416,816 | 11,402,025 | pydantic version update : Field defined on a base class was overridden by a non-annotated attribute | <p>I updated the pydantic version and code is breaking with the error</p>
<p>Field 'allowed_type' defined on a base class
was overridden by a non-annotated attribute. All field<br />
definitions, including overrides, require a type<br />
annotation.</p>
<pre><code>class AllowedType(str, Enum):
YES = "YES"... | <python><pydantic><pydantic-v2> | 2025-02-06 05:00:52 | 0 | 1,712 | Tanu |
79,416,737 | 616,728 | OpenSearch Python - Return hit count by index | <p>I have two indices in OpenSearch that I am searching and want to do get window function like totals for each index in addition to the results. They are called <code>users</code> and <code>posts</code> and I need to get the total number of hits from <code>posts</code> and the total from <code>users</code> as well as ... | <python><opensearch><amazon-opensearch> | 2025-02-06 03:33:58 | 0 | 2,748 | Frank Conry |
79,416,716 | 6,260,879 | httpx Library vs curl program | <p>I am trying to use the httpx library to POST a file through a website provided API. The API requests some additional headers.
Here is my Pyhton script:</p>
<pre><code>#!/usr/bin/python3
import httpx
files = {'file': ('Test.pdf', open('Test.pdf', 'rb'), 'application/pdf')}
url='https://some.api.domain/Api/1/documen... | <python><curl><post><httpx> | 2025-02-06 03:22:35 | 1 | 387 | Christian |
79,416,657 | 1,481,689 | __set_name__ outside of classes? | <p>Does anyone know how to get <code>__set_name__</code> to work outside of classes?</p>
<pre class="lang-py prettyprint-override"><code>>>> class N:
... def __set_name__(self, owner, name):
... print(f'{name = }')
...
>>> class T:
... n = N()
...
name = 'n'
</code></pre>
<p>... | <python> | 2025-02-06 02:35:09 | 0 | 1,040 | Howard Lovatt |
79,416,603 | 1,982,032 | How can import package-numpy for libreoffice's macro to call python? | <p>"numpy" is installed in for <code>libreoffice24.8</code>:</p>
<pre><code>ls /opt/libreoffice24.8/program | grep numpy
numpy
numpy-2.2.2.dist-info
numpy.libs
</code></pre>
<p>Edit a test python script for macro in <code>libreoffice24.8</code> to call:</p>
<pre><code>vim .config/libreoffice/4/user/Script... | <python><numpy><macros><libreoffice><libreoffice-calc> | 2025-02-06 01:44:46 | 3 | 355 | showkey |
79,416,595 | 7,955,271 | Why can't Pylance fully infer the return type of this function? | <p>I am using Python 3.11.4, and Pydantic 2.10.0. The following is a toy example of a real-world problem.</p>
<p>I have defined two Pydantic Basemodels, and created a list containing instances of both, as follows.</p>
<pre class="lang-py prettyprint-override"><code>import pydantic
class Foo(pydantic.BaseModel):
a... | <python><python-typing><pyright> | 2025-02-06 01:41:17 | 1 | 1,037 | Vin |
79,416,554 | 8,266,189 | How to wrap a torch.jit model inside a torch Module? | <p>I'm trying to call a TorchScript model inside a <code>torch.nn.Module</code> but got an error related to pickle.</p>
<p>Here's the code to reproduce:</p>
<pre><code>import torch
import torch.nn as nn
# A simple base model to create a ScriptModel
class ExampleModel(nn.Module):
def __init__(self, factor: int):
... | <python><pytorch><jit><pytorch-lightning><torchscript> | 2025-02-06 00:56:56 | 0 | 357 | Ha An Tran |
79,416,484 | 210,867 | I can't figure out why `isinstance()` returns `True` for these subclasses | <p>I'm using the Python package <a href="https://pypi.org/project/ariadne/" rel="nofollow noreferrer">ariadne</a>, <a href="https://github.com/mirumee/ariadne/tree/0.23.0/ariadne" rel="nofollow noreferrer">v0.23.0</a>.</p>
<p>I wrote a utility to scan my code for instances of <code>ariadne.types.SchemaBindable</code>, ... | <python><ariadne-graphql> | 2025-02-05 23:57:19 | 3 | 8,548 | odigity |
79,416,398 | 1,540,660 | Logger does not inherit config from parent process | <p>Consider the following minimal setup:</p>
<pre><code>/mymodule
βββ __init__.py
βββ main.py
βββ worker.py
</code></pre>
<p><code>__init__.py</code> is empty</p>
<p><code>main.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>import sys
import logging
import multiprocessing
from test.worker import do_stuf... | <python><logging><multiprocessing><python-multiprocessing><python-logging> | 2025-02-05 23:02:21 | 2 | 336 | Art Gertner |
79,416,288 | 11,202,233 | Django "compilemessages" error: Can't find msgfmt (GNU gettext) on Ubuntu VPS | <p>I am trying to compile translation messages in my Django project by running the following command:</p>
<pre><code>python manage.py compilemessages
</code></pre>
<p>However, I get this error:</p>
<pre><code>CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.
</code></pre>
<p... | <python><django> | 2025-02-05 21:55:46 | 1 | 487 | Genesis Solutions |
79,416,254 | 1,406,168 | Applications insights in an azure function app - metrics and custom dimensions missing | <p>I have some trouble adding logs from an azure function app to application insigths. I am using this code:</p>
<pre><code>import azure.functions as func
import datetime
import logging
import requests
from settings import settings
from services.exchangerate_service import ExchangeRateService
from azure.identity impor... | <python><azure-functions><azure-application-insights> | 2025-02-05 21:35:08 | 1 | 5,363 | Thomas Segato |
79,416,003 | 2,758,524 | Lowpass filter is slower on GPU than CPU in PyTorch | <p>I have been trying out some of the Torchaudio functionalities and I can't seem to figure out why <code>lowpass_biquad</code> is running slower on the GPU than on the CPU. And this is true for other effects like, phaser, flanger, overdrive, which are even slower. Here I am pasting the example for the lowpass filter, ... | <python><audio><pytorch><torchaudio> | 2025-02-05 19:35:02 | 1 | 543 | orglce |
79,415,896 | 1,788,656 | Pandas dataframe info() vs info | <p>Any ideas what the difference between <code>pandas.DataFrame.info</code> and <code>pandas.DataFrame.info()</code> cause each one seems to work and yield different output.</p>
<p>Using the example available on <code>pandas.DataFrame.info</code> <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.in... | <python><python-3.x><pandas><database> | 2025-02-05 18:57:17 | 0 | 725 | Kernel |
79,415,833 | 375,666 | Aligning a point cloud of 2D Mask that was generated from depth camera in ZED | <p>I'm trying a MVP sample that aligns a 2D Mask that is generating by converting it to point cloud using the depth map generated by ZED Stereo camera.</p>
<p>I'm trying to align a 3D Object file to that point cloud using C# and Unity but for now I'm testing it using python.
The 3D Model and the PCD file is here <a hre... | <python><c#><3d><computer-vision><open3d> | 2025-02-05 18:34:50 | 0 | 1,919 | Andre Ahmed |
79,415,797 | 1,406,168 | ImportError: cannot > import name 'AccessTokenInfo' from 'azure.core.credentials' | <p>I have a FAST API deployed to an Azure function. Locally everything works as expected. However when deployed I get following error. The error already occurs when doing the import:</p>
<pre><code># if I remove this line it works
from azure.identity import DefaultAzureCredential
</code></pre>
<p>Error:</p>
<blockquot... | <python><azure-active-directory><azure-functions><azure-managed-identity> | 2025-02-05 18:22:41 | 1 | 5,363 | Thomas Segato |
79,415,691 | 405,017 | Minimal way to set PYTHONPATH for developing python in VS Code and Jupyter notebook server | <p><em>Related questions that do not apply:</em></p>
<ul>
<li><a href="https://stackoverflow.com/q/58735256/405017">Set PYTHONPATH for local Jupyter Notebook in VS Code</a> - does not apply to running Jupyter server.</li>
<li><a href="https://stackoverflow.com/q/48730312/405017">How to set pythonpath at startup when ru... | <python><jupyter-notebook><jupyter><pythonpath> | 2025-02-05 17:44:00 | 1 | 304,256 | Phrogz |
79,415,456 | 12,281,892 | How to swap background colour of stripes in arviz.plot_forest | <p>This might be a simple question but I can't figure it out. In arviz's <a href="https://python.arviz.org/en/latest/api/generated/arviz.plot_forest.html" rel="nofollow noreferrer">arviz.plot_forest</a>, how can I swap the order of the shaded backgrounds? For instance, in this example figure from their docs, how can I ... | <python><matplotlib><arviz> | 2025-02-05 16:27:06 | 2 | 2,550 | My Work |
79,415,185 | 1,422,096 | How to automate "Retry" on error when copying a file with the Windows Explorer COM model? | <p>I'm automating specific copy operations (that can't be done via normal filesystem copy) with Windows Explorer COM:</p>
<pre><code>import pythoncom
from win32comext.shell import shell
fo = pythoncom.CoCreateInstance(shell.CLSID_FileOperation, None, pythoncom.CLSCTX_ALL, shell.IID_IFileOperation)
fo.CopyItem(src, dest... | <python><windows><com><pywin32><file-copying> | 2025-02-05 14:57:12 | 1 | 47,388 | Basj |
79,415,141 | 14,463,396 | Pandas convert string column to bool but convert typos to false | <p>I have an application that takes an input spreadsheet filled in by the user. I'm trying to bug fix, and I've just noticed that in one True/False column, they've written <code>FLASE</code> instead of <code>FALSE</code>. I'm trying to write in as many workarounds for user error as I can, as the users of this app are... | <python><pandas><boolean> | 2025-02-05 14:45:50 | 2 | 3,395 | Emi OB |
79,414,997 | 9,947,412 | Dagster: preserve multiple sklearn model in asset | <p>I have a linear regression asset in dagster that uses data previously computed and sklearn LinearRegression (Python 10 here).</p>
<p>For each of my input columns (that represents a country, I want to fit a Linear Regression model.</p>
<p>Everything works fine. My question is about <em>outputing</em> these models (or... | <python><scikit-learn><dagster> | 2025-02-05 13:53:24 | 0 | 907 | PicxyB |
79,414,980 | 2,471,910 | Can I re-use browser authentication with python REST? | <p>I am trying to run a REST API with python. I can invoke the API successfully from the browser, but I get authentication errors when doing so from python or from the command line.</p>
<p>I've already authenticated myself with the brower in order to be able to access the API. It is a complicated multi-factor auth wh... | <python><rest><authentication><multi-factor-authentication> | 2025-02-05 13:47:27 | 1 | 2,077 | Trenin |
79,414,937 | 1,635,523 | How to make python print bytes strings as hex code all the way? | <p>So I want to turn a positive integer into a little endian byte string of length 2.</p>
<p>Easy! For example, <code>200</code>:</p>
<pre class="lang-py prettyprint-override"><code>>>> b = int.to_bytes(200, 2, 'little')
b'\xc8\x00'
</code></pre>
<p>However, as soon as we take one that may be interpreted as so... | <python> | 2025-02-05 13:32:06 | 1 | 1,061 | Markus-Hermann |
79,414,916 | 29,295,031 | how to implement custom plotly bubble chart | <p>I new to plotly library , I want to visualize a dafarame into a plotly Bubble chart.</p>
<p>here's the code :</p>
<pre><code>import plotly.graph_objects as go
import plotly.graph_objects as px
import streamlit as st
import pandas as pd
data = {'x': [1.5, 1.6, -1.2],
'y': [21, 16, 46],
'circle-size'... | <python><pandas><plotly><streamlit> | 2025-02-05 13:25:29 | 1 | 401 | user29295031 |
79,414,902 | 9,359,102 | MPEG-DASH(.mpd) implementation similar to my existing methods written currently for .m3u8 | <p>I have the following 2 methods written in python which have been implemented for .m3u8 playlist files</p>
<ul>
<li>Make a master manifest.</li>
<li>Make a Feed manifest.</li>
</ul>
<p>My purpose is to do the same for .mpd manifest files as well. Eventual outcome desired is to have 4 methods : 2 listed above for .m3u... | <python><python-3.x><django-rest-framework><m3u8><mpeg-dash> | 2025-02-05 13:22:43 | 0 | 489 | Earthling |
79,414,891 | 7,454,765 | How to make my dataclass compatible with ctypes and not lose the βdunderβ methods? | <p>Consider a simple data class:</p>
<pre><code>from ctypes import c_int32, c_int16
from dataclasses import dataclass
@dataclass
class MyClass:
field1: c_int32
field2: c_int16
</code></pre>
<p>According to the <a href="https://docs.python.org/3/library/ctypes.html#ctypes.Structure" rel="nofollow noreferrer">do... | <python><ctypes><python-dataclasses> | 2025-02-05 13:18:11 | 2 | 713 | PavelDev |
79,414,809 | 2,164,975 | Access entry from Vaultwarden with Python | <p>I want to use my vaultwarden docker instance on the server to handle multiple passwords securely. Within my python project I want to access one of the stored entries.</p>
<p>To access the vaultwarden I want to use <a href="https://github.com/numberly/python-vaultwarden" rel="nofollow noreferrer">https://github.com/n... | <python><security><password-protection><password-manager> | 2025-02-05 12:50:10 | 1 | 602 | betaros |
79,414,767 | 5,615,873 | abjad.show() issues "FileNotFoundError: [WinError 2] The system cannot find the file specified" in Python | <p>Here's a basic, simple 'abjad' code that one can find in any 'abjad' documentation:</p>
<pre><code>import abjad
n = abjad.Note("c'4")
abjad.show(n)
</code></pre>
<p>And here's the full traceback produced by the above code:</p>
<pre><code>Traceback (most recent call last):
File "R:\W\y.py", line... | <python><venv> | 2025-02-05 12:34:02 | 1 | 3,537 | Apostolos |
79,414,739 | 126,833 | Copying / Syncing files from a pip package that requires additional install to a Prod build of a Dockerfile | <p>I am on this article (<a href="https://www.docker.com/blog/how-to-dockerize-django-app/" rel="nofollow noreferrer">https://www.docker.com/blog/how-to-dockerize-django-app/</a>) to Dockerize a Django App</p>
<p>I have <code>playwright==1.50.0</code> in my requirements.txt</p>
<p>post <code>pip install</code> one has ... | <python><docker><pip><playwright> | 2025-02-05 12:25:28 | 0 | 4,291 | anjanesh |
79,414,713 | 5,137,645 | filter amazon jumpstart models | <p>I found this block of code that allows me to list all of the available jumpstart models in AWS. I wanted to find a list of the key words that I could filter by and the values. Does this exsist somewhere? If not how would I filter the models for ones that are fine tunable.</p>
<pre><code>import IPython
import ipywidg... | <python><amazon-web-services><amazon-sagemaker><amazon-sagemaker-jumpstart> | 2025-02-05 12:14:42 | 0 | 606 | Nikita Belooussov |
79,414,537 | 8,622,976 | mongomock BulkOperationBuilder.add_update() unexpected keyword argument 'sort' | <p>I'm testing a function that performs a bulk upsert using UpdateOne with bulk_write. In production (using the real MongoDB client) everything works fine, but when running tests with <code>mongomock</code> I get this error:</p>
<pre class="lang-bash prettyprint-override"><code>app.mongodb.exceptions.CatalogException: ... | <python><mongodb><pymongo><mongomock> | 2025-02-05 11:09:05 | 1 | 2,103 | Alon Barad |
79,414,508 | 4,614,641 | Matplotlib: font size of the tick labels unit factor | <p>Below is an example plot, where the units are on the scale of 1e-5 and 1e-6, which causes matplotlib to factor this number and display it next to the axis.</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.pyplot as plt
x = np.arange(100) * 1e-8
y = np.random.normal(1e-5, 1e-... | <python><matplotlib> | 2025-02-05 10:58:11 | 0 | 2,314 | PlasmaBinturong |
79,414,500 | 7,804,144 | Verify Keycloak Token from React Frontend in my Flask Python Server using a JWTBearerTokenValidator | <p>I want to verify a Token that is sent to my server using authlib and Keycloak. This is my current setup, although it is not working. Somehow the token in the validate_token() method is always None.</p>
<pre><code>class ClientCredsTokenValidator(JWTBearerTokenValidator):
def __init__(self, issuer):
certs = keyclo... | <python><flask><jwt><keycloak> | 2025-02-05 10:54:14 | 0 | 373 | Karl Wolf |
79,414,360 | 11,863,823 | Why should I use the `type` statement in Python 3.12 and upwards? | <p>In <a href="https://docs.python.org/3/library/typing.html#type-aliases" rel="nofollow noreferrer">the Python documentation</a>, it is stated that I can declare type aliases using the following syntax (Python >=3.12):</p>
<pre class="lang-py prettyprint-override"><code>type Vector = list[float]
</code></pre>
<p>bu... | <python><python-typing> | 2025-02-05 10:04:23 | 0 | 628 | globglogabgalab |
79,414,224 | 3,406,193 | How to annotate a function that preserves type but applies a transformation to certain types in Python? | <p>Let's say I have a function that takes only an argument and is guaranteed to return a value of the same type as the argument. Inside, depending on the specific type of the argument, it will apply some transformations or others.</p>
<p>A minimal example could be something like this:</p>
<pre class="lang-py prettyprin... | <python><python-typing><mypy> | 2025-02-05 09:20:57 | 1 | 4,044 | mgab |
79,414,193 | 10,971,285 | Tlethon RPCError 406: UPDATE_APP_TO_LOGIN When try to run Python script on Raspberry pi 1 b+ | <pre><code>import asyncio
from telethon import TelegramClient, events
from telethon.errors import SessionPasswordNeededError
import logging
import json
import requests
import os
from urllib.parse import unquote
from pathlib import Path
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelnam... | <python><authentication><raspberry-pi><telegram><telethon> | 2025-02-05 09:09:43 | 1 | 1,336 | Savad |
79,414,172 | 2,869,971 | Azure OpenAI Chat Stuck using .Net SDK | <p>I have a program in .Net Core to describe an image using Azure OpenAPI GPT-4o model.</p>
<pre><code>using Azure;
using Azure.AI.OpenAI;
using OpenAI;
using OpenAI.Chat;
using System;
using System.ClientModel;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
// Azure OpenAI client lib... | <python><.net><azure><openai-api><gpt-4o> | 2025-02-05 08:59:28 | 1 | 1,645 | S7H |
79,414,097 | 8,554,833 | Logger Flask Error Not Emailing (works with text error, works stand along) | <p>This is my code and for some reason I can't get it to run.
I was able get it run outside of flask, with a test message <code>logger.error('This is a test error message.')</code> Also I have code pushing an error to a text file that works when I have an error in my application, but this doesn't seem to send an email.... | <python><flask><sendgrid> | 2025-02-05 08:31:45 | 0 | 728 | David 54321 |
79,414,070 | 1,634,905 | SeleniumBase CDP mode execute_script and evaluate with javascript gives error "SyntaxError: Illegal return statement" | <p>I am using <a href="https://seleniumbase.io/examples/cdp_mode/ReadMe/" rel="nofollow noreferrer">SeleniumBase</a> in CDP Mode.</p>
<p>I am having a hard time figuring out if this a python issue or SeleniumBase issue.</p>
<p>The below simple example shows my problem:</p>
<pre><code>from seleniumbase import SB
with S... | <python><selenium-webdriver><undetected-chromedriver><chrome-devtools-protocol><seleniumbase> | 2025-02-05 08:22:10 | 1 | 9,021 | sudoExclamationExclamation |
79,414,030 | 9,560,986 | How can I efficiently read a large CSV file in Python without running out of memory? | <p>I'm working with a large CSV file (over 10 million rows) that I need to process in Python. However, when I try to load the entire file into a pandas DataFrame, I run into memory issues.</p>
<p>What are some efficient ways to read and process large CSV files in Python without running out of memory?</p>
<p>I've consid... | <python><pandas><csv> | 2025-02-05 08:06:35 | 2 | 1,616 | R. Marolahy |
79,414,021 | 196,489 | "LookupError: No installed app with label 'admin'." when using muppy in django | <p>I have a django + drf application that has no admin site, which works very well for us. However, when using pympler and muppy like this:</p>
<pre><code>class DashboardViewSet(
SpecialEndpoint,
):
def list(self, request, *args, **kwargs):
from pympler import tracker
tr = tracker.SummaryTracker... | <python><django> | 2025-02-05 08:02:09 | 1 | 12,904 | Thorben CroisΓ© |
79,414,014 | 3,296,786 | Pytest method mocking | <p>This is the method for which I need to write a test case:</p>
<pre><code>def create_interface(iface, address, netmask):
validate_interface(iface, address, netmask)
if ping_test(address):
raise Exception("Address %s is already in use. interface %s with ip %s." % (address, iface, address))
proc = P... | <python><pytest> | 2025-02-05 07:59:20 | 1 | 1,156 | aΨVaN |
79,413,677 | 13,571,242 | Streamlit error `StreamlitDuplicateElementId` with rendering buttons after calling `empty()` | <p>The following streamlit code will set <code>box</code> to <code>empty()</code>, render a button, set <code>box</code> to <code>empty()</code> again, render another button, and repeat.</p>
<pre class="lang-py prettyprint-override"><code>import streamlit as st
from time import sleep
box = st.empty()
while True:
b... | <python><streamlit> | 2025-02-05 04:55:12 | 0 | 407 | James Chong |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.