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,177,901 | 12,493,545 | Why does my GitHub linting action fail when using Python 3.12.3 with an Astroid building error? | <p>After changing from Python 3.10.0 to 3.12.3 our workflow fails with:</p>
<pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.3/x64/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
^^^^^^^^^^^^
File &qu... | <python><python-3.x><github-actions><pylint> | 2024-11-11 13:45:41 | 3 | 1,133 | Natan |
79,177,845 | 8,792,159 | matplotlib.patches.Rectangle produces rectangles with unequal size of linewidth | <p>I am using matplotlib to plot the columns of a matrix as separate rectangles using <code>matplotlib.patches.Rectangle</code>. Somehow, all the "inner" lines are wider than the "outer" lines? Does somebody know what's going on here? Is this related to this <a href="https://github.com/matplotlib/ma... | <python><matplotlib><rectangles> | 2024-11-11 13:30:32 | 1 | 1,317 | Johannes Wiesner |
79,177,839 | 20,176,161 | Removing a large number of IDs from a large dataframe takes a long time | <p>I have two dataframes <code>df1</code> and <code>df2</code></p>
<pre><code>print(df1.shape)
(1042009, 40)
print(df1.columns)
Index(['date_acte', 'transaction_id', 'amount', ...],
dtype='object')
print(df2.shape)
(734738, 37)
print(df2.columns)
Index(['date', 'transaction_id', 'amount', ...],
dtype='ob... | <python><pandas><dataframe><contains> | 2024-11-11 13:28:00 | 2 | 419 | bravopapa |
79,177,835 | 538,256 | python pipes deprecated, how to fix | <p>I wrote some years ago an iTunes-replacing program in Python, and recently I started to get a warning <code>DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13</code>.
This is due to the fact that I play my mp3's by mpg123 using the pipes library, e.g. snippets like this scattered here an... | <python><python-3.x><pipe><mpg123> | 2024-11-11 13:26:56 | 2 | 4,004 | alessandro |
79,177,781 | 13,562,186 | For beginners: Module not Found but Requirement already satisfied example using PyPDF2 | <p>This post has two parts:</p>
<ol>
<li><p>To help beginners starting up with creating virtual environments and installing packages for Python in Visual studio Code (I am on MACOS however should be able to follow on windows)</p>
</li>
<li><p>A question of how to Resolve when a module is missing despite the requirement... | <python><visual-studio-code><pypdf> | 2024-11-11 13:12:19 | 2 | 927 | Nick |
79,177,774 | 14,080,363 | How to get the chunk index with Split Skill in azure AI search? | <p>I am new to Azure AI search, I want to get an attribute chunk index from this skillset to know at which index in the document the chunk is located.
the content of pages after he split would looks like this</p>
<pre><code>{'values': [{'recordId': '0', 'data': {'text': 'sample data 1 '}}, {'recordId': '1', 'data': {'t... | <python><azure><azure-ai-search> | 2024-11-11 13:10:05 | 1 | 337 | Yafaa |
79,177,394 | 5,440,712 | Evaluate expression inside custom class in polars | <p>I am trying to extend the functionality of <code>polars</code> to manipulate categories of Enum. I am following <a href="https://stuffbyyuki.com/how-to-add-custom-functionality-in-polars/" rel="nofollow noreferrer">this</a> guide and <a href="https://docs.pola.rs/api/python/stable/reference/api.html" rel="nofollow n... | <python><dataframe><python-polars> | 2024-11-11 11:01:05 | 2 | 3,105 | dmi3kno |
79,177,393 | 17,718,870 | Problems with the reuse of a develeped library | <p>I have been developing a library for quite some time. Its structure is as follows :</p>
<pre><code>pgk1 # central library
... # sub-packages and modules
requirements.txt # relevant dependancies
</code></pre>
<p>This library is only for internal purposes and can't be loaded to PyPI,... | <python><python-import> | 2024-11-11 11:00:56 | 1 | 869 | baskettaz |
79,177,323 | 12,415,855 | "Cannot set a DataFrame with multiple columns to the single column ..." | <p>I have the following dataframe:</p>
<pre><code>Price Adj Close Close High Low Open Volume ema_10 ema_20 ema_40 ema_50 sma_5 sma_10 n_high n_low
Ticker AAPL AAPL AAPL AAPL ... | <python><pandas> | 2024-11-11 10:40:36 | 1 | 1,515 | Rapid1898 |
79,177,302 | 6,930,340 | Polars read_excel incorrectly adds suffix to column names | <p>I am using polars v1.12.0 to read data from an Excel sheet.</p>
<pre><code>pl.read_excel(
"test.xlsx",
sheet_name="test",
has_header=True,
columns=list(range(30, 49))
)
</code></pre>
<p>The requested columns are being imported correctly. However, polars adds a suffix <code>_1</cod... | <python><python-polars> | 2024-11-11 10:34:04 | 1 | 5,167 | Andi |
79,177,247 | 1,236,117 | TqdmCallback writes loss as loss=tf.Tensor(, shape=(), dtype=float32) | <p>I have written a VAE model in Keras following this <a href="https://keras.io/examples/generative/vae/" rel="nofollow noreferrer">example</a>.
The code is working as expected, however, the loss is being printed as
<code>loss=tf.Tensor(, shape=(), dtype=float32)</code>. As seen in the picture.</p>
<p><a href="https://... | <python><tensorflow><keras><tqdm> | 2024-11-11 10:19:50 | 0 | 1,132 | mariolpantunes |
79,176,959 | 8,452,246 | How to properly use function with dataframe argument in another ipywidget interact function | <pre><code>from ipywidgets import interact
import ipywidgets as widgets
import pandas as pd
</code></pre>
<p>I have a dataframe as below:</p>
<pre><code>df = pd.DataFrame(index = [1,2,3],
data = {'col1':[2,3,5],"col2":[2,5,2], "col3":[2,4,3]})
</code></pre>
<p>In addition I have ... | <python><pandas><ipywidgets> | 2024-11-11 08:53:05 | 1 | 477 | Martin Yordanov Georgiev |
79,176,847 | 4,451,315 | How can I use "case when" in DuckDB's relational API? | <p>Say I have</p>
<pre class="lang-py prettyprint-override"><code>data = {'id': [1, 1, 1, 2, 2, 2],
'd': [1, 2, 3, 1, 2, 3],
'sales': [1, 4, 2, 3, 1, 2]}
</code></pre>
<p>My ultimate goal for now is to be able to translate</p>
<pre><code>import duckdb
import polars as pl
df = pl.DataFrame(data)
duckdb.sql(""... | <python><duckdb> | 2024-11-11 08:15:42 | 1 | 11,062 | ignoring_gravity |
79,176,470 | 2,717,063 | How can I ensure that my Python logic runs exclusively on the Apache Ray Worker Nodes? | <p>I am using Apache Ray to create a customized cluster for running my logic. However, when I submit my tasks with ray.remote, they are executing on the driver node rather than on the worker nodes I configured during Ray initialization. How can I ensure that my logic runs exclusively on the worker nodes?</p>
<pre><code... | <python><apache-spark><cluster-computing><azure-databricks><ray> | 2024-11-11 05:14:19 | 1 | 3,018 | question.it |
79,176,467 | 1,230,724 | Check if file is open for writing by another task | <p>Is it possible (in Python under Linux) to determine whether a file is still being written and hasn't been closed yet?</p>
<p>I'm trying to write data to a cache (file) which isn't quite complete yet when other processes are already accessing it. The file/cache then appears corrupted to the processes reading it.</p>
| <python><linux><file><io> | 2024-11-11 05:06:34 | 3 | 8,252 | orange |
79,176,357 | 3,120,501 | Constraining out a region in objective function with OpenMDAO ExecComp | <p>I'm trying to solve for a flight trajectory around (and not over) a rectangular obstacle in the x-y plane. My first attempt at doing this was to create four linked phases, each one within a constrained region (constraints on the x, y and z coordinates), linked at the end points. However, this seems to struggle to co... | <python><optimization><openmdao> | 2024-11-11 04:10:48 | 0 | 528 | LordCat |
79,176,214 | 19,383,865 | Answering WhatsApp Messages With Twilio and Flask | <p>I have set up a Flask application with Twilio to send response via WhatsApp when someone sends a message to it. I already have a domain name, an EC2 instance on AWS, a public IP bound to that instance, and the Flask application running on port 8080. I am able to retrieve the message only when executed the <code>curl... | <python><flask><twilio><whatsapp> | 2024-11-11 02:19:51 | 0 | 715 | Matheus Farias |
79,176,155 | 10,335 | How can I bump the Python package version using uv? | <p>Poetry has the <a href="https://python-poetry.org/docs/cli/#version" rel="noreferrer"><code>version</code></a> command to increment a package version. Does the uv package manager have anything similar?</p>
| <python><python-packaging><uv> | 2024-11-11 01:31:29 | 3 | 40,291 | neves |
79,176,069 | 11,804,921 | GCP Cloud Run Container Behavior - ModuleNotFoundError | <p>When Cloud Run runs a container image, the container fails differently than when I run it locally.</p>
<p>I added this try/except in <code>app/main.py</code> to debug the divergent behaviors:</p>
<pre><code>print(f'cwd is {os.getcwd()}')
try:
from .make_sticker.config import StickerConfig
print('relative wor... | <python><google-cloud-platform><google-cloud-run><uvicorn><fasthtml> | 2024-11-11 00:07:23 | 1 | 783 | harrolee |
79,176,031 | 1,018,322 | Issue with django-crispy-forms and django-filter: CSS class not applying to custom ChoiceFilter field | <p>I'm using <code>django-filter</code> and <code>django-crispy-forms</code> to create a filter form in Django, but I'm having trouble applying a CSS class to a custom <code>ChoiceFilter</code> field. The CSS class is successfully applied to the date field but does not work for the <code>transaction_type</code> field, ... | <python><django><django-filter><django-crispy-forms> | 2024-11-10 23:36:58 | 1 | 1,226 | Slot |
79,176,006 | 48,956 | Why are parameterized queries not possible with DO ... END? | <p>The following works fine:</p>
<pre class="lang-py prettyprint-override"><code>conn = psycopg.connect(self.conn.params.conn_str)
cur = conn.cursor()
cur.execute("""
SELECT 2, %s;
""", (1,),
)
</code></pre>
<p>But inside a <code>DO</code>:</p>
<pre class="lang-py prettyprint-overr... | <python><sql><postgresql><psycopg2> | 2024-11-10 23:08:31 | 2 | 15,918 | user48956 |
79,175,776 | 2,750,563 | Perform operation in-place with xarray | <p>I am going crazy over the following issue: I want to map values from an xarray data array. Since I am constrained on memory, I want to do that in-place, but it just won't work! The code works fine when I save everything in a temp array and assign <code>corine_lc.values</code> to that array. But I cannot do that, OOM... | <python><geopandas><python-xarray><in-place> | 2024-11-10 20:45:47 | 0 | 1,115 | konse |
79,175,600 | 11,809,811 | is it possible to multiply a raylib vector2 with int? | <p>I want to do something like:</p>
<pre><code>from pyray import Vector2
v2 = Vector2(1,2)
print(v2 * 10)
</code></pre>
<p>But I get:</p>
<blockquote>
<p>TypeError: unsupported operand type(s) for *:
'_cffi_backend.__CDataOwn' and 'int'</p>
</blockquote>
<p>Same result if I multiple the vector with a float.</p>
<p>Is... | <python><vector><typeerror><raylib> | 2024-11-10 19:37:42 | 1 | 830 | Another_coder |
79,175,533 | 4,451,315 | Rolling sum using DuckDB's Python relational API | <p>Say I have</p>
<pre class="lang-py prettyprint-override"><code>data = {'id': [1, 1, 1, 2, 2, 2],
'd': [1, 2, 3, 1, 2, 3],
'sales': [1, 4, 2, 3, 1, 2]}
</code></pre>
<p>I want to compute a rolling sum with window of 2 partitioned by 'id' ordered by 'd'</p>
<p>Using SQL I can do:</p>
<pre class="lang-py prettyprint-... | <python><duckdb> | 2024-11-10 18:55:19 | 1 | 11,062 | ignoring_gravity |
79,175,528 | 913,098 | URLDAY API Not working according to published docs | <p>I am trying to use <a href="https://www.urlday.com/developers/links" rel="nofollow noreferrer">URLDAY's API</a> to do anything, but any call returns an error, weather it is from Python code, or from CURL.</p>
<p>Example:</p>
<pre><code>curl --location \
--request POST 'https://www.urlday.com/api/v1/links' \
... | <python><curl><python-requests> | 2024-11-10 18:52:57 | 1 | 28,697 | Gulzar |
79,175,403 | 6,630,397 | Unable to access ifcopenshell sub-modules from any parent level import | <p>Using the <a href="https://pypi.org/project/ifcopenshell/" rel="nofollow noreferrer"><code>ifcopenshell</code></a> (<code>0.8.0</code> at the time of writing) Python 3.11 package available from pypi: (source code on <a href="https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.8.0/src/ifcopenshell-python/ifcopenshel... | <python><python-import><python-module><ifc-open-shell> | 2024-11-10 17:41:01 | 0 | 8,371 | swiss_knight |
79,175,141 | 5,562,431 | How to draw scale-independent horizontal bars with tips in matplotlib? | <p>I want to create a plot that shows genomic coding regions as arrows that may contain colorfully highlighted domain regions.
In principle it is something like this:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.patches as patches
import matplotlib.pyplot as plt
def test(bar... | <python><matplotlib> | 2024-11-10 15:09:56 | 1 | 894 | mRcSchwering |
79,175,107 | 11,071,831 | How to remove multiple items from a dict of lists while keeping the lists in sync in Python | <p>My question is not a duplicate of <a href="https://stackoverflow.com/questions/21345474/remove-elements-from-several-lists-simultaneously">Remove elements from several lists simultaneously</a> because the top solution of the linked question uses a <code>for</code> loop to delete items while iterating over it which I... | <python> | 2024-11-10 14:51:40 | 3 | 440 | Charizard_knows_to_code |
79,175,006 | 11,159,734 | How to properly configure pytest to perform a set of actions before and after all my tests | <p>I want to properly test my FastAPI application. The app uses a local postgres db with an async connection and alembic to do migrations which works fine.</p>
<p>Now I want to properly unit test my application with a real postgres test db. So basically I want to achieve the following:</p>
<ol>
<li>Connect to my postgr... | <python><pytest><fastapi> | 2024-11-10 13:39:54 | 1 | 1,025 | Daniel |
79,174,901 | 1,424,462 | How to get coverage reporting when testing an Ansible lookup plugin | <p>I am developing an Ansible lookup plugin and test code for it. Both the lookup plugin and the test code for the plugin work fine.</p>
<p>I am using pytest with pytest-ansible for that test, and the test function uses the ansible_module fixture provided by pytest-ansible to invoke the builtin set_fact module to invok... | <python><ansible> | 2024-11-10 12:33:20 | 0 | 3,182 | Andreas Maier |
79,174,831 | 2,572,526 | Libreoffice basic: how to pass CellRange variables to python scripts | <p>I'm working on my first python script for Libre office calc.</p>
<p>Following various guides I installed APSO and successfully created a Basic wrapper that calls the python script.<br />
This is its signature:<br />
<code>Function python(functionName As String, ParamArray params) As Variant</code><br />
Where:<br />... | <python><libreoffice-calc><libreoffice-basic> | 2024-11-10 11:49:21 | 1 | 1,289 | user2572526 |
79,174,765 | 6,930,340 | Sending a polars dataframe via email | <p>I am looking for a way to send a <code>pl.DataFrame</code> via email. The email should practically show the result of <code>print(df)</code>. What would be best practice here?</p>
<p>I have already tried to convert the DataFrame to HTML using <code>great_tables.as_raw_html()</code>, but when sending it using Python'... | <python><python-polars><smtplib> | 2024-11-10 11:23:15 | 0 | 5,167 | Andi |
79,174,728 | 7,959,614 | Decode a hex string | <p>I have the following binary data what was saved as a hex</p>
<pre><code>hex_str = '+vcGsHsAIgBpAGQAIgA6ACIAMgAwADQANAA4ADgAOQAwADcAIgAsACIAdAB5AHAAZQ0mGGQAYQB0AGENHChwAGEAeQBsAG8AYQ1IAVQZJAA6BRCYcwB1AGIAcwBjAHIAaQBiAGUAVABvAFUAZgBjAEYAaQBnAGgAdABTBVggdAB1AHMAZQBzBXAAWwVAAGYVJABJDWYBoAg1ADgFoBkeGEMAYQByAGQyJgAAMgUkAH... | <python><hex><decode> | 2024-11-10 11:06:36 | 0 | 406 | HJA24 |
79,174,669 | 9,128,863 | Scipy: calculate orthogonal vector | <p>I'm trying to use Scipy for orthogonal vector calculation:</p>
<pre><code>import numpy as np
from scipy import linalg
e1 = np.float16([-0.913, -0.4072]).reshape(2,1)
e2 = linalg.orth(e1)
print(f'e_1 {e1} ,'
f' ortogonal e2 is {e2}')
</code></pre>
<p>I expected output to be:</p>
<pre><code> e2 is [[-0.407... | <python><vector><scipy> | 2024-11-10 10:34:07 | 1 | 1,424 | Jelly |
79,174,532 | 3,380,131 | How to emulate another theme's style with a tkinter ttk.Checkbutton | <p>I'm using mostly-vanilla Debian Bookworm and Python 3.11.2.</p>
<p>I like the default "themed" tkinter (ttk) widgets except for the checkbutton. If I change from the 'default' theme to the 'alt' theme (in tkinter), the checkbutton looks great but the other widgets look antique :)</p>
<p>default theme:</p>
... | <python><tkinter> | 2024-11-10 09:21:01 | 1 | 1,474 | bitsmack |
79,174,285 | 2,679,476 | Unable to import cv2 in Python Ubuntu environment | <p>My Ubuntu version is :</p>
<pre><code>Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
</code></pre>
<p>I tried to install various ways and they were successful always.</p>
<pre><code>$sudo apt-get install python3-opencv
Reading package lists... Done
Building dependency t... | <python><opencv><ubuntu> | 2024-11-10 06:43:49 | 1 | 459 | user2679476 |
79,174,236 | 14,275,533 | [Airflow]: Dynamic Task Mapping on DockerOperator using Xcoms | <p>I am creating a dag that should do the following:</p>
<ul>
<li>fetch event ids</li>
<li>for each event id, fetch event details ( DockerOperator )</li>
</ul>
<p>The code below is my attempt to do what I want:</p>
<pre class="lang-py prettyprint-override"><code>from datetime import datetime
from airflow.operators.pyt... | <python><docker><airflow><airflow-taskflow><airflow-xcom> | 2024-11-10 06:04:44 | 1 | 451 | lalaland |
79,174,041 | 424,957 | How to calculate the angle from a point to midpoint of a line? | <p>I want to calculate the angle formed by a line segment from p1 to the midpoit of the line connecting p2 and p3, and the line formed by p2 and p3. I used code as below, but the result seems not correct, does anyone help me?</p>
<pre><code>def calculateAngle(point1, point2, point3):
lon1, lat1 = point1
lon2, l... | <python><geometry><angle> | 2024-11-10 02:34:47 | 1 | 2,509 | mikezang |
79,174,023 | 754,136 | Confidence intervals with scipy | <p>I have an array of shape <code>(n, timesteps)</code>, where <code>n</code> is the number of trials and <code>timesteps</code> is the length of each trial. Each value of this array denotes a stochastic measurement.<br />
I would like to implement a generic function that computes a confidence interval for a given stat... | <python><scipy><statistics><confidence-interval><scipy.stats> | 2024-11-10 02:12:32 | 1 | 5,474 | Simon |
79,173,935 | 9,983,172 | python not loading available .pyc file from __pycache__ | <p>I've never needed cached .pyc files until just now, but now I find they aren't working. I have a simple arrangement like a top level script mainscript.py:</p>
<pre><code>import mymodule
mymodule.main()
</code></pre>
<p>and a mymodule.py file with some functionality:</p>
<pre><code>def main():
# do stuff
</code><... | <python><compilation> | 2024-11-10 00:27:26 | 0 | 480 | J B |
79,173,585 | 9,128,863 | Scipy: optimisation with custom step | <p>The task is to find the minimum of function with explicitly defined step.</p>
<p>I went through methods of scipy.optimize package, which use approximation approach (COBYLA, COBYQA), and didn't find any parameters and options, which can be used to pass the step size.</p>
<p>For example:</p>
<pre><code> initial_x_1 = ... | <python><optimization><scipy> | 2024-11-09 19:54:32 | 2 | 1,424 | Jelly |
79,173,414 | 10,452,700 | How can encrypt\encode (Base64) for a generated key including secret message with 2nd public data key in Python? | <p>I'm trying to encrypt the a new generated key using another public key belongs to my friend <code>recipient_public_key</code>, then encode the final output in Base64. This process also can be done step by step <a href="https://kevinsguides.com/guides/security/software/pgp-encryption/#encrypting-files" rel="nofollow ... | <python><encryption><cryptography><base64><gnupg> | 2024-11-09 18:11:24 | 1 | 2,056 | Mario |
79,173,339 | 48,956 | Can never "import x.x" from directory "x" containing "x.py"? | <p>I have installed a custom package <code>pg_util</code> using</p>
<pre><code>cd ~/software/fingerWriterAI/pg_util
pip install -e .
</code></pre>
<p>pg_util has the structure:</p>
<pre><code>pg_util/ # repo directory
pg_util/setup.py
pg_util/pg_util # module directory
pg_util/pg_util/__init__.py # Empty, mar... | <python> | 2024-11-09 17:33:35 | 0 | 15,918 | user48956 |
79,173,187 | 7,483,211 | DeepDiff regex_exclude_paths filters out everything, not just the path I want | <p>I'm using DeepDiff with <code>exclude_regex_paths="['seqid']"</code> to exclude certain fields, but I'm noticing that everything, not just the fields I want to exclude are excluded. Real differences, outside the path to be excluded, aren't being reported.</p>
<p>Here's my code:</p>
<pre class="lang-py pret... | <python><python-deepdiff> | 2024-11-09 16:20:16 | 1 | 10,272 | Cornelius Roemer |
79,173,053 | 726,373 | How to convert character indices to BERT token indices | <p>I am working with a question-answer dataset <code>UCLNLP/adversarial_qa</code>.</p>
<pre><code>from datasets import load_dataset
ds = load_dataset("UCLNLP/adversarial_qa", "adversarialQA")
</code></pre>
<p>How do I map character-based answer indices to token-based indices after tokenizing the con... | <python><nlp><dataset><large-language-model><bert-language-model> | 2024-11-09 15:15:33 | 1 | 642 | Jack Peng |
79,172,783 | 317,797 | Polars SQL CASE | <p>Is this a bug, non-conformant behavior, or standardized behavior? A Polars SQL statement is calculating the average of values based on a condition. The CASE WHEN doesn't include an ELSE because those values should be ignored. Polars complains that an ELSE is required. If I include an ELSE, with no value, it's a synt... | <python><sql><case><python-polars><duckdb> | 2024-11-09 12:42:11 | 2 | 9,061 | BSalita |
79,172,747 | 938,126 | Polars NDCG optimized calculation | <p>The problem here is to implement NDCG calculation on Polars that would be efficient for huge datasets.</p>
<p>Main idea of NDCG is to calculate DCG and IDCG, let's skip the gain part and only think about discount part, which depends on ranks from ideal and proposed orderings.</p>
<p>So the tricky part for me here is... | <python><optimization><python-polars><ranking> | 2024-11-09 12:24:08 | 2 | 363 | Sindbag |
79,172,721 | 15,245,889 | Is there a type to represent any JSON serializable object in Python? | <p>It is my understanding that <code>json.load</code> returns <code>any</code>.</p>
<p>I do not believe I can change the built-in typing, but I think it would be better to use more specific typing in my programs, since not all objects are JSON serializable. However, such list would be long and repetitive.</p>
<p>Are th... | <python><json><python-typing> | 2024-11-09 12:10:53 | 1 | 384 | UCYT5040 |
79,172,585 | 13,802,418 | Kivy Targeting IOS Kivy-ios libffi "C compiler cannot create executables" Error | <p>Im trying to compile simple kivy app to IOS.</p>
<p>System:
-Sonoma 14.6
-Apple M3 Chip</p>
<p><code>main.py</code>:</p>
<pre><code>from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
class MyApp(App):
def build(self):
sel... | <python><ios><kivy> | 2024-11-09 10:55:24 | 1 | 505 | 320V |
79,172,501 | 9,128,863 | Python Scipy: takes 1 positional argument but 2 were given | <p>I'm trying to implement simple optimisation with Scipy lib:</p>
<pre><code> def f1(x):
sum(x)
initial_x_1 = np.ndarray([1])
res = optimize.minimize(f1, initial_x_1, [], 'COBYLA')
</code></pre>
<p>But got the error:</p>
<pre><code> fx = fun(np.copy(x), *args)
^^^^^^^^^^^^^^^^^^^^^^
Ty... | <python><scipy> | 2024-11-09 09:58:22 | 1 | 1,424 | Jelly |
79,172,444 | 9,381,746 | Accessing the end of of a file being written while live plotting of high speed datastream | <p>My question refers to the great answer of the following question:</p>
<p><a href="https://stackoverflow.com/questions/72697369/real-time-data-plotting-from-a-high-throughput-source">Real time data plotting from a high throughput source</a></p>
<p>As the <code>gen.py</code> code of this answer was growing fast, I wro... | <python><numpy><matplotlib><io><seek> | 2024-11-09 09:23:51 | 1 | 5,557 | ecjb |
79,172,419 | 6,145,729 | Extract certain word (case-insensitive) followed by numbers from Pandas df | <p>Can you extract a series of letters and numbers from bad freeform data in a dataframe?</p>
<p>I want to create a new column in the data frame with data that contains 'NEX' and a series of numbers after it.</p>
<pre><code>import pandas as pd
#Create a Dataframe
data = {
'ID':[1,2,3,4,5],
'PROGRAM': [ 'nbu 12... | <python><pandas><dataframe> | 2024-11-09 09:03:46 | 1 | 575 | Lee Murray |
79,171,950 | 298,607 | Have an object serialize itself | <p>With either JSON or Pickle, I can instantiate an object and save that object like so:</p>
<pre><code>import pickle
thing = Thingy(some_data) # takes a while...
# ... do stuff with thing then save it since it mostly is the same
with open(filename, 'wb') as f:
pickle.dump(thing, f)
</code></pre>
<p>And read it b... | <python><json><object><serialization><pickle> | 2024-11-09 01:18:23 | 1 | 104,598 | dawg |
79,171,845 | 6,227,035 | Pymongo - fetch documents by multiple tags | <p>I need to fetch documents given a list of tags, but I am having trouble finding the right syntax. For example, I have this collection:</p>
<pre><code>{
"name": "Mike",
"roll_no": "45",
"branch" : "75",
"tags": [tag1, tag2],
}
{
... | <python><find><pymongo> | 2024-11-08 23:38:15 | 2 | 1,974 | Sim81 |
79,171,727 | 6,145,729 | extract first sequence of numbers from a pandas column | <p>I have imported a CSV into a pandas data frame; however, the column I need to use is freeform and in bad shape.</p>
<p>I need to extract the first series of numbers after the word NBU or the first series of numbers in the string. See some examples below:-</p>
<pre><code>nbu 123456
NBU-123456
nbu/ 123456 blah12
12345... | <python><pandas><dataframe> | 2024-11-08 22:17:07 | 1 | 575 | Lee Murray |
79,171,631 | 309,483 | How do I determine whether a ZoneInfo is an alias? | <p>I am having trouble identifying whether a ZoneInfo is built with an alias:</p>
<pre><code>> a = ZoneInfo('Atlantic/Faeroe')
> b = ZoneInfo('Atlantic/Faroe')
> a == b
False
</code></pre>
<p>It seems like these ZoneInfos are identical in practice. How do I identify that they are the same, as opposed to e.g. E... | <python><timezone><identity><zoneinfo> | 2024-11-08 21:29:32 | 2 | 21,445 | Janus Troelsen |
79,171,553 | 929,732 | Is there a reason that some keys and values will not load in TOML? (Python config import) | <p>I've set up my flask app to read my config file...</p>
<pre><code>app.config.from_file("../CONFIGS/config.py", lambda f: tomllib.load(f.buffer))
f.write(str(app.config))
</code></pre>
<p>when I go to see the output some of the line from the config are there...</p>
<p><code>MY_VARIABLE = "1"</code... | <python><flask><config><python-3.11><toml> | 2024-11-08 21:03:03 | 1 | 1,489 | BostonAreaHuman |
79,171,534 | 6,552,666 | How to write a chat client without waiting for input? | <p>This is my attempt at the loop for an extremely basic IRC client.</p>
<pre><code>while True:
try: ... | <python><sockets><chat> | 2024-11-08 20:52:35 | 0 | 673 | Frank Harris |
79,171,453 | 2,962,555 | chroma in the docker cannot be connected from another docker service | <p>I am trying to talk to chroma service (in docker container) from service-a (also in docker container). However, when I try to <code>ChromaConnector.get_instance()</code>, I got error below:</p>
<pre><code>Could not connect to a Chroma server. Are you sure it is running?
</code></pre>
<p>I tried to do following from ... | <python><docker><docker-compose><chromadb> | 2024-11-08 20:20:29 | 1 | 1,729 | Laodao |
79,171,275 | 6,145,729 | Python using local variables in a module def | <p>Can I access a local variable in a module?</p>
<p>For example my main.py script has the variable <code>a</code> and I want my module function to print <code>a</code></p>
<pre><code># main.py
import sys
import os
sys.path.insert(0, os.path.abspath(r'C:\MyModules'))
import mymodule
a = 'It worked'
mymodule.test()
</c... | <python> | 2024-11-08 19:05:44 | 3 | 575 | Lee Murray |
79,171,112 | 1,028,270 | How do I have a custom logging configuration package that plays nice with 3rd party packages? | <p>The standard way of instantiating a logger is at the module level (from what I understand), so I assume most 3rd party packages do this:</p>
<pre><code># consider this somepackage
import logging
logger = logging.getLogger(__name__)
def blah():
logger.info("slkdjflksjfkld")
...
</code></pre>
<p>But I wa... | <python><python-logging> | 2024-11-08 17:59:42 | 0 | 32,280 | red888 |
79,171,020 | 10,750,541 | Grouped gantt view with legend different than the color used (python) | <p>In need of the community's lights in here to achieve with plotly a gantt view like the following.</p>
<p>The dataframe looks like this, where the subproject is a unique code:</p>
<pre><code>project start end phase decision subproject
1 02-2017 03-2018 Phase_1 09-2023 ... | <python><pandas><plotly><gantt-chart> | 2024-11-08 17:27:50 | 1 | 532 | Newbielp |
79,170,871 | 11,575,738 | Spooky behaviour of JAX | <p>This is a follow-up to my <a href="https://stackoverflow.com/questions/79158791/tracking-test-val-loss-when-training-a-model-with-jax">previous question</a>. I am implementing a Parameterized Quantum Circuit as a Quantum Neural Network, where the optimization loop is jitted. Although there's no error, everything is ... | <python><machine-learning><jit><jax> | 2024-11-08 16:33:17 | 1 | 331 | Sup |
79,170,787 | 51,816 | How to get correct CPU usage like in task manager using Python? | <p>I am using psutil but the values I get is between 0 and 2% whereas the task manager is showing values way above that from 8 to 40% CPU usage. Am I missing something?</p>
<pre><code>import sys
import psutil # To get CPU and RAM usage
from PyQt5 import QtWidgets, QtCore, QtGui
class CircularProgressBar(QtWidgets.QWi... | <python><pyqt><cpu-usage><taskmanager><psutil> | 2024-11-08 16:07:02 | 0 | 333,709 | Joan Venge |
79,170,771 | 4,108,542 | Add UserAgent info to flask log | <p>How to add UserAgent to Flask requests log shown in console?</p>
<pre><code>backend-flask | * Serving Flask app 'generate-ics'
backend-flask | * Debug mode: off
backend-flask | WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
backend-flask | * ... | <python><flask><logging><user-agent> | 2024-11-08 16:04:04 | 1 | 569 | Artem |
79,170,754 | 10,853,071 | Unnesting a pandas json column and keeping an "id" column | <p>I am working on some nested NoSQL data. I would like to unnest it using <code>json_normalize</code> but keep the "id de transação" column so I could merge the resulting dataframe into other dataframes.</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import json
data = {
"i... | <python><pandas><json-normalize> | 2024-11-08 16:00:58 | 2 | 457 | FábioRB |
79,170,651 | 3,387,046 | Why does my Pthon code fails to deploy in Google? | <p>I'm trying to deploy a Python code in Google to fetch its results in VBA. The code runs well in PyCharm but returns error 500 from Google</p>
<p>Requirements</p>
<pre><code> scipy
flask==2.0.3
werkzeug==2.0.3
pandas
numpy
statsmodels
google-cloud-storage
</code></pre>
<p>Python</p>
<pre><c... | <python><google-cloud-platform> | 2024-11-08 15:32:47 | 1 | 463 | user3387046 |
79,170,581 | 831,399 | add optional elements when creating a python tuple | <p>I have to create a truple (or array) with a variable number of elements. Given this minimal example:</p>
<pre class="lang-py prettyprint-override"><code>def do_something(foo: str):
my_tuple = (
"item",
*([foo] if foo is not None else []),
"something"
)
...
</code>... | <python><arrays><tuples> | 2024-11-08 15:11:47 | 2 | 636 | Axel Heider |
79,170,549 | 3,365,532 | Mapping a column inside a dataframe to a new type with Pandas 2.2.3+ | <p>I am used to being able to do things like:</p>
<pre><code>import pandas as pd
df = pd.DataFrame( pd.Categorical(['a','b','b'],['a','b']),columns=['x'])
df.loc[:,'x'] = df['x'].replace({'a':1, 'b':2})
</code></pre>
<p>However, with newer pandas, it throws a warning:</p>
<pre><code>/tmp/ipykernel_1721527/1018712932.py... | <python><pandas><dataframe> | 2024-11-08 15:03:24 | 1 | 443 | velochy |
79,170,297 | 16,389,095 | How to get the list/tree of all the controls added to the page and how to get access to one of them | <p>I developed a simple app with Flet Python. The app contains some controls such as text and buttons organized in rows and columns. Here is my code:</p>
<pre><code>import flet as ft
def main(page: ft.Page):
def Next_Image(e):
print(page.controls)
# CONTROLS DESIGN
cont = ft.Container(bgco... | <python><flutter><flet> | 2024-11-08 13:48:21 | 1 | 421 | eljamba |
79,170,096 | 10,452,700 | How can find key while decrypting the ciphertext? (unknown key) | <p>I want to decrypt the following <em>classical</em> Cipher-text without knowing key:</p>
<pre class="lang-none prettyprint-override"><code>Cq ligss’v vcjandd ujw, wuqjwgausjkq cv ulxucdd zrj mhuouahj lbh nuvl upgoqlm rx mhfmllcyw cqxiueuwaiq kbdjyg ghoahh, xlre jhjmrfuo vuws nr fuwaiqsf vwwuwnv. Sm fqvhj nkjydlm ewwr... | <python><encryption><caesar-cipher><cryptdecrypt> | 2024-11-08 12:49:11 | 1 | 2,056 | Mario |
79,169,993 | 4,529,546 | How to get scikit-learn to ensure that all prediction outputs should sum to 100%? | <p>I have a 'MultiOutputRegressor' which is based on a 'LinearRegression' regressor.
I am using it to predict three outputs per row of X_data (like a classifier) which represent the percentage likelihood of three outcomes.</p>
<p>The regressor is fitted against y_data where the three labels sum correctly to 100%.</p>
<... | <python><scikit-learn><output><linear-regression> | 2024-11-08 12:12:52 | 1 | 1,128 | Richard |
79,169,969 | 13,337,635 | Why can't my Docker container communicate with LocalStack on Apache Airflow? | <p>I'm trying to test a Docker container that interacts with LocalStack using Testcontainers within an Apache Airflow DockerOperator.</p>
<p>In my setup, I have:</p>
<ol>
<li>An Airflow DAG that uses the DockerOperator to run a container.</li>
<li>The container communicates with LocalStack to create an S3 bucket.</li>
... | <python><docker><airflow><testcontainers><localstack> | 2024-11-08 12:07:42 | 0 | 6,877 | yudhiesh |
79,169,887 | 10,708,345 | Flask DEBUG logging not working with dictConfig root confirguration | <p>I do not seem to be able to make logging work. The following does not print anything to console.
I have been digging into the official documentation, SO, and even Reddit... and nothing seems to work for me :/</p>
<pre class="lang-py prettyprint-override"><code>from flask import Flask, request, jsonify
from logging.c... | <python><python-3.x><flask><logging><python-logging> | 2024-11-08 11:42:24 | 1 | 320 | Fi Li Ppo |
79,169,885 | 17,160,160 | Snowflake Connector. Call list as parameter for IN filter | <p><strong>OUTLINE</strong><br />
I'm using Snowflake Connector to pull data from a Snowflake database into my Python notebook.</p>
<p>I have parameters stored separately that are pulled into my query which is stored as an f-string.<br />
I can pull in parameters for use in filters if they contain a single variable:</p... | <python> | 2024-11-08 11:41:51 | 0 | 609 | r0bt |
79,169,598 | 7,699,037 | Type alias in class implementing pydantic base model | <p>I'm trying to use an encapsulated type alias in a pydantic <code>BaseModel</code> class:</p>
<pre><code>class MyClass(BaseModel):
Typ: TypeAlias = int
some_int: Typ = Field(alias="SomeInt")
def print_some_int(some_int: MyClass.Typ):
print(some_int)
</code></pre>
<p>However, when executing this code... | <python><pydantic><type-alias> | 2024-11-08 10:16:56 | 0 | 2,908 | Mike van Dyke |
79,169,564 | 1,409,644 | Specifying non-PyPI dependency | <p>I have written a package <code>first_package</code> with Poetry and installed it to <code>/usr/local</code>, which is on <code>sys.path</code>, so <code>first_package</code> can be imported like any other package installed via the operating system (AlmaLinux 8 in this case).</p>
<p>I have now written another package... | <python><python-poetry> | 2024-11-08 10:04:48 | 0 | 469 | loris |
79,169,561 | 865,220 | Program 'python.bat' failed to run: Access is deniedAt line:1 char:1 | <p>whenever I type <code>python</code> from powershell on windows 10 I get this in user mode:</p>
<pre><code>Program 'python.bat' failed to run: Access is deniedAt line:1 char:1
+ python
+ ~~~~~~.
At line:1 char:1
+ python
+ ~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
... | <python><permissions><windows-10> | 2024-11-08 10:03:07 | 0 | 18,382 | ishandutta2007 |
79,169,550 | 12,569,908 | How to ignore case but not diacritics with Python regex? | <p>I'm working with a set of regex patterns that I have to match in a target text.</p>
<p>My problematic regex is something like this: <code>(İg)[[:punct:][:space:]]+[[:alnum:]]+</code></p>
<p>Initially, I noticed that Python’s <code>re</code> package doesn’t support character classes like <code>[:punct:]</code>. Then ... | <python><regex><unicode><python-re><python-regex> | 2024-11-08 10:01:12 | 2 | 709 | Paolo Magnani |
79,169,280 | 339,144 | pyproject.toml config using setuptools with correct packages automatically | <p>I build wheels using a <code>setuptools</code>-based <code>pyproject.toml</code>.</p>
<p>Here's the relevant bit:</p>
<pre><code>[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = [&quo... | <python><setuptools><python-packaging> | 2024-11-08 08:20:38 | 0 | 2,577 | Klaas van Schelven |
79,169,113 | 3,498,863 | Convert Pandas Dataframe from MultiIndex columns to single index without duplicates | <p>I am comparing two data frames and display the changed values between the data frames at the value level</p>
<p>When the values are different in the data frames, I am getting the results as expected but when the data frames are equal I am getting a Multi Index data frame and trying to convert to normal data frame w... | <python><pandas><dataframe> | 2024-11-08 07:12:10 | 1 | 578 | CNKR |
79,169,105 | 1,942,868 | send post but treated as GET?? rest-framework-bundle | <p>I have api with django rest framework bundle</p>
<p>My api is like this, only accepts <code>POST</code>.</p>
<pre><code>@api_view(["POST"])
@authentication_classes([])
@permission_classes([])
def myapi_v1_result(request):
</code></pre>
<p>then I sent to this api with <code>POST</code> button</p>
<p><a href... | <python><django><django-rest-framework> | 2024-11-08 07:09:21 | 1 | 12,599 | whitebear |
79,168,884 | 72,437 | Double Execution of Firebase Function in Emulator Environment | <p>I've noticed that when running in the Firebase emulator environment, modifying the function and making a single GET request for the first time causes the function to execute twice:</p>
<pre><code>@https_fn.on_request(
cors=options.CorsOptions(
cors_origins=["*"],
cors_methods=["GET... | <python><firebase><google-cloud-functions><firebase-tools> | 2024-11-08 05:15:10 | 0 | 42,256 | Cheok Yan Cheng |
79,168,760 | 6,298,615 | Line does not start with any known Prisma schema keyword error on Python | <p>I'm trying to implement Prisma for a FastAPI project. I added the Prisma package and the <code>schema.prisma</code> file but when I run <code>prisma validate</code> it throws the error:</p>
<pre><code>Environment variables loaded from prisma\.env
Prisma schema loaded from prisma\schema.prisma
Error: Prisma schema v... | <python><postgresql><fastapi><prisma> | 2024-11-08 04:10:45 | 1 | 307 | Jonathan Gómez Pérez |
79,168,752 | 482,819 | Creating a constrained TypeVar from Union | <p>Running mypy on the following code yields no issues.</p>
<pre class="lang-py prettyprint-override"><code>from typing import TypeVar
S = TypeVar("S", int, float, complex)
def func(x: list[S], m: S) -> list[S]:
return [val * m for val in x]
out1: list[int] = func([1, 2, 3], 4)
out2: list[complex] =... | <python><generics><python-typing><mypy> | 2024-11-08 04:04:15 | 1 | 6,143 | Hernan |
79,167,876 | 813,946 | IllegalCharacterError vs ValueError in openpyxl | <p>I need to save Excel files with <code>pandas</code> using <code>openpyxl</code>.</p>
<p>The data is coming from a database and many times the text fields has some strange characters and it raises an <code>IllegalCharacterError</code>. I have a solution for this situation to find out which sheet, which row and which ... | <python><pandas><character-encoding><openpyxl> | 2024-11-07 19:38:22 | 0 | 1,982 | Arpad Horvath -- Слава Україні |
79,167,713 | 5,676,198 | How to create a scaler applying log transformation and MinMaxScaler in sklearn | <p>I want to apply <code>log()</code> to my <code>DataFrame</code> and MinMaxScaler() together.
I want the output to be a pandas DataFrame() with indexes and columns from the original data.
I want to use the parameters used to <code>fit_transform()</code> to <code>inverse_transform()</code> resulting in a new data fram... | <python><pandas><scikit-learn><data-preprocessing> | 2024-11-07 18:41:09 | 1 | 1,061 | Guilherme Parreira |
79,167,711 | 1,031,417 | How to make OpenHands (Running on Docker on macOS) to Work with AWS Bedrock? | <p>I'm setting up <a href="https://github.com/All-Hands-AI/OpenHands" rel="nofollow noreferrer">OpenHands</a> with AWS Bedrock on macOS using Docker, but encountering connection issues related to the Docker client and server API version. While some commands inside the container work, the main application fails with the... | <python><docker><amazon-bedrock><litellm><openhands> | 2024-11-07 18:41:04 | 1 | 41,386 | 0x90 |
79,167,704 | 1,306,892 | How to Correct Sign Issues in Python-LaTeX Code? | <p>This python code</p>
<pre><code>import random
# Generate random values of k and m between 1 and 5
k = random.randint(1, 5)
m = random.randint(1, 5)
# Calculate necessary variables
m_k = m - k
m_1 = m - 1
m_plus = m + 1
k_1 = k - 1
k_plus = k + 1
# Create with the correct answer marked
answers = [
f"\\ch... | <python><string><latex> | 2024-11-07 18:39:17 | 1 | 1,801 | Mark |
79,167,500 | 7,530,850 | Redshift query duplicates | <p>I'm using python with redshift_connector, and analysing the data with pandas. When accessing a redshift db with selecting <strong>n</strong> columns, I got <strong>i</strong> lines. However when I wanted to add a new column to this query, it timed out after an hour. To solve the issue, I came up with the idea to sel... | <python><sql><amazon-web-services><amazon-redshift> | 2024-11-07 17:23:56 | 2 | 330 | Newl |
79,167,346 | 8,233,873 | Strange rendering behaviour with selection_interval | <p>I'm generating a plot with the following code (in an ipython notebook):</p>
<pre class="lang-none prettyprint-override"><code>import altair as alt
import pandas as pd
events = pd.DataFrame(
[
{"event": "Task A", "equipment": "SK-101", "start": 10.2, &quo... | <python><altair> | 2024-11-07 16:42:56 | 1 | 313 | multipitch |
79,167,344 | 1,769,327 | Create a PDF/UA compliant PDF from an ODT with LibreOffice & Python UNO | <p>Please consider the following example:</p>
<pre><code>import uno
def create_pdf(file_url):
local_context = uno.getComponentContext()
resolver = local_context.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", local_context)
context = resolver.resolve(
... | <python><libreoffice><libreoffice-writer> | 2024-11-07 16:42:21 | 1 | 631 | HapiDaze |
79,167,208 | 4,100,253 | Passing parameters in Quarto from Python to Typst or from Typst to Python | <p>I need to create a few sections in a loop. Is there any way to pass <code>_</code> as index to Python part, or increment Python <code>ix</code> variable inside the Typst loop?</p>
<pre><code>```{python}
ix = 0
```
```{=typst}
#for _ in range(`{python} len(tables)`) {
[
`{python} tables[ix]`
... | <python><quarto><typst> | 2024-11-07 15:50:20 | 1 | 718 | Marek |
79,167,165 | 2,915,050 | How to use dot and square bracket notation as a string key to access a nested dictionary/list structure | <p>Let's say I have a nested dictionary that looks something like this:</p>
<pre><code>{
"a": 1,
"b": 2,
"c": 3,
"d": {
"e": 4,
"f": 5
},
"g": [{
"h": 6,
"i": 7
},
{
... | <python><dictionary><dot-notation> | 2024-11-07 15:35:47 | 4 | 1,583 | RoyalSwish |
79,166,784 | 6,378,557 | Using a LSP server for Python with GObject Introspection bindings | <p>I am writing code that heavily used GObject Introspection, so the code starts with:</p>
<pre><code>import gi
from gi.repository import GObject
from gi.repository import GLib
# .. and more of the same
</code></pre>
<p>Using the basic LSP-python server (*) with my editor I don't get any meaningful help for these (I do... | <python><language-server-protocol><gobject-introspection> | 2024-11-07 13:58:50 | 0 | 9,122 | xenoid |
79,166,740 | 2,245,024 | Efficiently reading part of partitioned dataset | <p>I have pretty big (up to ~300Gb) datasets stored by partitions in parquet format (compressed).</p>
<p>I'm trying to find an efficient way to read parts (as defined by a set of filters) of the dataset into pandas.
The way it's done now is</p>
<pre class="lang-none prettyprint-override"><code>result = ds.dataset(datas... | <python><pandas><parquet><partitioning><pyarrow> | 2024-11-07 13:46:25 | 3 | 355 | Nik |
79,166,537 | 3,423,768 | Filter Related Objects in DRF Serializer Based on User's Permission | <p>I’m working with Django Rest Framework and need to filter related objects in a serializer based on custom user permissions. Specifically, I want to conditionally include or exclude certain related objects (in this case, comments) in the serialized response depending on the user's relationship to the primary object (... | <python><django><django-rest-framework> | 2024-11-07 12:53:52 | 1 | 2,928 | Ravexina |
79,166,266 | 9,609,901 | Why is Python much faster than Dart for file read/write operations? | <p>I am testing file read/write performance in both Python and Dart, and I encountered a surprising result: Python is significantly faster than Dart for these operations. Here are the times I recorded:</p>
<p>Python:</p>
<ul>
<li>Write time: 10.28 seconds</li>
<li>Read time: 4.88 seconds</li>
<li>Total time: 15.16 seco... | <python><dart> | 2024-11-07 11:36:11 | 1 | 568 | Don Coder |
79,166,231 | 1,488,383 | Detect function calls originating from multi-line strings | <p>I would like to determine whether a function is called from inside a multi-line string (during string interpolation).</p>
<p>Here is a test example for such a function:</p>
<pre class="lang-py prettyprint-override"><code>s = f"""\
{inside_multiline_string()}"""
assert s == "True&qu... | <python><reflection> | 2024-11-07 11:28:48 | 1 | 606 | Anton |
79,166,072 | 16,405,935 | Cannot read files with different paths | <p>I'm trying to read csv file based on date in file name. Below is my code:</p>
<pre><code>import pandas as pd
import numpy as np
from pathlib import Path
import glob
import io
date_6='2024-05-15'
date_6_1 = '*' + date_6[:4] + date_6[5:7] + date_6[8:10] + '.csv'
for file in glob.glob(r'C:\Users\admin\Báo cáo ngày' an... | <python><pandas><glob> | 2024-11-07 10:45:27 | 0 | 1,793 | hoa tran |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.