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,291,346 | 8,458,083 | Is there an analog method to `__args__` for finding the return type in Python? | <p>I'm working with Python's typing system and I've found that I can use <code>__args__</code> to get the argument types of a callable. For example:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Callable
callable_type = Callable[[int, str], float]
print(callable_type.__args__) # Output: (<... | <python> | 2024-12-18 13:55:53 | 0 | 2,017 | Pierre-olivier Gendraud |
79,291,269 | 10,342,604 | Pandas DataFrame Cannot use assign function - Why? | <p>I am encountering some odd behavior in pandas, and I am hoping someone could shed some light on specifics from the <code>df.assign(...)</code> function in a pandas dataframe. I am getting a <code>ValueError</code> when trying to assign to column, despite the function being valid.</p>
<pre class="lang-py prettyprint-... | <python><python-3.x><pandas><dataframe> | 2024-12-18 13:32:58 | 2 | 393 | Chase |
79,291,114 | 569,229 | How to get BCP-47 locale in Python on Windows? | <p>According to <a href="https://learn.microsoft.com/en-us/globalization/locale/other-locale-nameshttps://learn.microsoft.com/en-us/globalization/locale/other-locale-names" rel="nofollow noreferrer">Microsoft's documentation</a> Windows has used IETF BCP locale names since Vista (in other words, they should be used on ... | <python><windows><locale> | 2024-12-18 12:36:38 | 0 | 756 | Reuben Thomas |
79,291,035 | 3,450,026 | robin_stocks Robinhood Authentication Stopped Working | <p>Robinhood Authentication through MFA as described here <a href="https://robin-stocks.readthedocs.io/en/latest/quickstart.html#with-mfa-entered-programmatically-from-time-based-one-time-password-totp" rel="nofollow noreferrer">https://robin-stocks.readthedocs.io/en/latest/quickstart.html#with-mfa-entered-programmatic... | <python><authentication><stock> | 2024-12-18 12:11:55 | 2 | 697 | emmanuelsa |
79,290,968 | 28,837,255 | 'super' object has no attribute '__sklearn_tags__' | <p>I am encountering an AttributeError while fitting an XGBRegressor using RandomizedSearchCV from Scikit-learn. The error message states:</p>
<pre><code>'super' object has no attribute '__sklearn_tags__'.
</code></pre>
<p>This occurs when I invoke the <code>fit</code> method on the RandomizedSearchCV object. I suspect... | <python><machine-learning><scikit-learn><xgboost> | 2024-12-18 11:45:52 | 4 | 333 | Varshith |
79,290,851 | 1,059,860 | make matplotlib plot interactive with Dash | <p>I found <a href="https://stackoverflow.com/a/78402943/1059860">this</a> thread shows how to create and visualise a directed weighted graph.
I improved on the answer provided there, slightly:</p>
<pre><code>import random
import networkx as nx
import matplotlib.pyplot as plt
from netgraph import MultiGraph
def creat... | <python><matplotlib><plotly-dash> | 2024-12-18 11:05:17 | 0 | 2,258 | tandem |
79,290,498 | 4,451,315 | Specify ddof in 'std' in agg | <p>If I have a pandas dataframe and am performing various aggregations, for example</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({'a': [1,1,2], 'b': [4,5,6]})
df.groupby('a').agg({'b': ['sum', 'mean', 'std']})
</code></pre>
<pre><code> b
sum mean std
a
1 9 4.5 0.707107
2 6 6.... | <python><pandas> | 2024-12-18 08:51:21 | 1 | 11,062 | ignoring_gravity |
79,290,432 | 12,870,651 | Python Async Function not updating timestamp | <p>I have a machine running some scripts that I need to keep an eye on.</p>
<p>I have set up a script in python to send me emails using every hour.</p>
<p>I would like to add timestamp to it so that I can see at a glance when was the last message send from the machine to know it's running. When testing this to send ema... | <python><python-asyncio><pywin32><python-datetime> | 2024-12-18 08:31:17 | 1 | 439 | excelman |
79,290,411 | 5,923,374 | HuggingFace Dataset: Load datasets with different set of columns | <p>This is how I load my train and test datasets with HF:</p>
<pre class="lang-py prettyprint-override"><code>dataset = {name.replace('/', '.'): f'{name}/*.parquet' for name in ["train", "test"]}
dataset = load_dataset("parquet", data_files=dataset)
</code></pre>
<p>However, there is a pro... | <python><huggingface-datasets> | 2024-12-18 08:20:11 | 1 | 1,538 | Ford O. |
79,290,374 | 1,000,466 | How do I highlight the VIX plot above 30 level with red color? | <p>I want to highlight the parts of a VIX plot where the index exceeds 30 points in red.</p>
<p>The following example code is as below:</p>
<pre><code>import yfinance as yf
import matplotlib.pyplot as plt
# Fetch VIX data
vix_data = yf.download('^VIX', start='2020-01-01', end='2024-12-31')
# Extract the dates and VIX... | <python><matplotlib><yfinance> | 2024-12-18 08:07:13 | 2 | 745 | Benny Khoo |
79,290,203 | 8,040,369 | Groupby a df column based on more than 3 columns | <p>I have an df which has 3 columns: Region, Country and AREA_CODE.</p>
<pre><code>Region Country AREA_CODE AREA_SUB_CODE_1 AREA_SUB_CODE_2
===========================================================================
AMER US A1 A1_US_1 A1_US_2
AMER CANADA ... | <python><pandas><dataframe> | 2024-12-18 06:48:49 | 3 | 787 | SM079 |
79,290,194 | 6,702,598 | How to run globally installed coverage on a package inside a virtual enviroment? | <p>I'd like to run a coverage check with the following configuration:</p>
<ul>
<li><code>coverage</code> is installed globally on the system (via pipx).</li>
<li><code>pytest</code> in installed inside the virtual environment of the project.</li>
</ul>
<p>(Inside the venv) When I run <code>coverage run -m pytest</code>... | <python><python-3.x><coverage.py> | 2024-12-18 06:43:32 | 0 | 3,673 | DarkTrick |
79,290,131 | 2,218,321 | How to create instance of a Pydantic model with subset fields | <p>This is the model</p>
<pre><code>class UsersInformationModel(BaseDataModel):
id: Optional[int] = None
is_vip: bool = False
creation_tag: Optional[dict] = None # JSON field mapped to a dictionary
user_id: int # Not nullable
created_at: Optional[datetime] = None
updated_at: Optional[datetime]... | <python><pydantic> | 2024-12-18 06:09:12 | 0 | 2,189 | M a m a D |
79,289,826 | 865,220 | Parent the BaseMesh to the rig with automatic weights is not working | <p>I am on blender 3.6.</p>
<p>Goal is to simulate a running/walking animation of a loaded BaseMesh as obj file via python.</p>
<p>Here is my python code:</p>
<pre><code>import bpy
import math
def import_basemesh(filepath):
# Import the BaseMesh OBJ file
bpy.ops.import_scene.obj(filepath=filepath)
basemesh... | <python><animation><blender><bpy> | 2024-12-18 02:23:28 | 0 | 18,382 | ishandutta2007 |
79,289,748 | 3,398,324 | Combing runnable sequence pipeline with constitutional chain | <p>After updating my code to replace LLMChain (deprecated) with the new pipeline approach, I am getting an error because Constitutional Chain does expect the old LLMChain format. Can anyone suggest a solution? Is there a newer way to do this?</p>
<pre><code>#from langchain.chains import LLMChain
from langchain.prompts ... | <python><langchain><py-langchain> | 2024-12-18 01:28:21 | 0 | 1,051 | Tartaglia |
79,289,725 | 26,579,940 | Multiply the value determined for each section | <p>I am in a situation where I need to multiply several columns by the value corresponding to the interval.</p>
<p>I'm using Pandas, but I'm using a for loop to get the value as follows.</p>
<p>I think there is a better way than this, can someone give me some advice?</p>
<p>sample:</p>
<pre><code>import pandas as pd
d... | <python><pandas> | 2024-12-18 01:09:05 | 2 | 404 | white.seolpyo.com |
79,289,579 | 11,117,255 | urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='my-opensearch-domain.com', port=443): Read timed out. (read timeout=15) | <p>I’m running a Python script that bulk-indexes documents into an OpenSearch domain. Sometimes the bulk requests fail with ReadTimeoutError exceptions, similar to what you see below:</p>
<pre><code>Traceback (most recent call last):
File "/.../urllib3/connectionpool.py", line 536, in _make_request
resp... | <python><search><connection><opensearch> | 2024-12-17 23:04:06 | 0 | 2,759 | Cauder |
79,289,546 | 14,122 | Type hints lost when a decorator is wrapped as a classmethod? | <p>Consider the following code:</p>
<pre><code>from typing import Any, Callable, Coroutine
class Cache[**P, R]:
@classmethod
def decorate(cls, **params):
def decorator(f: Callable[P, Coroutine[Any, Any, R]]) -> Callable[P, Coroutine[Any, Any, R]]:
return f # in the real world, we instant... | <python><python-typing><type-parameter><pyright><pep-695> | 2024-12-17 22:40:41 | 2 | 299,045 | Charles Duffy |
79,289,405 | 16,988,223 | why my code can't detect any triangle, square or another shape using opencv | <p>I'm trying detect various shapes by using a video source using opencv with python, however my code only detect "ghost circles", I don't know why happens this behavior. I'm using <a href="https://drive.google.com/file/d/1seJRch_NwhYmInVIJIH712K8ul8-M0RM/view" rel="nofollow noreferrer">this video</a> in my c... | <python><opencv><computer-vision> | 2024-12-17 21:26:20 | 1 | 429 | FreddicMatters |
79,289,373 | 7,124,155 | Are there alternatives to a for loop when parsing free text in Python/PySpark? | <p>I have to read in data in Databricks Python/PySpark but the format is not the usual CSV or JSON so I have to iterate over a for loop. As a result it's very slow.</p>
<p>The data looks like this, for millions of rows. It's not the same format each row, although there are certain common formats:</p>
<p>HEADER0123 a b... | <python><pyspark><databricks> | 2024-12-17 21:12:12 | 1 | 1,329 | Chuck |
79,289,215 | 1,056,174 | Hypothesis: test defensive programming | <p>I'm writing tests with Hypothesis to test functions with restricted range. Consider the following toy example:</p>
<pre><code>import math
from hypothesis import assume, example, given
def inc(value: float) -> float:
assert not math.isnan(value)
return value + 1
@given(st.floats())
def test_inc(value: fl... | <python><python-hypothesis><defensive-programming><property-based-testing> | 2024-12-17 19:53:27 | 2 | 6,651 | Carl Patenaude Poulin |
79,289,117 | 620,679 | Pandoc filter to treat (Python) script output as Markdown | <p>I need a <a href="https://pandoc.org/" rel="nofollow noreferrer">Pandoc</a> filter that takes Python as the code block, runs it, and then treats the output of the script as Markdown. Something like:</p>
<pre><code># Heading
```{.pyscript}
import datetime.datetime
print(f"The current date and time are {str(date... | <python><markdown><pandoc> | 2024-12-17 19:15:59 | 3 | 4,041 | Scott Deerwester |
79,288,904 | 4,886,441 | Unable to match string in SQLite database | <p>I am trying to search for a string in the entire database using Python.</p>
<p>The specific code is</p>
<pre><code>q = 'dopamine'
curr = cur.execute("""SELECT * FROM {} WHERE {} MATCH ? """.format(table_name, table_name), (q,))
</code></pre>
<p>When I try running the same command by loa... | <python><sqlite> | 2024-12-17 17:47:34 | 2 | 377 | Misha |
79,288,829 | 8,874,732 | I have a fastapi server running on ec2 and frontend deployed over amplify. I get CORS error for the first couple of times I call the API and then not | <p>I have a fastapi server running on ec2 and react frontend deployed over amplify. The backend API works fine when i call through postman, but gives CORS issue when used on frontend. The error is gone if i make the request 2 or 3 times in a row automatically.</p>
<p>I did some research and found it has to do with cach... | <python><amazon-ec2><cors><fastapi> | 2024-12-17 17:18:49 | 0 | 717 | Dholu |
79,288,828 | 1,660,121 | Combine Python f-string with printf style formatting? | <p>I need to format a command line where some parameters come from simple variables, and others are the result of a longer expression. Python f-strings work well for the variables, and I'm using a printf-style <code>%s</code> and providing the long expression outside the string because it would just clutter the command... | <python><formatting><f-string> | 2024-12-17 17:18:48 | 3 | 956 | patraulea |
79,288,705 | 3,003,072 | Speed up string assignments to list in Cython | <p>I used <code>re</code> to group a long string, and put the obtained substrings into a list based on conditions specified by a <code>dict</code> to output. I found a significant improvement on the speed using Cython comparing to Python, but would expect a further improvement.
A simple code in <code>temp_test.pyx</cod... | <python><cython> | 2024-12-17 16:41:55 | 1 | 616 | Elkan |
79,288,622 | 1,971,089 | Django - VS Code - custom model manager method typing | <p>I'm trying custom model managers to add annotations to querysets.<br />
My problem, which started as a little annoyance but I now realize can be an actual problem, is that VS Code does not recognise the methods defined in the custom model manager/queryset.</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override... | <python><django><visual-studio-code><django-models> | 2024-12-17 16:16:25 | 3 | 474 | Marco Castanho |
79,288,467 | 4,245,867 | Python selenium: Impossible to close a frame using xpath or class_name | <p>I'm trying to close a frame on <a href="https://www.bvc.com.co/variable-income-local-market/cemargos?tab=issuer-information" rel="nofollow noreferrer">this page</a>.</p>
<p>What I want is to click in here:</p>
<p><a href="https://i.sstatic.net/LJCbiKdr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L... | <python><html><selenium-webdriver> | 2024-12-17 15:32:47 | 3 | 615 | Ivan Castro |
79,288,430 | 4,050,510 | Intall python package with pip, respecting current installation | <p>I want to use a singularity container with jax preinstalled e.g. based on <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/jax" rel="nofollow noreferrer">this image</a>. On top of that, I want to install PyMC with numpyro, to get NUTS sampling with GPU acceleration.
My attempt is to use the def file</p... | <python><pip><jax><singularity-container> | 2024-12-17 15:21:13 | 1 | 4,934 | LudvigH |
79,288,333 | 13,280,838 | How to get input from user for ad hoc manual runs in Snowpark | <p>We have a small piece of code using snowpark using python to be run from inside snowflake. We need to get input from the user for ad hoc manual runs.</p>
<p>For example consider a code that takes <code>start_date</code> and <code>end_date</code> as input from the user. In normal scheduled runs it would be empty and ... | <python><snowflake-cloud-data-platform> | 2024-12-17 14:48:07 | 0 | 669 | rainingdistros |
79,288,237 | 1,145,808 | Linking GMenuModel to actions for context menus in Python Gtk3 | <p>I've built an application using Gtk3 and Gtk.Builder, using GMenuModel for the menus. So far so good. Now I'd like to add context (i.e. right-click) menus.</p>
<p>The menus themselves appear, but as I can't seem to find the right incantation to link the actions, they are always ghosted. Here is my toy code example:<... | <python><gtk3> | 2024-12-17 14:20:26 | 2 | 829 | DobbyTheElf |
79,288,127 | 1,834,164 | How to Set Dask Dashboard Address with SLURMRunner (Jobqueue) and Access It via SSH Port Forwarding? | <p>I am trying to run a <strong>Dask Scheduler and Workers</strong> on a remote cluster using <code>SLURMRunner</code> from <code>dask-jobqueue</code>. I want to bind the Dask <strong>dashboard</strong> to <code>0.0.0.0</code> (so it’s accessible via port forwarding) and access it from my local machine.</p>
<p>However,... | <python><dask><slurm><dask-distributed><dask-jobqueue> | 2024-12-17 13:51:08 | 1 | 397 | user1834164 |
79,287,991 | 13,634,560 | Why does scipy.sparse_matrix not accept values directly from a dataframe? | <p>I create a scipy sparse matrix that works fine</p>
<pre><code>X = csr_matrix(
(df["rating"], (item_idx, user_idx)),
shape=(M, N)
)
</code></pre>
<p>But to simplify where (roughly equivalent)</p>
<pre><code>item_idx ~= df[item_id]
</code></pre>
<p>I do the following</p>
<pre><code>csr_matrix(
(... | <python><scipy> | 2024-12-17 13:06:25 | 2 | 341 | plotmaster473 |
79,287,821 | 14,551,577 | Python CosmosDB upsert_item deletes document | <p>I am going to update a document using <code>upsert_item</code> function of CosmosDB Python SDK.</p>
<p>Here is a script:</p>
<pre><code>from dotenv import load_dotenv
from azure.cosmos import CosmosClient
import os
import uuid
def update():
load_dotenv()
# Initialize the Cosmos DB client
endpoint = os.g... | <python><azure-cosmosdb><azure-cosmosdb-sqlapi><upsert> | 2024-12-17 12:16:34 | 1 | 644 | bcExpt1123 |
79,287,799 | 9,658,774 | How to correctly identify entity types for tokens using spaCy using python? | <p>I'm using spaCy to extract and identify entity types (like ORG, GPE, DATE, etc.) from a text description. However, I am noticing some incorrect results, and I'm unsure how to fix this.</p>
<p>Here is the code I am using:</p>
<pre><code>import spacy
nlp = spacy.load("en_core_web_sm")
def getPayeeName(desc... | <python><machine-learning><nlp><spacy> | 2024-12-17 12:09:49 | 1 | 921 | PrakashT |
79,287,757 | 243,031 | mock motor AsyncIOMotorClient with uuid settings | <p>I have <code>AsyncIOMotorClient</code> code as below.</p>
<pre><code>def get_client():
"""
Get Client.
Get the client for the database connection.
"""
return motor.motor_asyncio.AsyncIOMotorClient(
os.getenv(
"DB_CONN_STR",
... | <python><mongodb><python-asyncio><pymongo> | 2024-12-17 11:54:02 | 0 | 21,411 | NPatel |
79,287,551 | 28,063,240 | Changes detected after squashmigrations | <p><code>python manage.py showmigrations</code> shows:</p>
<pre class="lang-none prettyprint-override"><code>mainapp
[X] 0001_initial
...
[X] 0240_employer_data
[X] 0241_person_metadata
[X] 0242_personemployer_employerworkplace
[X] 0243_personemployer_employed_personemployer_stage
[X] 0244_remove_employerworkplac... | <python><django><django-migrations><makemigrations> | 2024-12-17 10:39:32 | 1 | 404 | Nils |
79,287,524 | 4,828,720 | How to handle ever-changing password in psycopg2? | <p>Similar to <a href="https://stackoverflow.com/questions/57562372/how-to-handle-ever-changing-password-in-sqlalchemypsycopg2">how to handle ever-changing password in sqlalchemy+psycopg2?</a> I an faced with a PostgreSQL setup where passwords are rotated frequently. My application runs longer than a password is valid ... | <python><postgresql><psycopg2> | 2024-12-17 10:34:30 | 1 | 1,190 | bugmenot123 |
79,287,522 | 6,930,340 | Compute percentage of positive rows in a group_by polars DataFrame | <p>I need to compute the percentage of positive values in the <code>value</code> column grouped by the <code>group</code> column.</p>
<pre><code>import polars as pl
df = pl.DataFrame(
{
"group": ["A", "A", "A", "A", "A", "B", "B&quo... | <python><python-polars> | 2024-12-17 10:34:13 | 2 | 5,167 | Andi |
79,287,505 | 3,439,054 | Vectorize objects in python Jax | <p>I am unsure what is the best way to vectorize objects in Python Jax.
In particular, I want to write a code that handles both calling a method from a single instantiation of a class and from multiple (vectorized) instantiations of the class.
In the following, I write a simple example of what I would like to achieve.<... | <python><vectorization><jax> | 2024-12-17 10:29:50 | 1 | 324 | Sam |
79,287,422 | 774,133 | Wrong padding tokens in HF model prediction | <p>Please consider the following code:</p>
<pre class="lang-py prettyprint-override"><code>from datasets import load_dataset_builder, load_dataset
import numpy as np
import os
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, DataCollatorForSeq2Seq, Seq2SeqTrainer, Seq2SeqTrainingArguments
cl... | <python><pytorch><huggingface-tokenizers><huggingface-trainer> | 2024-12-17 10:04:58 | 0 | 3,234 | Antonio Sesto |
79,287,318 | 1,383,029 | VIsual Studio does not accept launch.json (pydebug) | <p>I want to debug my python project using a remote debugger. So I created this launch.json file in .vscode folder of my project.</p>
<pre><code>{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Remote Attach",
... | <python><visual-studio-code><debugging><remote-debugging> | 2024-12-17 09:33:48 | 0 | 2,155 | user1383029 |
79,287,256 | 7,256,443 | Is egg-info still the recommended way to manage python packages installed in editable mode? | <p>I am installing local python package in editable mode, using a <code>pyproject.toml</code> file to configure it. The <code>pyproject.toml</code> looks like this:</p>
<pre class="lang-ini prettyprint-override"><code>[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "s... | <python><python-wheel><egg> | 2024-12-17 09:08:25 | 0 | 1,033 | Ben Jeffrey |
79,287,225 | 6,912,069 | python polars in jupyter lab leads to error due to infer_schema_legth | <p>I often run into data fetching errors when I'm working in JupyterLab and trying to use <code>polars</code> instead of <code>pandas</code> as the dataframe library.</p>
<p>I do this by running the statement</p>
<pre><code>%config SqlMagic.autopolars = True
</code></pre>
<p>However, when I try to fetch some data with ... | <python><jupyter-notebook><python-polars><magic-command> | 2024-12-17 08:57:06 | 0 | 686 | N. Maks |
79,286,793 | 4,423,300 | Error in pip install pypiwin32 in Dockerfile | <p>I am trying to add python modules in Docker. My Dockerfile looks like:</p>
<pre><code>FROM python:3.9
ADD ./src ./src
# ADD main.py .
RUN pip install --upgrade pip
RUN pip install pyyaml
RUN pip install coloredlogs
RUN pip install pypiwin32
# RUN python -m pip install --upgrade pywin32
WORKDIR ./src
CMD ["py... | <python><python-3.x><docker><dockerfile><pywin32> | 2024-12-17 05:51:23 | 1 | 637 | SheCodes |
79,286,671 | 1,870,832 | Open pdf in pdf-js viewer from streamlit app | <p>I have a streamlit app, and I want it to display a pdf in an iframe. My functionality requirements for my pdf viewer/iframe are:</p>
<ul>
<li>I want the pdf to open to a particular (parameterizable) page</li>
<li>I want the pdf to open with particular (parameterizable) quote/text already highlighted</li>
<li>I want ... | <javascript><python><pdf><streamlit><pdf.js> | 2024-12-17 04:04:45 | 0 | 9,136 | Max Power |
79,286,464 | 19,366,064 | UV Python Packing: How to set environment variables in virtual envrionments | <p>How do I set environment variables in virtual environment creating by UV? I try setting it in <code>.venv/scripts/activate_this.py</code> and it doesn't work.</p>
| <python><uv> | 2024-12-17 01:29:35 | 1 | 544 | Michael Xia |
79,286,346 | 8,094,926 | Return something from onclick? | <p>I have a function that creates a chart with pandas & matplotlib. In the function there is an <code>onclick</code> handler that creates a table and then shows it with <code>plt.show()</code> upon click.</p>
<p>When the entire function ends with <code>plt.show()</code>, the chart displays and <code>onclick</code> ... | <python><python-3.x><pandas><matplotlib> | 2024-12-16 23:39:05 | 0 | 468 | chocalaca |
79,286,118 | 5,868,293 | How to calculate daily weights which satisfy certain conditions | <p>I have the following pandas dataframe which represents the consumption of 7 days (<code>day_0</code> is today, <code>day_-1</code> is yesterday etc) of 10 people (<code>ids</code>):</p>
<pre><code>import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(8, 15, size=(10, 7)))
df.columns = ['day_0',... | <python><pandas><numpy><scipy><scipy-optimize> | 2024-12-16 21:29:30 | 1 | 4,512 | quant |
79,286,117 | 4,663,089 | Use attribute name as column name for sqlalchemy in pandas read_sql() | <p>I am using <code>pd.read_sql()</code> together with SQL alchemy. However, it is not using the attribute name of the mapping for the columns in the pandas dataframe, but the original SQL column name:</p>
<pre><code>class DBtable(Base):
name: mapped_column("firstname")
</code></pre>
<p>So in such case, a... | <python><pandas><sqlalchemy><orm> | 2024-12-16 21:29:15 | 0 | 344 | ju. |
79,286,066 | 13,392,257 | Count redis queue length in docker | <p>I have a Celery+Redis python application.</p>
<p>I have to find number of tasks in queue. I trying this command, but the output is zero.
I am confident that queue is not empty.</p>
<pre class="lang-none prettyprint-override"><code>redis-cli -n 1 -h localhost -p 6379 llen celery
(integer) 0
</code></pre>
<p>I think ... | <python><redis><celery> | 2024-12-16 21:02:45 | 2 | 1,708 | mascai |
79,285,844 | 8,618,242 | 2D stacking and optimizing | <p>I have big rectangle (pallet), and would like to stack boxes (smaller rectangles) in way to optimize space usage, currently my problem is I'm not sure how I can rotate the last row/column properly to maximize the utilization of the available space.</p>
<p>I have tried:</p>
<h3>Rect class</h3>
<pre class="lang-py pre... | <python><matplotlib><optimization><bin-packing> | 2024-12-16 19:21:43 | 1 | 4,115 | Bilal |
79,285,708 | 7,422,352 | How does GIL inserts the interupted thread and waiting threads back into the Ready Queue in Python? | <p><strong>Context:</strong></p>
<p>I am executing the a python program that creates 5 threads as follows:</p>
<pre class="lang-py prettyprint-override"><code>import time
from threading import Thread
def do_work(thread_number):
print(f"Starting thread {thread_number}")
time.sleep(1)
print(f"... | <python><python-3.x><multithreading><gil> | 2024-12-16 18:24:56 | 1 | 5,381 | Deepak Tatyaji Ahire |
79,285,657 | 5,334,367 | Python Mako: JS not working in rendered html | <p>I have got the following folder structure</p>
<pre><code>daemon.py
template.mako
html/
main.html
javascript/
script.js
</code></pre>
<p>Now my daemon is running a wsgi server, using bottle. The endpoint does the following:</p>
<pre class="lang-py prettyprint-override"><code>@route("/main"... | <javascript><python><mako> | 2024-12-16 18:06:00 | 1 | 673 | Robert |
79,285,637 | 13,812,982 | How to get the default parameters of a postGres connection? | <p>I am experiencing an issue where my postGres client connection object goes 'stale' if I have not run a query on it for a while (say 1 hour). I believe it probably involves the idle timeout or stay-live process. Attempting to use the connection object causes the code to block for around 5 minutes before throwing an e... | <python><postgresql><psycopg2> | 2024-12-16 17:58:30 | 0 | 4,331 | DS_London |
79,285,538 | 2,329,474 | Add auth to FastAPI via Middleware and include in OpenAPI | <p><em>Basic goal</em>: A means of authenticating most (but not all) routes in one place (a separate file), seamlessly so that I don't have to add code/documentation to every one of the routes in order to get auth or openapi to work.</p>
<p>I would like to implement a basic <code>Bearer</code> Authorization in FastAPI,... | <python><authorization><fastapi><openapi><middleware> | 2024-12-16 17:22:28 | 1 | 373 | dmcblue |
79,285,449 | 17,142,551 | Find average rate per group in specific years using groupby transform | <p>I'm trying to find a better/faster way to do this. I have a rather large dataset (~200M rows) with individual dates per row. I want to find the average yearly rate per group from 2018 to 2019. I know I could create a small df with the results and merge it back in but, I was trying to find a way to use transform. Not... | <python><pandas> | 2024-12-16 16:55:33 | 2 | 1,842 | amance |
79,285,328 | 9,476,917 | API Call working with Postman, failing with Python's request | <p>If I test a postman post request I receive a status code 200 and receive a valid response as expected. When I try to use python's <code>requests</code> library I get the following error code:</p>
<blockquote>
<p>requests.exceptions.ConnectionError:
HTTPSConnectionPool(host='myurl.com', port=443): Max retries exceede... | <python><post><python-requests><request><postman> | 2024-12-16 16:06:45 | 0 | 755 | Maeaex1 |
79,285,301 | 13,546,726 | Whoosh/searching.py name "q" is not defined | <p>I'm using whoosh library version 2.7.4
when trying to use search:</p>
<pre><code>query = rule['parse_tree'].to_whoosh_query()
hits = searcher.search(query, limit = None)
</code></pre>
<p>I'm getting an error inside site-package/whoosh/searching.py:
name 'q' is not defined</p>
<p>What could be causing this error?</p>... | <python><whoosh> | 2024-12-16 15:59:32 | 0 | 309 | Sam324 |
79,285,272 | 4,714,567 | ModuleNotFoundError: No module named 'torch', but torch is installed | <p>I'm trying to use (and have successfully installed) Layout Parser, which requires detectron2 for certain functionality. While trying to install detectron2, I ran into the following error:</p>
<pre><code>> python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
[snip]
ModuleNotFoundEr... | <python><installation><pytorch><pip> | 2024-12-16 15:50:24 | 1 | 1,639 | Niek |
79,285,243 | 320,475 | Python typing and Redis asyncio: telling the type checker to expect an Awaitable | <p>Minimal example:</p>
<pre><code>import redis.asyncio as redis
client = redis.Redis()
client.hset(key, mapping=...)
</code></pre>
<p>Pylance complains about it like so:</p>
<pre><code>"int" is not awaitable
"int" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
"__a... | <python><redis><python-asyncio><python-typing><redis-py> | 2024-12-16 15:43:23 | 0 | 6,157 | maligree |
79,285,068 | 4,436,517 | Setting slice of column to list of values on polars dataframe | <p>In the code below I'm creating a polars- and a pandas dataframe with identical data. I want to select a set of rows based on a condition on column <code>A</code>, then update the corresponding rows for column <code>C</code>. I've included how I would do this with the pandas dataframe, but I'm coming up short on how ... | <python><dataframe><python-polars> | 2024-12-16 14:48:27 | 4 | 1,159 | rindis |
79,285,066 | 6,038,082 | Need help on fixing tkinter error on editing tk.Entry , move button up and saving in file from gui inputs | <p>I have a tkinter gui in Python which reads an input cfg file which looks as below:<br></p>
<p>Input cfg file <br></p>
<pre><code>[job1]
EXEC_PATH = /usr/path
RUNIT = echo job1
TYPES = ['schedule' , 'tumbling']
[job2]
EXEC_PATH = /usr/path
RUNIT = echo job2
PARENTS = job1
TYPES = [ 'tumbling']
[job3]
EXEC_PATH = /u... | <python><tkinter> | 2024-12-16 14:47:48 | 0 | 1,014 | A.G.Progm.Enthusiast |
79,285,011 | 4,788,260 | How does Py4J single-threading model work with FastAPI in a high-concurrency scenario? | <p>I’m integrating Py4J with a FastAPI application where multiple concurrent API requests need to communicate with a Java application. I’ve read the Py4J <a href="https://www.py4j.org/advanced_topics.html#the-single-threading-model" rel="nofollow noreferrer">single-threading model</a> documentation, but I have question... | <python><multithreading><fastapi><py4j> | 2024-12-16 14:31:56 | 0 | 4,065 | Sanjay Sharma |
79,284,760 | 6,572,639 | PyMongo Async client not raising exception when connection fails | <p>It seems that a pymongo 4.10 async client does not raise an exception when there is a problem with the connection.</p>
<p>Taken from <a href="https://pymongo.readthedocs.io/en/stable/async-tutorial.html#making-a-connection-with-asyncmongoclient" rel="nofollow noreferrer">the doc</a>, a test without any mongo DB runn... | <python><mongodb><asynchronous><pymongo> | 2024-12-16 12:58:33 | 1 | 1,352 | Plup |
79,284,739 | 520,556 | Jupyter Notebook shortcut keys are not working anymore | <p>I am running <code>Python</code> 3.11.9 (conda version 24.11.0) on <code>macOS Sonoma</code> 14.7.1. It seems that I cannot use the <code>Jupyter Notebook</code> (<code>ipython</code> version 8.29.0; <code>jupyter notebook</code> version 7.0.6) shortcut keys anymore: I cannot insert a new cell above (A) or below (B)... | <python><jupyter-notebook><hotkeys> | 2024-12-16 12:51:13 | 0 | 1,598 | striatum |
79,284,718 | 6,322,924 | Easiest way to run SLURM on multiple files | <p>I have a Python script that processes approximately 10,000 FITS files one by one. For each file, the script generates an output in the same directory as the input files and creates a single CSV file to record statistics about the processed files.</p>
<p>Previously, I parallelized the script using async with multipro... | <python><jobs><slurm><hpc><sbatch> | 2024-12-16 12:43:24 | 1 | 607 | Falco Peregrinus |
79,284,623 | 9,669,142 | Reindexing only valid with uniquely valued index objects | <p>There are a couple of articles about this issue already, but none of them solve my issue.</p>
<p>I have two sets of Python dataframes (df_A1, df_A2 and df_B1, df_B2) and I want to combine the A's together and the B's together. I can concat the A's just fine, but the B's give me the error 'Reindexing only valid with ... | <python><python-3.x><pandas><concatenation> | 2024-12-16 12:09:43 | 0 | 567 | Fish1996 |
79,284,591 | 5,837,773 | Signature in mexc API - websocket access | <p>I am trying to access websocket user data streams in mexc api. Have read the <a href="https://mexcdevelop.github.io/apidocs/spot_v3_en/#websocket-user-data-streams" rel="nofollow noreferrer">documentation</a> but still have no luck to connect. I believe I need to create listen key first, but have no luck to make a v... | <python><python-requests><bots><signature> | 2024-12-16 11:59:30 | 1 | 409 | Gregor Sotošek |
79,284,479 | 13,280,838 | Snowflake - Error while creating Temp View from snowpark dataframe | <p>Hope you are all doing well.</p>
<p>I am facing a weird issue in Snowpark (Python) while creating a temp view from Dataframe.
I have searched online and while I have had hits, there is no proper solution.</p>
<p><strong>Issue:</strong></p>
<ul>
<li>I have a python list of lists containing date, directory name, file ... | <python><dataframe><snowflake-cloud-data-platform> | 2024-12-16 11:17:11 | 0 | 669 | rainingdistros |
79,284,460 | 1,826,066 | Generate function signature in python from dataclass | <p>I want to have single file that defines a bunch of constants so that I don't need to hardcode them later on.</p>
<p>For example, I would do this:</p>
<pre class="lang-py prettyprint-override"><code>@dataclass(frozen=True)
class CONSTANTS:
STATUS_SUCCESS = 200
STATUS_ERROR = 400
SI_UNIT_MASS = "kg&q... | <python><python-typing> | 2024-12-16 11:12:14 | 1 | 1,351 | Thomas |
79,284,333 | 21,099,067 | Fast static vector implementation in Python | <p>Consider the following two naive implementations of 3D static vectors in Python:</p>
<pre class="lang-py prettyprint-override"><code>class Vec1(tuple):
def __new__(c,x,y,z):
return super().__new__(c,(x,y,z))
def __add__(s,o):
return s.__class__(s[0]+o[0],s[1]+o[1],s[2]+o[2])
def __matmul_... | <python><performance> | 2024-12-16 10:23:28 | 0 | 337 | V T |
79,283,991 | 8,057,071 | Celery max_retries with ack_task=True with reject_on_worker_lost=True | <p>I want to ask a question regarding the usage of <code>max_tries</code> with the options <code>reject_on_worker_lost=True</code> and <code>ack_late=True</code>.</p>
<p>If I enable the above settings below for a task</p>
<pre><code>@shared_task(acks_late=True, reject_on_worker_lost=True, max_retries=4)
</code></pre>
<... | <python><celery> | 2024-12-16 08:05:31 | 0 | 6,127 | Sathiraumesh |
79,283,820 | 5,846,366 | Retrieve specific metrics from AWS Cloudwatch with boto3 | <p>I have a serverless application, which consists of numerous lambda functions. Each lambda function has a tag "STAGE", which is set either to "production" or "staging". What I need now is to retrieve the data on overall invocations for each production lambda function for the last calenda... | <python><amazon-web-services><boto3><amazon-cloudwatch> | 2024-12-16 06:53:16 | 0 | 1,209 | AlexNikolaev94 |
79,283,770 | 6,320,608 | How to force Python multiple processes to share the same memory for one import | <p>I am using the CPU version of PyTorch and need to spawn multiple processes with it. However, whenever I do <code>import torch</code>, a large chunk of memory is consumed (roughly 200 MB as of PyTorch 2.4.0+cpu). This is problematic if I would like to spawn a large number of processes that run PyTorch.</p>
<p>How cou... | <python><pytorch><python-import> | 2024-12-16 06:06:54 | 0 | 2,917 | Bojian Zheng |
79,283,639 | 11,581,214 | Can PyMuPDF be used to make a form field visible and printable? | <p>Is it possible to change the setting (programmatically with PyMuPDF) that allows PDF form fields to be printable? I have been able to read and manipulate form field content, style, and appearance but have been unable to change the field setting to "Visible" from the apparent default value of "Visible ... | <python><pdf-generation><acrobat><pymupdf> | 2024-12-16 04:08:31 | 0 | 524 | BalooRM |
79,283,566 | 1,762,447 | Why am I getting "Part number must be an integer between 1 and 10000" error in S3 multipart upload? | <p>I’m working on uploading a large database dump (~85 GB) to an Amazon S3 bucket using a multipart upload via boto3. However, I keep encountering this error:</p>
<pre><code>botocore.exceptions.ClientError: An error occurred (InvalidArgument) when calling the UploadPart operation: Part number must be an integer between... | <python><amazon-s3><boto3> | 2024-12-16 03:01:19 | 1 | 3,206 | tkyass |
79,283,509 | 899,954 | How to create a Python object that represents a simple hierarchy of self-typed children | <p>I have a simple class in mind, called Page. Page has an ID and a Title. Page can also have child Page's stored in the Page's <code>children</code> attribute.</p>
<p>I thought about doing this:</p>
<pre><code>
class Page:
def __init__(self, id: int, title: str):
self.id = id
self.title = title
self.chi... | <python><object><hierarchy> | 2024-12-16 02:07:43 | 0 | 783 | HanSooloo |
79,283,414 | 4,330,537 | Python and Selenium script and setting focus not working | <p>I have some code I open up a web page and then I try to set focus on a test box so a user can start typing, however when the page opens and the cursor is flashing on the correct text box if the user starts typing the URL bar is where the typing will occur how do I get it to show in the text box?</p>
<pre><code> #... | <python><selenium-webdriver> | 2024-12-16 00:28:05 | 3 | 835 | RobM |
79,283,320 | 12,149,993 | Python signal handler doesn't terminate process before program exits | <p>I'm want to terminate my python script smoothly by using a signal handler. But with a keyboard interruption the handler doesn't finish before the program exits.</p>
<p>Any hints on how to get the handler to do the termination?</p>
<pre><code>import sys,subprocess,signal
def signal_handler(sig, frame):
zipProc.t... | <python><subprocess><signals> | 2024-12-15 22:55:51 | 1 | 494 | Bret Hess |
79,283,291 | 14,503,336 | Virtual environments for Python not working in VSCode | <p>I use the VSCode debugger for all of my Python projects extensively. But for one of my projects, the debugger just doesn't work.</p>
<p>Whenever I try to debug something, it seemingly tries to activate the virtual environment. Then, the debugger just hangs until failure.</p>
<p><a href="https://i.sstatic.net/BLAv5tz... | <python><python-3.x><visual-studio-code><debugging><python-venv> | 2024-12-15 22:33:46 | 1 | 599 | Anonyo Noor |
79,282,843 | 9,482,200 | VS Code and Python: move directory refactor | <p>When I move a .py file in VS Code, the Python extension automatically triggers a refactor, editing imports throughout the project. But it doesn't trigger if I move the entire directory with the .py files.</p>
<p>I've been able to move the entire directory correctly only by dragging and dropping files one by one, or ... | <python><visual-studio-code> | 2024-12-15 17:47:48 | 0 | 360 | Anton Ivanov |
79,282,812 | 4,983,969 | uasyncio.Event not resuming main loop immediately after set on Raspberry Pi Pico | <p>I'm programming in Micropython for the Raspberry Pi Pico. In my main loop I await for an uasyncio.Event, which I successfully set from an interrupt context.</p>
<p>I expected the code to pause and then resume soon after the event was set, but instead:</p>
<ul>
<li>If the event was already set, it continues as expect... | <python><events><interrupt><micropython><raspberry-pi-pico> | 2024-12-15 17:28:38 | 0 | 1,082 | Emilio Martinez |
79,282,810 | 8,124,392 | GAN results fluctuating | <p>I have the following GAN architecture:</p>
<pre><code>import torch, os, torchvision
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms, datasets, utils
class MappingNetwork(nn.Module):
def __init__(self, latent_dim, style_dim):
super(MappingNetwork, self).__init__()
... | <python><deep-learning><pytorch><neural-network><generative-adversarial-network> | 2024-12-15 17:24:46 | 0 | 3,203 | mchd |
79,282,792 | 6,038,082 | How to drag and drop items across frames in tkinter? | <p>I have a tkinter gui which displays some nodes in levels.
The levels are split into frames and on each frame the nodes are placed as per a level dictionary defined in the class Viewer.
I want to drag and drop this nodes from one level to another and as I do that the levels should adjust themselves.<br><br>
For examp... | <python><python-3.x><tkinter> | 2024-12-15 17:10:14 | 2 | 1,014 | A.G.Progm.Enthusiast |
79,282,707 | 2,649,384 | Why does the Python datetime.replace() method return a new object instead of mutate the existing object? | <p>Calling the .replace() method on a Python DateTime object returns a new instance of a DateTime object instead of mutating the existing object. This seems to be a common pitfall when learning the method.</p>
| <python><datetime> | 2024-12-15 16:17:07 | 1 | 4,998 | Izzo |
79,282,555 | 4,767,610 | VScode activate python in powershell terminal and then execute line/selection in the same terminal | <p>I recently reinstalled VScode and I am struggling with the following:</p>
<p>I have set the python.execSelectionInTerminal to Shift+Enter.
Afterwards, I open the default terminal (powershell) and then I activate python by running <code>python</code> in the shell.</p>
<p>My issue is that whenever I execute a line in ... | <python><visual-studio-code> | 2024-12-15 14:53:15 | 0 | 3,092 | User2321 |
79,282,214 | 601,314 | Fails to FadeOut a text in Manim | <p>The methode FadeOut fails with the object effectifs_text, I tried to tinker with scale without success.</p>
<pre><code>from manim import *
import numpy as np
class NormalDistributionNumbers(Scene):
def construct(self):
# Étape 1: Générer une liste de 100 nombres suivant une loi normale N(175, 20), arro... | <python><manim> | 2024-12-15 11:23:47 | 1 | 1,871 | Jean-Pat |
79,282,130 | 16,869,946 | Split a Pandas column of lists with different lengths into multiple columns | <p>I have a Pandas DataFrame that looks like:</p>
<pre><code>ID result
1 [.1,.5]
2 [.4,-.2,-.3,.1,0]
3 [0,.1,.6]
</code></pre>
<p>How can split this column of lists into two columns?</p>
<p>Desired result:</p>
<pre><code>ID result_1 result_2 result_3 result_4 result_5
1 .1 .5 NaN NaN NaN... | <python><pandas> | 2024-12-15 10:17:38 | 2 | 592 | Ishigami |
79,282,088 | 8,831,742 | Turning a grid map array into a shapely object | <p>I have a (2000x2000) python array of 0's and 1's that represent whether a cell is free or not. I'd like to turn this dense representation into a <code>shapely</code> object.
For example, an array of the type:</p>
<pre><code>0 0 0 0
0 1 1 0
0 1 1 0
0 0 0 0
</code></pre>
<p>would become a square.
I tried building one ... | <python><performance><shapely> | 2024-12-15 09:37:53 | 1 | 353 | none none |
79,281,712 | 9,357,484 | Gudhi python library did not show the output for dimension 1 | <p>The following code is for "Homology Groups". I used <a href="https://github.com/GUDHI/TDA-tutorial/blob/master/Tuto-GUDHI-simplex-Trees.ipynb" rel="nofollow noreferrer">library</a> for implementation purpose.</p>
<pre><code>import gudhi
# Create a simplicial complex
simplex_tree = gudhi.SimplexTree()
simp... | <python><topology> | 2024-12-15 02:30:37 | 2 | 3,446 | Encipher |
79,281,613 | 14,149,761 | How to transpose and modify a pandas dataframe based on column values | <p>I have a set of data like below:</p>
<pre><code>name A B C
foo 1 0 0
bar 0 1 0
coo 0 0 1
</code></pre>
<p>That I am trying to alter to look like the table below:</p>
<pre><code> name
A foo
B bar
C coo
</code></pre>
<p>I've done research but have gotten no luck. I'm not sure if it is possible within python.... | <python><pandas> | 2024-12-15 00:32:01 | 5 | 303 | skoleosho97 |
79,281,608 | 9,547,278 | Simple crawler to scrape ICD-11 database using API requests | <p>I tried to make this simple crawler to crawl down the entire ICD-11 database (<a href="https://icd.who.int/browse/2024-01/foundation/en#455013390" rel="nofollow noreferrer">https://icd.who.int/browse/2024-01/foundation/en#455013390</a>) and collect all the titles and descriptions of all diseases, but it keeps stoppi... | <python><web-crawler> | 2024-12-15 00:17:52 | 0 | 474 | Legion |
79,281,233 | 11,092,636 | Unexpected Unresolved attribute reference 'all' for class 'bool' | <p>When I do a matrix multiplication with <code>numpy</code> (Python 3.12.1, numpy 1.26.4, PyCharm 2024.3.1 (Professional Edition)), I get this warning which I believe is wrong:</p>
<blockquote>
<p>Unresolved attribute reference 'all' for class 'bool'</p>
</blockquote>
<p>Proof:
<a href="https://i.sstatic.net/6kQMNnBM.... | <python><numpy><pycharm> | 2024-12-14 19:20:08 | 1 | 720 | FluidMechanics Potential Flows |
79,281,225 | 8,185,618 | Cannot change the default indexType from AutoIndex to HNSW when creating an index in the Milvus collection via the RESTful API | <p>I have successfully created a Milvus collection and inserted data <strong>directly</strong> without any noticeable challenges. Now, I want to create a Milvus collection using the <strong>RESTful API</strong> as detailed in the documentation at <a href="https://milvus.io/api-reference/restful/v2.5.x/v2/Collection%20(... | <python><rest><vector-database><milvus> | 2024-12-14 19:15:01 | 0 | 978 | BarzanHayati |
79,281,123 | 1,440,839 | How to convert contourf values and plot to surface of 3d sphere | <p>I am trying to use matplotlib contourf to generate a contour plot of temperature data. I would then like to map this data onto a 3d sphere. I am using vpython to render the image. The issue I have is that the polygons are not generated across the surface of the sphere, and also there are many gaps in the data. Can s... | <python><matplotlib><scipy><delaunay><scipy-spatial> | 2024-12-14 17:53:17 | 0 | 401 | John |
79,280,931 | 1,478,191 | Override Django Admin Template In 3rd Party Package? | <p>I am developing a Python package which includes a Django addon app. The package is related to authentication so I wanted to extend the <code>django.contrib.admin</code> login page.</p>
<p>Is it possible for my 3rd party package to override another 3rd party package?</p>
<p>The template for the login page is under <c... | <python><django><templates><jinja2> | 2024-12-14 15:49:07 | 1 | 4,290 | recoup8063 |
79,280,838 | 459,745 | After `uv init`, adding script to `[project.scripts]` does not work | <p>I created a new project with uv 0.5.7:</p>
<pre class="lang-bash prettyprint-override"><code>uv init myproject
cd myproject
uv sync
</code></pre>
<p>And my project looks like this:</p>
<pre class="lang-none prettyprint-override"><code>├── hello.py
├── pyproject.toml
├── README.md
└── uv.lock
</code></pre>
<p>At this... | <python><uv> | 2024-12-14 14:53:24 | 3 | 41,381 | Hai Vu |
79,280,773 | 2,475,195 | RuntimeError: Trying to backward through the graph a second time on loss tensor | <p>I have the following training code. I am quite sure I call <code>loss.backward()</code> just once, and yet I am getting the error from the title. What am I doing wrong? Note that the <code>X_train_tensor</code> is output from another graph calculation, so it has <code>required_grad=True</code> as you can see in the ... | <python><deep-learning><pytorch><tensor><autograd> | 2024-12-14 14:11:59 | 2 | 4,355 | Baron Yugovich |
79,280,663 | 310,370 | How to download ffmpeg utilities into Python venv with pip or manual way for torchaudio | <p>torchaudio requiring avutil and other binary dll files</p>
<p>Source : <a href="https://pytorch.org/audio/2.3.0/installation.html" rel="nofollow noreferrer">https://pytorch.org/audio/2.3.0/installation.html</a></p>
<p>However they given example only for Anaconda</p>
<p>I am not using Anaconda but I am using Python 3... | <python><ffmpeg><pip><python-venv><torchaudio> | 2024-12-14 12:57:27 | 1 | 23,982 | Furkan Gözükara |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.