QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,958,736 | 2,986,153 | ComputeError: TypeError: np.mean() got an unexpected keyword argument 'axis' | <p>When I try to use numpy.mean within a polars dataframe I get an error message:</p>
<pre><code>import numpy as np #v2.1.0
import polars as pl #v1.6.0
from polars import col
TRIALS = 1
SIMS = 10
np.random.seed(42)
df = pl.DataFrame({
'a': np.random.binomial(TRIALS, .45, SIMS),
'b': np.random.binomial(TRIALS, .5... | <python><python-polars> | 2024-09-06 20:56:56 | 0 | 3,836 | Joe |
78,958,692 | 4,784,683 | SciPy binom.logsf - just a convenience function? | <p>I thought that <code>scipy.stats.binom.log*</code> family of functions were able to return a greater range of values because somehow, they kept all computations in log-space.</p>
<p>But this example shows that both <code>binom.logsf</code> and <code>binom.sf</code> fail due to precision for the same inputs so the <c... | <python><scipy><scipy.stats> | 2024-09-06 20:43:07 | 2 | 5,180 | Bob |
78,958,689 | 2,893,712 | Pandas Add Unique Values from Groupby to Column | <p>I have a dataframe that lists a users codes</p>
<pre><code>UserID Code
123 A
123 B
123 A
456 C
456 D
</code></pre>
<p>How do I add a column that shows all of the users unique codes?</p>
<pre><code>UserID Code UniqueCodes
123 A [A, B]
... | <python><pandas> | 2024-09-06 20:42:39 | 3 | 8,806 | Bijan |
78,958,635 | 1,209,416 | Can't import module from within it in a poetry package | <p>I have a poetry package that looks so:</p>
<pre><code>recon/
- pyproject.toml
- recon/
- main.py
- config.py
</code></pre>
<p>From my <code>main.py</code>, I'm not able to do <code>from recon.config import *</code> - it says <code>"ModuleNotFoundError: No module named 'recon.config'; 'recon' is not a pack... | <python><python-poetry> | 2024-09-06 20:18:12 | 0 | 2,307 | SiddharthaRT |
78,958,556 | 4,272,651 | Alembic migration tests failing for already existing database | <p>I had an already existing database where I had to run migrations.
In attempts to do so, I used alembic and was able to make the migration.</p>
<h2>Step 0: Model already exists.</h2>
<pre><code># models.py
USERS = Table('user', admin_meta,
Column('column1', ...),
Column('column2', ...),
Column('column3', ... | <python><sqlalchemy><alembic> | 2024-09-06 19:44:43 | 1 | 4,746 | Prasanna |
78,958,489 | 10,746,224 | Sort a list of objects based on the index of the object's property from another list | <p>I have a tuple, <code>RELAY_PINS</code> that holds GPIO pin numbers in the order that the relays are installed. <code>RELAY_PINS</code> is immutable, and its ordering does not change, while the order that the devices are defined in changes frequently.</p>
<p>The <strong>MRE</strong>:</p>
<pre><code>from random impo... | <python><python-3.x><list> | 2024-09-06 19:20:22 | 1 | 16,425 | Lord Elrond |
78,958,365 | 23,260,297 | .py file is not a valid Win32 application error | <p>I am trying to run a .py script with the <a href="https://stackoverflow.com/questions/37692780/error-28000-login-failed-for-user-domain-user-with-pyodbc/37702329#37702329">Runas</a> command but I get the following error:</p>
<pre><code>193: C:\temp\module1.py is not a valid Win32 application.
</code></pre>
<p>My com... | <python><windows><runas> | 2024-09-06 18:32:45 | 2 | 2,185 | iBeMeltin |
78,958,124 | 2,986,153 | What qualities of a UDF create a need for map_batches() vs map_elements() in polars? | <p>I am trying to grok when I should expect to need <code>map_batches()</code> and <code>map_elements()</code> in polars. In my example below I am able to obtain the same results (<code>z1:z_3</code>) regardless of which method I use.</p>
<p><strong>What qualities of the UDF, <code>my_sum()</code>, would need to change... | <python><python-polars> | 2024-09-06 17:07:52 | 1 | 3,836 | Joe |
78,958,080 | 9,921,853 | How to recover from pyodbc cursor.fetchall() deadlock | <p>Querying a SQL Server with pyodbc, sometimes <code>cursor.execute()</code> with a SELECT query completes successfully, but <code>cursor.fetchall()</code> gets deadlocked and throws an exception.</p>
<p>Code example:</p>
<pre><code>self.cursor.execute(sql, *values)
self.rowcount = self.cursor.rowcount
results = self.... | <python><sql-server><pyodbc> | 2024-09-06 16:57:33 | 0 | 1,441 | Sergey Nudnov |
78,958,079 | 13,467,891 | Docker build fails while trying to install atari libraries - gymnaisum[atari] : conflicts with ale-py | <p>I am trying to build dockerfile with the below code:</p>
<pre><code>FROM python:3.10
WORKDIR /app
COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
</code></pre>
<p>requirements.txt is as below:</p>
<pre><code>DI-engine==0.5.1
gymnasium[atari]
</code></pre>
<p>and the error message... | <python><docker><pip><reinforcement-learning><gymnasium> | 2024-09-06 16:55:31 | 0 | 715 | Geonsu Kim |
78,958,033 | 6,141,238 | In Python, can I round all printed floats with a single command? | <p>I am working with a Python script that prints many floating point numbers. Within each <code>print</code> command, I use <code>round(x, 3)</code> to round the printed number <code>x</code> to 3 decimal places before printing. Here is a simplified example:</p>
<pre><code>x1 = 1.61803398875
print('x1 = ' + str(round... | <python><floating-point><output><rounding> | 2024-09-06 16:40:03 | 1 | 427 | SapereAude |
78,958,005 | 257,948 | APScheduler in a Python flask app to execute recurring tasks isn't working with Gunicorn | <p>I'm a newbie with Python and flask in general and I'm trying to create (I think) a kind of basic project: I have a flask web app that makes requests every 12 hours to a certain API endpoint and stores the result in a PostgreSQL database.</p>
<p>I'm it works very well in development mode, but as soon as it's deployed... | <python><flask><gunicorn><gevent><apscheduler> | 2024-09-06 16:28:07 | 0 | 12,045 | noloman |
78,957,805 | 1,195,198 | packing python wheel with pybind11 using bazel | <p>I am trying to generate a wheel file using bazel, for a target that has pybind dependencies. The package by itself works fine (though testing), but when I'm packing it, the .so file is missing from the <code>site_packges</code> folder.
This is my build file:</p>
<pre><code>load("@pybind11_bazel//:build_defs.bzl... | <python><bazel><pybind11> | 2024-09-06 15:27:39 | 1 | 1,985 | Mercury |
78,957,769 | 13,023,224 | Pandas 2.0.3? Problems keeping format when file is saved in .json or .csv format | <p>Here is some random code.</p>
<pre><code># create df
import pandas as pd
df2 = pd.DataFrame({'var1':['1_0','1_0','1_0','1_0','1_0'],
'var2':['X','y','a','a','a']})
df2.to_json('df2.json')
# import df
df2 = pd.read_json('df2.json')
df2
</code></pre>
<p>This is the expected output:</p>
<pre><code> ... | <python><pandas><jupyter> | 2024-09-06 15:18:07 | 1 | 571 | josepmaria |
78,957,694 | 1,477,337 | Pandas groupby is changing column values | <p>I have a multiindex Pandas DataFrame and I'm using groupby to extract the rows containing the first appearances of the first index.
After this operation, however, the output column values does not always correspond to the original values.
Here is a simple example to reproduce this behaviour:</p>
<pre><code>df = pd.D... | <python><pandas><group-by> | 2024-09-06 14:57:29 | 1 | 395 | user1477337 |
78,957,615 | 23,260,297 | Cannot Connect to SQL Server Database with SqlAlchemy | <p>I am trying to connect to a SQL Server Database with SqlAlchemy but I get an error message whether I use Windows Authentication or SQL server authentication.</p>
<p>Here is what I have tried:</p>
<pre><code>from sqlalchemy import create_engine
serverName = "server"
driverName = "ODBC Driver 17 for SQ... | <python><sql-server><sqlalchemy> | 2024-09-06 14:34:29 | 0 | 2,185 | iBeMeltin |
78,957,611 | 4,560,370 | Reformat complex file output from an old fortran program to csv using python | <p>I want to convert complex file output into a simpler version, but I can't seem to get the regex right.</p>
<p>I have tried using regex and pandas to convert this weird formatted code to something nicer but the code I'm using just gives headers and not data. The data looks like this (be warned it's horrible), the sam... | <python><pandas><python-re> | 2024-09-06 14:34:14 | 1 | 911 | Pad |
78,957,512 | 22,466,650 | How to find the combination of numbers that sum (or closer) to a given target? | <p>My input is a list of dicts that correspond to tasks :</p>
<pre><code>tasks = [
{'ID': 'ID_001', 'VOLUME': 50, 'STATUS': 'ENDED_OK'},
{'ID': 'ID_002', 'VOLUME': 10, 'STATUS': 'WAITING'},
{'ID': 'ID_003', 'VOLUME': 10, 'STATUS': 'WAITING'},
{'ID': 'ID_004', 'VOLUME': 20, 'STATUS': 'WAITING'},
{'I... | <python><combinations> | 2024-09-06 14:08:11 | 2 | 1,085 | VERBOSE |
78,957,499 | 6,163,621 | cronjob running python script to log - timestamp incorrect | <p>I have a nightly cronjob that runs a python script. The job sends all of the outputs to a log wherein each line is timestamped to the microsecond.</p>
<p>Part of that script includes a loop with a 5-second pause between each iteration. When I was troubleshooting some issues, I noticed that the cronjob timestamp di... | <python><cron><timestamp> | 2024-09-06 14:05:44 | 1 | 9,134 | elPastor |
78,957,463 | 4,129,091 | Convert empty lists to nulls | <p>I have a polars DataFrame with two list columns.</p>
<p>However one column contains empty lists and the other contains nulls.</p>
<p>I would like consistency and convert empty lists to nulls.</p>
<pre><code>
In [306]: df[["spcLink", "proprietors"]]
Out[306]:
shape: (254_654, 2)
┌───────────┬────... | <python><dataframe><python-polars> | 2024-09-06 13:58:59 | 1 | 3,665 | tsorn |
78,957,355 | 1,184,842 | Ansible error python not executable if virtualenv/venv is inside home directory? | <p>in some Ubuntu 22.04 machines I see the following Ansible error:</p>
<pre><code>TASK [pbalucode.postgresql : Create database] ************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"chang... | <python><ansible><virtualenv><python-venv> | 2024-09-06 13:21:37 | 1 | 2,850 | jan |
78,957,338 | 5,168,582 | AWS GLUE python shell with PostgreSQL | <p>I wanted to create AWS GLUE job with Python Shell.
in my py script I have import</p>
<pre><code>from pg import DB
</code></pre>
<p>I wanted to import lib from s3 using</p>
<pre><code>--extra-py-files=s3://${var.glue_bucket}/scripts/PyGreSQL-5.2.3-cp39-cp39-win32.whl
</code></pre>
<p>but I'm getting error</p>
<blockq... | <python><amazon-web-services><aws-glue> | 2024-09-06 13:18:05 | 0 | 1,643 | Mateusz Sobczak |
78,957,250 | 1,838,076 | Pandas FutureWarning about concatenating DFs with NaN-only cols seems wrong | <p>I am getting Future Warning with Pandas 2.2.2 when I try to concatenate DFs with Floating Values and Nones.</p>
<p>But the same won't happen if I use INT instead of FLOAT</p>
<pre><code>import pandas as pd
# Block with INT
df1 = pd.DataFrame({'A': [1], 'B': [4]})
df2 = pd.DataFrame({'A': [2], 'B': [None]})
print(le... | <python><pandas><dataframe> | 2024-09-06 12:54:58 | 1 | 1,622 | Krishna |
78,957,179 | 4,129,091 | Polars cannot infer date columns on DataFrame creation, but succeed in automatic casting afterwards | <p>I have a list of dictionaries, <code>results</code>, with the following schema:</p>
<pre><code>import polars as pl
results = ...
schema = {
"id": pl.Int64,
"title": pl.Utf8,
"proprietors": pl.List(pl.Utf8)
"registrationDate": pl.Date,
}
</code></pre>
<p>When I... | <python><dataframe><python-polars> | 2024-09-06 12:35:56 | 1 | 3,665 | tsorn |
78,957,022 | 6,930,340 | Apply multiple window sizes to rolling aggregation functions in polars dataframe | <p>In a number of aggregation function, such as <a href="https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.rolling_min.html" rel="nofollow noreferrer">rolling_mean</a>, <a href="https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.rolling_min.html" rel="nofollow noreferrer">... | <python><python-polars> | 2024-09-06 11:52:47 | 2 | 5,167 | Andi |
78,957,012 | 10,425,150 | itertools.product in dataframe | <p><strong>Inputs:</strong></p>
<pre><code>arr1 = ["A","B"]
arr2 = [[1,2],[3,4,5]]
</code></pre>
<p><strong>Expected output:</strong></p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th style="text-align: right;"></th>
<th style="text-align: left;">short_list</th>
<th styl... | <python><pandas><dataframe><python-itertools><pandas-explode> | 2024-09-06 11:51:17 | 1 | 1,051 | Gооd_Mаn |
78,956,750 | 5,704,198 | Generating these strategies using Hypothesis (strings with repetitions) | <p>Following a tutorial on Hypothesis I found this problem. I have to do a roundtrip test with a run_length encode/decode (explained in docstrings):</p>
<pre><code>from hypothesis import given, strategies as st
from itertools import groupby
from typing import List, Union
def run_length_encoder(in_string: str) -> Li... | <python><python-hypothesis> | 2024-09-06 10:36:40 | 1 | 1,385 | fabio |
78,956,696 | 1,185,254 | How to make a field read-only in a `mongoengine` Document while allowing conditional updates? | <p>I have a <code>mongoengine</code> document such as:</p>
<pre><code>from mongoengine.document import Document
from mongoengine import StringField
class Class_A(Document):
field_a = StringField()
field_b = StringField()
</code></pre>
<p>I'd like to <em>lock</em> <code>field_b</code> so it cannot be altered, e... | <python><mongodb><orm><attributes><mongoengine> | 2024-09-06 10:23:04 | 1 | 11,449 | alex |
78,956,628 | 9,604,989 | Static type checking or IDE intelligence support for a numpy array/matrix shape possible? | <p>Is it possible to have static type checking or IDE intelligence support for a numpy array/matrix shape?</p>
<p>For example, if I imagine something like this:</p>
<pre><code>A_MxN: NDArray(3,2) = ...
B_NxM: NDArray(2,3) = ...
</code></pre>
<p>Even better would be:</p>
<pre><code>N = 3
M = 2
A_MxN: NDArray(M,N) = .... | <python><numpy><python-typing><mypy><pyright> | 2024-09-06 10:04:51 | 2 | 361 | tobias hassebrock |
78,956,588 | 6,930,340 | Polars selector for columns of dtype pl.List | <p>In the <a href="https://docs.pola.rs/api/python/stable/reference/selectors.html#" rel="noreferrer">polars documentation</a> regarding selectors, there are many examples for selecting columns based on their dtypes. I am missing <code>pl.List</code></p>
<p>How can I quickly select all columns of type <code>pl.List</co... | <python><python-polars> | 2024-09-06 09:54:56 | 1 | 5,167 | Andi |
78,956,523 | 9,554,640 | ValueError: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j | <p>I'm trying to use the Neo4jGraph class from the langchain_community.graphs module in my Python project to interact with a Neo4j database. My script here:</p>
<pre class="lang-py prettyprint-override"><code>from langchain.chains import GraphCypherQAChain
from langchain_community.graphs import Neo4jGraph
from langchai... | <python><neo4j><langchain><graphrag> | 2024-09-06 09:36:23 | 1 | 372 | Dmitri Galkin |
78,956,221 | 898,042 | nrzi signal decoding implementation in python - whats wrong? | <p>solving simple nrzi python decoding. 0 bit means no changed occurred but 1 bit means a change occurred in digital signal sequence.</p>
<pre><code>"_": low signal
'¯': high signal
"|": pipe signal( pipe leads to change of signal and itself pipe is not recorded)
</code></pre>
<p>given input: _ | ¯... | <python><implementation> | 2024-09-06 08:10:08 | 1 | 24,573 | ERJAN |
78,956,198 | 7,841,521 | open Webui : how to create a new chat, sending a question and getting the answer with python | <p>I use open webui to manage different LLM Model. I would like to use it as my central point for llm management. For example if I code a python function to connect to a model, I juste have to change de LLM model name to test another LLM.</p>
<p>But, even considering elements here : https://myopenwebuiurl/api/v1/docs I... | <python><large-language-model> | 2024-09-06 08:03:00 | 0 | 347 | lelorrain7 |
78,955,998 | 6,930,340 | Add new column with multiple literal values to polars dataframe | <p>Consider the following toy example:</p>
<pre><code>import polars as pl
pl.Config(tbl_rows=-1)
df = pl.DataFrame({"group": ["A", "A", "A", "B", "B"], "value": [1, 2, 3, 4, 5]})
print(df)
shape: (5, 2)
┌───────┬───────┐
│ group ┆ value │
│ --- ... | <python><dataframe><python-polars> | 2024-09-06 07:09:08 | 2 | 5,167 | Andi |
78,955,800 | 13,344,453 | I am not able to Overriding django model | <p>I have a django model that has multiple fields</p>
<pre><code>class data(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
pj = ArrayField(models.IntegerField(), null=True, blank=True)
name = models.CharField(max_length=225)
explain = models.TextField(max_length=50, null=True)
... | <python><django><django-models><django-rest-framework> | 2024-09-06 06:01:18 | 2 | 840 | Alphonse Prakash |
78,955,720 | 2,897,115 | sqlachemy: 'tuple' object has no attribute 'label' | <p>I have a model</p>
<pre><code>class Question(Base):
__tablename__ = 'messages'
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True, index=True)
guid: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True),default=uuid.uuid4,index=True, unique=True)
text: Mapped[str]
is_sent_by_user... | <python><sqlalchemy> | 2024-09-06 05:25:57 | 1 | 12,066 | Santhosh |
78,955,459 | 302,274 | Automatically create a free trial Stripe checkout | <p>We use Stripe for our checkout and have a free trial enabled. So when a user comes to the site to enable the free trial they just enter their email in the checkout.</p>
<p>What I would like is to tie the start of the free trial with creating an account on my site. Since I get the user's email with account creation I... | <python><django><stripe-payments> | 2024-09-06 02:56:40 | 1 | 3,035 | analyticsPierce |
78,955,322 | 14,771,666 | sampling unbalanced data frame columns | <p>If I have a data frame <code>df</code>, which has five columns: 'A', 'B', 'C', 'D', and 'E', which contains python strings. Currently, 'B', 'C', 'D', and 'E' has unbalanced unique values (i.e., some unique values have more rows than the others). How can I sample <code>df</code> so that column 'B', 'C', 'D', and 'E' ... | <python><pandas><dataframe> | 2024-09-06 01:38:29 | 0 | 368 | Kaihua Hou |
78,955,311 | 14,771,666 | pytorchvideo.transforms.RandAugment import error | <p>I am trying to run <code>from pytorchvideo.transforms import RandAugment</code> in Python, but it returns the following error:</p>
<pre><code>ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
</code></pre>
<p>I can run <code>import pytorchvideo</code> just fine. I tried uninstalling and... | <python><pytorch><torchvision> | 2024-09-06 01:28:31 | 1 | 368 | Kaihua Hou |
78,955,298 | 1,429,402 | Python opencv draws polygons outside of lines | <p>[edited] It appears there is a new bug in opencv that introduces an issue causing <code>fillPoly</code>'s boundaries to exceed <code>polylines</code>'s.</p>
<p>Here is humble code to draw a red filled polygon with a blue outline.</p>
<pre><code>import cv2
import numpy as np
def draw_polygon(points, resolution=50):
... | <python><opencv><graphics><2d><drawing> | 2024-09-06 01:20:39 | 2 | 5,983 | Fnord |
78,955,112 | 2,192,824 | How to use python regex to get the first occurrence of a substring | <p>I have the following script trying to get the first occurrence of the word "symbol", but it keeps returning the last one (print "symbol in the middle and end"). How can I achieve that with re.search? I need to use re.search so that I can get the contents before and after the first "symbol&qu... | <python><regex> | 2024-09-05 23:09:46 | 4 | 417 | Ames ISU |
78,955,088 | 4,008,485 | What does '()' mean to numpy apply along axis and how does it differ from 0 | <p>I was trying to get a good understanding of numpy apply along axis. Below is the code from the numpy documentation (<a href="https://numpy.org/doc/stable/reference/generated/numpy.apply_along_axis.html" rel="nofollow noreferrer">https://numpy.org/doc/stable/reference/generated/numpy.apply_along_axis.html</a>)</p>
<p... | <python><numpy><numpy-ndarray><numpy-slicing> | 2024-09-05 22:57:01 | 2 | 779 | rert588 |
78,954,956 | 5,454 | Is there a way to configure VSCode to discover Python test files under a subdirectory? | <p>I have a project containing a Python backend and a React frontend. So my file/folder structure looks something like this:</p>
<pre><code>.
├── backend
│ ├── mypackage
│ │ └── main.py
│ ├── tests
│ │ └── test_main.py
│ ├── Dockerfile
│ └── pyproject.toml
├── frontend
│ ├── src
│ │ └── App.js
│ ... | <python><visual-studio-code> | 2024-09-05 21:53:03 | 1 | 10,170 | soapergem |
78,954,825 | 50,385 | How to have an asyncio StreamReader and StreamWriter that work on a buffer? | <p>For writing unit tests for IO code in the past I've used <code>BytesIO</code> instead of a real file/socket/etc. so I can test my functions on hand crafted data. As far as I can tell Python provides no async equivalent; I realize there's no real IO to do for a buffer, but you need classes that obey the same interfac... | <python><async-await><stream><python-asyncio> | 2024-09-05 20:57:14 | 0 | 22,294 | Joseph Garvin |
78,954,770 | 1,658,617 | How can I annotate variadic generics in Python? | <p>I have a generic class:</p>
<pre><code>class A[T]:
pass
</code></pre>
<p>And a function that extracts <code>T</code> from <code>A</code>:</p>
<pre><code>def func[T](arg: A[T]) -> T:
pass
</code></pre>
<p>Now my function can accept <code>*args</code> and extract all <code>Ts</code> from all of the given <code>... | <python><python-typing><variadic-functions> | 2024-09-05 20:40:39 | 0 | 27,490 | Bharel |
78,954,687 | 1,232,087 | Unable to open file in Databricks DBFS | <p>Without using spark or any other external tools, I'm trying to read following file from <code>DBFS</code> FileStore of Databricks. But the following code in a Databricks notebook gives error shown below. File has only few lines:</p>
<pre><code>f = open('/dbfs/FileStore/tables/Test.csv', 'r')
</code></pre>
<blockquot... | <python><databricks><databricks-community-edition> | 2024-09-05 20:13:05 | 0 | 24,239 | nam |
78,954,547 | 2,986,153 | How to display great_tables in databricks | <p>I love the control that the great_tables package offers, but in databricks the table results are outputted in a really vanilla fashion. Is there anyway to display great_tables results in their full splendor within databricks?</p>
<pre><code>from great_tables import GT
GT(pl_ci)
</code></pre>
<p><a href="https://i.ss... | <python><databricks><great-tables> | 2024-09-05 19:22:28 | 0 | 3,836 | Joe |
78,954,432 | 219,159 | Sending a signal from a QThread closes the program | <p>Python 3.11, PyQT6 GUI app, testing on Windows 10. I have a QThread doing some background work, and I'm trying to report progress back via a custom signal:</p>
<pre><code>class TheWindow(QMainWindow):
#...
def on_menu_item(self):
class MyThread(QThread):
def __init__(self, parent):
... | <python><qt><pyqt><pyqt6><qt-signals> | 2024-09-05 18:40:18 | 0 | 61,826 | Seva Alekseyev |
78,954,381 | 825,227 | How to dynamically update a bar plot in Python | <p>I have a barplot that I'd like to update dynamically using data from a dataframe.</p>
<p>The original plot is based on dataframe, <code>d</code>:</p>
<p><strong>d</strong></p>
<pre><code>Position Operation Side Price Size
1 9 0 1 0.7289 -19
2 8 0 1 0.729 -427
3 7 0 1 0.7291 -267... | <python><matplotlib><animation><seaborn><visualization> | 2024-09-05 18:21:59 | 1 | 1,702 | Chris |
78,954,203 | 1,029,902 | Connecting to Coinbase Sandbox API using | <p>I am trying to use Coinbase in Sandbox mode to try out a strategy.</p>
<p>I created an Sandbox API using the instructions here <a href="https://docs.cdp.coinbase.com/exchange/docs/sandbox/" rel="nofollow noreferrer">https://docs.cdp.coinbase.com/exchange/docs/sandbox/</a></p>
<p>However, when I use them in a Python ... | <python><api-key><coinbase-api> | 2024-09-05 17:23:03 | 1 | 557 | Tendekai Muchenje |
78,954,085 | 1,103,069 | Python project with flask doesn't think I have a email column for some reason | <p>I've been trying to follow this <a href="https://www.youtube.com/watch?v=GMppyAPbLYk&t=3705s" rel="nofollow noreferrer">tutorial</a> but I changed my code slightly to understand better, but I'm getting a error that there is a missing column when I'm trying to create a new resource via a post request, I'm utilizi... | <python><flask><alchemy> | 2024-09-05 16:47:37 | 0 | 1,049 | Tom Bird |
78,953,862 | 5,020,803 | Issue with Mismatching GSHHS and Natural Earth Shapefiles | <p>I am trying to plot data for the region of American Samoa but I am having issues with the coastlines. I generally use the higher resolution data from the <a href="https://www.soest.hawaii.edu/pwessel/gshhg/" rel="nofollow noreferrer">Global Self-consistent, Hierarchical, High-resolution Geography Database</a> but th... | <python><matplotlib><cartopy> | 2024-09-05 15:44:48 | 0 | 3,210 | BenT |
78,953,656 | 4,508,605 | AWS Glue python script create multiple files of a specific size not working | <p>I have below <code>Python</code> script where currently it generates several gz files with size <code>4MB</code> in <code>S3 bucket</code>. Its bydeafult what <code>AWS glue</code> has created. But now i want to create multiple files of specific size around <code>100-250MB</code> in <code>s3 bucket</code>. I have tr... | <python><amazon-s3><aws-glue> | 2024-09-05 14:51:44 | 2 | 4,021 | Marcus |
78,953,646 | 7,321,700 | Creating JSON style API call dict from Pandas DF data | <p><strong>Scenario:</strong> I have a dataframe which contains one row of data. Each column is an year and it has the relevant value. I am trying to use the data from this df to create a json style structure to pass to an API requests.post.</p>
<p><strong>Sample DF:</strong></p>
<pre><code>+-------+-------+-------+--... | <python><json><pandas><dataframe> | 2024-09-05 14:48:49 | 1 | 1,711 | DGMS89 |
78,953,635 | 462,794 | How can I read standard input by lines in a Python one liner? | <p>What is the equivalent of</p>
<pre><code>ls | perl -ne 'print "test $_"'
</code></pre>
<p>in python</p>
<p>I just want to pass the result of a unix command to the python interpreter.</p>
| <python> | 2024-09-05 14:45:18 | 1 | 1,244 | Bussiere |
78,953,424 | 3,965,347 | How do I create a decile column in Python polars? | <p>Let's say I have a column of FICO scores. I'd like to create another column FICO_DECILE that ranks the FICO scores descending and assigns a decile group, i.e. FICO=850 would have FICO_DECILE=1, and something like FICO=360 would have FICO_DECILE=10.</p>
<p>I tried:</p>
<pre><code># decile rank
df1 = df.with_columns(
... | <python><python-polars><ranking><quantile><dense-rank> | 2024-09-05 14:00:14 | 1 | 871 | kstats9pt3 |
78,953,324 | 11,725,056 | How does the data splitting actually work in Multi GPU Inference for Accelerate when used in a batched inference setting? | <p>I followed the code given in this <a href="https://github.com/huggingface/accelerate/issues/2018" rel="nofollow noreferrer">github issue</a> and this <a href="https://medium.com/@geronimo7/llms-multi-gpu-inference-with-accelerate-5a8333e4c5db" rel="nofollow noreferrer">medium blog</a></p>
<p>I ran the batched experi... | <python><pytorch><huggingface-transformers><huggingface><accelerate> | 2024-09-05 13:35:26 | 1 | 4,292 | Deshwal |
78,953,239 | 4,451,315 | Minimum periods in rolling mean | <p>Say I have:</p>
<pre class="lang-py prettyprint-override"><code>data = {
'id': ['a', 'a', 'a', 'b', 'b', 'b', 'b'],
'd': [1,2,3,0,1,2,3],
'sales': [5,1,3,4,1,2,3],
}
</code></pre>
<p>I would like to add a column with a rolling mean with window size 2, with <code>min_periods=2</code>, over <code>'id'</cod... | <python><duckdb> | 2024-09-05 13:17:09 | 1 | 11,062 | ignoring_gravity |
78,953,053 | 1,169,091 | Convert a string literal to a float in Python | <p>I have a string:
"0xFF"
How do I convert it to a float type?</p>
<p>I tried</p>
<pre><code>"0xFF".fromhex()
</code></pre>
<p>and that does not seem to exist.</p>
| <python><types> | 2024-09-05 12:32:57 | 3 | 4,741 | nicomp |
78,952,799 | 4,609,089 | The chatCompletion operation does not work with the specified model gpt-4o-mini | <h2>Context</h2>
<p>I have below the Python code.</p>
<pre><code>client = AzureOpenAI(
api_key = os.getenv("AZURE_OPENAI_API_KEY"),
api_version = os.getenv('AZURE_OPENAI_API_VERSION'),
azure_endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')
)
messages = [
{"role": "user", &... | <python><openai-api><azure-openai><gpt-4o-mini> | 2024-09-05 11:31:11 | 1 | 833 | John |
78,952,771 | 9,318,323 | Powershell script: Loop over executables | <p>I want to run a pretty basic script that has a list of <strong>executables</strong> (different python versions in this case) that runs them one by one in a loop as part of a command.</p>
<p>Example:</p>
<pre><code>$py39 = python # can be full path to an .exe if needed
$py310 = python3.10
$py311 = python3.11
$pythons... | <python><powershell> | 2024-09-05 11:22:56 | 1 | 354 | Vitamin C |
78,952,705 | 5,723,565 | encrypt from java and decrypt from python | AES GCM ncryption | <p>I wanted to encrypt a string from Java and decrypt that encrypted value in Python. using AEC GCM algorytham. below is my java code</p>
<pre><code>import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.Arrays;
import j... | <python><java><spring-boot><aes><aes-gcm> | 2024-09-05 11:04:58 | 1 | 422 | chethankumar |
78,952,621 | 8,037,521 | What is the correct way to downsample with laspy? | <p>I am taking this example from <code>laspy</code> docs where the new <code>LasData</code> is created and written to a file:</p>
<pre><code>import laspy
import numpy as np
# 0. Creating some dummy data
my_data_xx, my_data_yy = np.meshgrid(np.linspace(-20, 20, 15), np.linspace(-20, 20, 15))
my_data_zz = my_data_xx ** ... | <python><laspy> | 2024-09-05 10:44:38 | 3 | 1,277 | Valeria |
78,952,338 | 478,676 | In a flet app I cannot access assets file, I receive a PathAccessException each time | <p>I'm using/learning flet v0.23.2 and every time I access (in read mode) a file on the /assets directory (the path is correct and the directory exists) I get this error:</p>
<pre><code>PathAccessException: Cannot open file, path = 'mypath/assets/icon.png' (OS Error: Operation not permitted, errno = 1)
</code></pre>
<p... | <python><flutter><file><flet> | 2024-09-05 09:42:02 | 1 | 487 | Alessandra |
78,952,264 | 375,666 | Blending an inflated equirectilinear image with another camera image | <p>I'm struggling for this problem for one week. And I can't find a solution, or any approach. I'm wondering is that something impossible to do. I have provided all the information and trying to find a solution.
So I have the following fisheye distorted image, and I'm trying to enhance the fisheye inflated equirectilin... | <python><c++><opencv><computer-vision><camera-calibration> | 2024-09-05 09:25:55 | 1 | 1,919 | Andre Ahmed |
78,952,082 | 1,117,789 | python docx processing encouunter ValueError: WD_COLOR_INDEX has no XML mapping for 'none' | <p>I have google this error and find no-one else encounter this ValueError before. You could see from the traceback log below that the error is triggered by my code line
<code>bg_color = run.font.highlight_color</code>
I guess <code>python-docx</code> library encounter some weird case that it cannot handle? Maybe it's ... | <python><python-3.x><docx><python-docx> | 2024-09-05 08:44:23 | 1 | 5,297 | Allan Ruin |
78,951,985 | 2,050,158 | How to add extra graphical information to a ridge plot | <p>My data consists of several nested categories, for each category I am able to generate a stacked density plot such as the one <a href="https://stackoverflow.com/questions/78812350/how-to-plot-a-mean-line-on-kdeplot-for-each-variable/78812598?noredirect=1#comment138985507_78812598">illustrated here</a></p>
<p>Since I... | <python><matplotlib><seaborn> | 2024-09-05 08:20:32 | 1 | 503 | Allan K |
78,951,893 | 6,658,422 | Seaborn graph in streamlit does not let you customize theme | <p>I would like to modify the theme of a seaborn objects graph displayed through streamlit. However, it seems that the graph only uses the standard theme, disregarding the <code>.theme()</code> part.</p>
<p>The following code in a ipython notebook</p>
<pre><code>import seaborn.objects as so
import seaborn as sns
import... | <python><seaborn><streamlit><seaborn-objects> | 2024-09-05 07:58:53 | 0 | 2,350 | divingTobi |
78,951,740 | 10,912,170 | Remove Exec Command After Execution Or Run in Local Thread | <p>I've created a function in python to execute generic script via <code>exec()</code>. It works perfectly but it creates functions globally. I need to create them locally and run them then I need to remove them.</p>
<p>My example script:</p>
<pre><code>def demo_handler(request):
...
return None
</code></pre>
<... | <python><exec> | 2024-09-05 07:14:02 | 1 | 1,291 | Sha |
78,951,394 | 4,042,083 | Alternative to --install-option in newer python versions | <p>When using python 3.8 I installed PyMQI with the following command:</p>
<pre><code>pip install pymqi --install-option server
</code></pre>
<p>In order to make <code>pip install</code> run as if I had instead issued this command:</p>
<pre><code>python setup.py build server
</code></pre>
<p>I see that in python 3.12 (... | <python><python-3.x> | 2024-09-05 05:22:19 | 0 | 7,534 | Morag Hughson |
78,951,392 | 4,669,984 | How to run a python script without opening docker pseudo tty? | <p>I have a docker image which has gdal libraries and my python code using said libraries. I start into the docker image with '<code>docker run -v path/to/mydata:/data -it localhost/software --name xyz</code>' and then run my python code as '<code>python Processes.py arguments</code>', it runs perfectly fine.</p>
<p>I ... | <python><docker><docker-run> | 2024-09-05 05:21:42 | 1 | 3,136 | Tarun Maganti |
78,951,308 | 5,976,033 | Gemini Status 500 when requesting cache | <p>I'm receiving this status 500 when trying to cache a large text corpus (~1.8M tokens):</p>
<p><strong>Script</strong>:</p>
<pre><code>import vertexai
from vertexai.preview import caching
from vertexai.generative_models import Part
from google.oauth2.service_account import Credentials
def create_new_gemini_cache(di... | <python><google-cloud-vertex-ai> | 2024-09-05 04:39:25 | 1 | 4,456 | SeaDude |
78,951,239 | 17,802,067 | Neovim command to create print statement for Python function arguments | <p>As the title suggests, I had the idea to create a command that can automatically write a print statement for all arguments to the current function I am in. Initially, I wanted to do this for Python functions - as I find myself doing this manually as a debug tool.</p>
<p>For example, take the Python function:</p>
<p... | <python><parsing><lua><neovim><treesitter> | 2024-09-05 03:49:23 | 1 | 324 | Razumov |
78,951,225 | 188,331 | JAX TypeError: 'Device' object is not callable | <p>I found a piece of JAX codes from few years ago.</p>
<pre><code>import jax
import jax.random as rand
device_cpu = None
def do_on_cpu(f):
global device_cpu
if device_cpu is None:
device_cpu = jax.devices('cpu')[0]
def inner(*args, **kwargs):
with jax.default_device(device_cpu):
... | <python><jax> | 2024-09-05 03:41:51 | 1 | 54,395 | Raptor |
78,951,224 | 4,844,789 | Use single arg to pass a list or two separate values in python function | <p>How to use a single argument to pass multiple variables in Python function.</p>
<p>[code]</p>
<pre><code>def f(*args):
a, b, _ = args
print(a, b)
f(10, 2) # two separate values
f([10, 2]) # list
</code></pre>
<p>Output:</p>
<pre><code>Traceback (most recent call last):
File "<stdin>", li... | <python><oop><argument-unpacking> | 2024-09-05 03:41:41 | 3 | 395 | Jeyakumar Kasi |
78,951,033 | 176,269 | Display UTC time in local time with timezone | <p>I'm attempting to display some UTC time in ISO format (<code>2024-09-05T00:00:00</code>), as local time (<code>2024-09-05T09:00:00+0900</code>). It's been challenging to achieve this in an elegant way, ideally only using native Python libraries.</p>
<p>To get a date-time string I do</p>
<pre class="lang-py prettypri... | <python><datetime><timezone> | 2024-09-05 01:48:19 | 1 | 2,391 | Solenoid |
78,950,993 | 10,570,372 | Should timer capture full time for list creation? | <p>Following this <a href="https://stackoverflow.com/questions/33987060/python-context-manager-that-measures-time">Python context manager that measures time</a> I tried myself.</p>
<pre class="lang-py prettyprint-override"><code>from time import perf_counter
class catchtime:
def __enter__(self):
self.star... | <python> | 2024-09-05 01:12:25 | 1 | 1,043 | ilovewt |
78,950,848 | 16,462,878 | get size of PNG from bytes | <p>I am trying to extract the size of an PNG image from a datastream</p>
<p>Consider the starting data of the stream</p>
<pre><code>137 80 78 71 13 10 26 10 0 0 0 13 73 72 68 82 0 0 2 84 0 0 3 74 8 2 0 0 0 195 81 71 33 0 0 0 ...
^ ^ ^ ^ ^ ^
</... | <python><size><png><chunks> | 2024-09-04 23:17:28 | 1 | 5,264 | cards |
78,950,667 | 11,330,010 | Group elements in dataframe and show them in chronological order | <p>Consider the following dataframe, where <code>Date</code> is in the format <code>DD-MM-YYY</code>:</p>
<pre class="lang-none prettyprint-override"><code>Date Time Table
01-10-2000 13:00:03 B
01-10-2000 13:00:04 A
01-10-2000 13:00:05 B
01-10-2000 13:00:06 A
01-10-2000 13:00:07 B
01-10-2000 13:0... | <python><pandas><dataframe><sorting><group-by> | 2024-09-04 21:51:12 | 3 | 407 | NC520 |
78,950,546 | 7,674,262 | Can't mock a AWS S3 Client | <p>I am trying to mock a call to the <strong>get_paginator</strong> function on the Python AWS S3 Client. Here my production code:</p>
<p><em>handler.py</em></p>
<pre><code>import boto3
class RealClass:
def __init__(self):
self.s3_client = boto3.client("s3")
def get_unprocessed_files(self) -... | <python><amazon-s3><mocking><boto3><python-unittest> | 2024-09-04 20:58:31 | 1 | 442 | NeoFahrenheit |
78,950,520 | 2,287,458 | Use format specifier to convert float/int column in polars dataframe to string | <p>I have this code:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({'size': [34.2399, 1232.22, -479.1]})
df.with_columns(pl.format('{:,.2f}', pl.col('size')))
</code></pre>
<p>But is fails:</p>
<pre><code>ValueError - Traceback, line 3
2 df = pl.DataFrame({'size': [34.2... | <python><format><python-polars> | 2024-09-04 20:49:48 | 2 | 3,591 | Phil-ZXX |
78,950,432 | 6,580,080 | Is there a scenario where `foo in list(bar)` cannot be replaced by `foo in bar`? | <p>I'm digging into a codebase containing thousands of occurrences of <code>foo in list(bar)</code>, e.g.:</p>
<ul>
<li><p>as a boolean expression:</p>
<pre class="lang-py prettyprint-override"><code>if foo in list(bar) or ...:
...
</code></pre>
</li>
<li><p>in a for loop:</p>
<pre class="lang-py prettyprint-overrid... | <python> | 2024-09-04 20:18:09 | 5 | 1,177 | ebonnal |
78,950,364 | 10,053,485 | Abstract Base Class property setter absence not preventing Class instantiation | <p>I'm trying to get abstract properties to work, enforcing property getter & setter definitions in downstream classes.</p>
<pre class="lang-py prettyprint-override"><code>from abc import ABC, abstractmethod
class BaseABC(ABC):
@property
@abstractmethod
def x(self):
pass
@x.setter
@ab... | <python><class><properties><abstract-class> | 2024-09-04 19:58:08 | 2 | 408 | Floriancitt |
78,950,354 | 6,440,589 | How to merge two xml files at a specific level | <p>I want to merge two xml files using Python:</p>
<p><strong>File1.xml</strong></p>
<pre><code><?xml version='1.0' encoding='ASCII'?>
<MyData>
<Elements>
<Element>
<ElementID>15</ElementID>
</Element>
</Elements>
</MyData>
</code></pre>
<p>And <st... | <python><xml><merge><elementtree> | 2024-09-04 19:55:20 | 2 | 4,770 | Sheldon |
78,950,320 | 11,628,353 | How to get all the files in OneDrive account using the graph SDK? | <p>I'm trying to use a service account to pull all files from a OneDrive business account using the MS Graph Python SDK.</p>
<pre><code>import asyncio
from msgraph import GraphServiceClient
from azure.identity import ClientSecretCredential
microsoft_tenant_id = '123abc'
client_id = '123abc'
client_secret = '123abc'
S... | <python><microsoft-graph-api><onedrive><microsoft-graph-sdks> | 2024-09-04 19:44:12 | 2 | 897 | WHOATEMYNOODLES |
78,950,275 | 219,153 | How to get the list of colors used by a default color cycler in Matplotlib? | <p>I would like to explicitly assign colors from <code>colorList</code> to consecutive points on a graph and have them identical to what implicit use of color cycler would produce. For example:</p>
<pre><code>for i, c in enumerate(colorList):
plt.scatter(i, i, color=c)
</code></pre>
<p>would produce the same colors a... | <python><matplotlib><colors> | 2024-09-04 19:29:33 | 0 | 8,585 | Paul Jurczak |
78,950,183 | 1,889,297 | Python hvplot Explorer limit of 10,000 point | <p>Using Python hvplot Explorer is giving nuisance Line plot when using over 10,000 points.
Is that a bug? can I configure the threshold value?</p>
<pre><code>import numpy as np
import pandas as pd
import hvplot.pandas
N=1001
Range = 10
DF = []
for n in range(Range):
x = np.linspace(0.0, 6.4, num=N)
y = np.sin... | <python><hvplot> | 2024-09-04 18:57:49 | 1 | 504 | user1889297 |
78,950,123 | 1,271,079 | Creating an sqlalchemy hybrid_property that read into a property dictionary value | <p>I have a property (<code>parsing</code> in the sample below) that return a dictionary.
I want to be able to filter query results based on a value inside that dictionary.</p>
<p>I tried to follow <a href="https://stackoverflow.com/a/49990926/1271079">this response</a>.</p>
<p>I have the following (simplified) code:</... | <python><sqlalchemy><orm> | 2024-09-04 18:38:16 | 0 | 807 | azerty |
78,950,043 | 391,161 | Is it possible to change the pip config used by bazel? | <p>This is a follow-up to my <a href="https://stackoverflow.com/questions/78946447/is-it-possible-to-change-the-index-url-for-fetching-rules-python-itself-in-baz">previous question</a>.</p>
<p>After resolving that error, I now get the following error, which is another case where a URL needs to be rewritten, but this ti... | <python><linux><pip><bazel> | 2024-09-04 18:13:29 | 1 | 76,345 | merlin2011 |
78,950,011 | 5,134,817 | Segfault when using a function defined in a separate file, but not when defined in the same file | <p>I am trying to write some wrappers using the Python C API to work with NumPy arrays. If I write all my code in one file, the code works fine, tests pass, and everything seems great. If however I try and split the file into some headers, and a few different files, it segfaults, and on the surface of it I can't see wh... | <python><c><numpy> | 2024-09-04 17:59:53 | 1 | 1,987 | oliversm |
78,949,917 | 3,413,122 | How to read subprocess output before process completes | <p>I'm working on a Python project that's making a <code>subprocess.Popen</code> call. That call will output strings before it completes. I want to read those strings in order to track progress.</p>
<p>Currently I'm doing it as such</p>
<pre class="lang-py prettyprint-override"><code>with subprocess.Popen("<my ... | <python><subprocess> | 2024-09-04 17:35:17 | 0 | 1,914 | AndyReifman |
78,949,773 | 2,893,712 | Pandas Groupby and Filter based on first record having date greater than specific date | <p>I have a dataframe that shows details about employees and the site they are at and the positions they have held. The dataframe has columns for Site Id, Employee ID, and StartDate (plus a lot more fields). I have this sorted by Site and Employee ID ASC and then EffectiveDate DESC (latest record is first)</p>
<pre><co... | <python><pandas><group-by> | 2024-09-04 16:51:21 | 3 | 8,806 | Bijan |
78,949,640 | 4,505,998 | Pytest-like verbose asserts in Jupyter Lab | <p>I'm using Jupyter lab and sometimes I want to run some assertions on my data. For example, that all the folds have at least 10 test items.</p>
<p>Nevertheless, when the assert fails, I have to modify the notebook and run it again just to print more information.</p>
<p>Is it possible to get verbose asserts like the o... | <python><pytest><jupyter> | 2024-09-04 16:19:48 | 2 | 813 | David Davó |
78,949,602 | 3,486,684 | Applying a polars Expression to a Polars series | <p>Here's a toy example to illustrate an idea:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
series = pl.Series("x", [0, -1, 1, -1])
def apply_abs_max(series: pl.Series, default: int) -> int:
result = series.abs().max()
if result is None:
return default
else... | <python><python-polars> | 2024-09-04 16:08:03 | 2 | 4,654 | bzm3r |
78,949,473 | 2,359,895 | Display numpy 2D array as an RGBImage | <p>I want to display an <strong>RGBColor</strong> bitmap as an image
I have several functions that fill the bitmap.
also at some point I will add an alpha channel.</p>
<p><em>I saw similar questions but none of them worked for me.</em>
<a href="https://stackoverflow.com/questions/22777660/display-an-rgb-matrix-image-in... | <python><numpy><image> | 2024-09-04 15:37:03 | 1 | 1,195 | Paul Baxter |
78,949,414 | 2,297,965 | Consecutive count of binary column by group | <p>I am attempting to create a 'counter' of consecutive binary values = 1, resetting when the binary value = 0, for each group. Example of data:</p>
<pre><code>data = {'city_id': [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6],
'week... | <python><pandas><dataframe><performance> | 2024-09-04 15:23:56 | 2 | 484 | coderX |
78,949,215 | 3,482,266 | Does a simple assignment in Python evaluate twice? | <p>In <a href="https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements" rel="nofollow noreferrer">this page of Python official reference</a>, there's the following sentence:</p>
<blockquote>
<p>An augmented assignment statement like <code>x += 1</code> can be rewritten as <code>x = x + 1</... | <python> | 2024-09-04 14:36:07 | 4 | 1,608 | An old man in the sea. |
78,949,093 | 20,054,635 | How to Resolve AttributeError: module 'fiona' has no attribute 'path'? | <p>I have a piece of code that was working fine until last week, but now it's failing with the following error:</p>
<p>AttributeError: module 'fiona' has no attribute 'path'</p>
<p>I’ve ensured that all the necessary libraries are installed and imported. Does anyone have any ideas on what might be going wrong or how I ... | <python><dataframe><databricks><geopandas><fiona> | 2024-09-04 14:06:26 | 6 | 369 | Anonymous |
78,949,086 | 967,621 | Install a pre-release version of Python on M1 Mac using conda | <p>I would like to install python 3.13.0rc1 with conda on an M1 Mac.</p>
<p>However, <code>conda create</code> fails with error message "python 3.13.0rc1** is not installable because it requires _python_rc, which does not exist (perhaps a missing channel)":</p>
<pre><code>% conda search python
...
pyth... | <python><macos><installation><conda> | 2024-09-04 14:05:26 | 1 | 12,712 | Timur Shtatland |
78,949,043 | 2,928,970 | Python typing annotation return value annotation based if function argument being a list or not | <p>If I have</p>
<pre><code> def get(
ids: str | list[str] | int | list[int],
) -> float | list[float]:
</code></pre>
<p>Is there a way to specify in return value annotation that a list of <code>float</code>s is output only when the input <code>ids</code> is a list of <code>str</code>s or <code>int</co... | <python><python-typing> | 2024-09-04 13:56:09 | 2 | 1,395 | hovnatan |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.