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,231,097 | 14,463,396 | Incorrect syntax near 'CAST' when using pandas.to_sql | <p>I'm trying to write some code to update an sql table from the values in a pandas dataframe. The code I'm using to do this is:</p>
<pre><code>df.to_sql(name='streamlit_test', con=engine, schema='dbo', if_exists='replace', index=False)
</code></pre>
<p>Using an sqlalchemy engine. However, I'm getting the error:</p>
<... | <python><sql><sql-server><pandas><sqlalchemy> | 2024-11-27 16:30:00 | 1 | 3,395 | Emi OB |
79,231,076 | 495,990 | Remove rows of one pandas df using another df, but enable "wildcard" behavior when second df is missing values | <p>I have a df of hundreds of thousands of rows, which can contain errors. A team is manually reviewing/identifying, and I'm trying to enable flexible removal of combinations to purge.</p>
<p>There are three key values, and my hope was to enable <em>any</em> of these values to be populated, depending on the removal sco... | <python><pandas><dataframe><filter> | 2024-11-27 16:22:01 | 2 | 10,621 | Hendy |
79,230,945 | 2,275,171 | Format string template defined outside of loop? | <p>I'm getting odd results when defining a format string outside of a loop. I want to define a variable containing my format string like:</p>
<pre><code>MYSTRING = f"filepath/{year}/{month}"
</code></pre>
<p>If I define it outside the loop I get repeated same value. If I copy/paste that string inside the lo... | <python> | 2024-11-27 15:44:31 | 2 | 680 | mateoc15 |
79,230,923 | 3,048,363 | RegEx in Python | <p>I'm trying to search for a word (single or multiple occurance(s)) in a sentence.</p>
<p>Example</p>
<pre><code>strings = ["He likes walking","I like that","He said he liked the movie"]
</code></pre>
<p>If I want to search for "like" and in return get the flavour of like, what ... | <python><regex> | 2024-11-27 15:36:48 | 1 | 1,091 | A3006 |
79,230,705 | 2,155,362 | How to access postgresql via pgsql in python | <p>I installed pysql via</p>
<pre><code>pip install pgsql
</code></pre>
<p>Now I writed code follow the example on <a href="https://pypi.org/project/pgsql/" rel="nofollow noreferrer">https://pypi.org/project/pgsql/</a></p>
<pre><code>import pgsql
with pgsql.Connection(("localhost", 5432), "postgres"... | <python><postgresql> | 2024-11-27 14:29:44 | 1 | 1,713 | user2155362 |
79,230,704 | 1,406,168 | Writing to application insights from an azure python function app using opentelemetry | <p>So I created a function app and logging works as expected, writing entries to application insights. But as I need custom dimensions I included opentelemetry. However I get no logging send to application insigths, and no errors. Any pointers?</p>
<p>function_app.py:</p>
<pre><code>import datetime
import logging
impor... | <python><azure><azure-functions><azure-application-insights> | 2024-11-27 14:29:34 | 1 | 5,363 | Thomas Segato |
79,230,632 | 6,195,473 | I used a 2 workers pool to split a sum in a function with Python multiprocessing but the timing doesn't speed up, is there something I'm missing? | <p>The Python code file is provided below. I'm using Python 3.10.12 on a Linux mint 21.3 (in case any of these info are needed). The one with a pool of 2 workers takes more time than the one without any multiprocessing. What am I doing wrong here?</p>
<pre><code>import multiprocessing
import time
import random
def fun... | <python><python-3.x><parallel-processing><multiprocessing><python-multiprocessing> | 2024-11-27 14:10:26 | 2 | 488 | AmirHosein Sadeghimanesh |
79,230,490 | 9,578,198 | PVLIB fit Sandia module function - TypeError: expected 1D vector for x when calling polyfit | <p>I'm trying to use <code>pvlib.inverter.fit_sandia</code> to evaluate the coefficients for the Sandia inverter model</p>
<pre><code>Pac0 = 330*1000
Pnt = 20
sandia_params = pvlib.inverter.fit_sandia(ac_power,
dc_power,
dc_voltage,
... | <python><numpy><pvlib> | 2024-11-27 13:26:10 | 0 | 326 | Michele |
79,230,481 | 8,458,083 | How to statically check with mypy that a dictionary has keys for all options in a Union type? | <p>I have a Union type PossibleOption composed of n dataclasses, and I want to create a dictionary where the keys are instances of these classes. I need to statically check with mypy that the dictionary includes a key for each option in the Union. Here's my current code:</p>
<pre><code>from dataclasses import dataclass... | <python><python-typing><mypy> | 2024-11-27 13:24:35 | 0 | 2,017 | Pierre-olivier Gendraud |
79,230,437 | 4,105,601 | Passing arguments to __enter__ when using a global variable | <p>I'm using a global variable to store some useful data that I need across the whole execution of my code.</p>
<p>It's something like this:</p>
<pre><code>config_object = None
def init_config(config_file=CONFIG_PATH):
# some initialization code...
global config_object
config_object = U2DBLiveConfig(config... | <python> | 2024-11-27 13:15:57 | 2 | 507 | Héctor C. |
79,230,394 | 11,159,734 | How to connect to an Azure Postgres DB that requires ssl using asyncpg | <p>I'm migrating an application from Flask to FastAPI and with it also the database connection from <code>psycopg2</code> to <code>asyncpg</code>. In the old implementation the databse url was defined like this: <code>SQLALCHEMY_DATABASE_URI: str = f"postgresql+psycopg2://{DB_USER}:{DB_PASSWD}@{DB_HOST}:5432/{DB_N... | <python><postgresql><fastapi><asyncpg> | 2024-11-27 13:05:08 | 1 | 1,025 | Daniel |
79,230,339 | 1,750,612 | PyWebIO: stream logger to output | <p>I'm writing a simple PyWebIO setup and am wondering whether I can link an instance of <code>pywebio.output.put_scrollable</code> with the python <code>logging</code> module. I have a logger set up, and would love to be able to stream the logs directly to a pywebio output box.</p>
<p>Is it possible to stream to a py... | <python><logging><stream> | 2024-11-27 12:46:37 | 0 | 359 | MikeFenton |
79,230,332 | 8,384,910 | Insert image with border in Plotly | <p>To <a href="https://stackoverflow.com/a/70056977/8384910">create a plotly scatter plot with images at each point</a>, we can do:</p>
<pre class="lang-py prettyprint-override"><code>import plotly.express as px
from PIL import Image
xs = [0, 1, 2]
ys = [0, 1, 4]
images = [Image.open("a.png"), Image.open(&qu... | <python><plotly> | 2024-11-27 12:44:52 | 2 | 9,414 | Richie Bendall |
79,230,326 | 2,155,362 | How to install psycopy2 on python3.9? | <p>I try to install psycopy2 on python3.9 via follow instruction</p>
<pre><code>pip install psycopg2
</code></pre>
<p>and I got error massages like below:</p>
<pre><code> Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requiremen... | <python><psycopg2> | 2024-11-27 12:43:49 | 1 | 1,713 | user2155362 |
79,230,202 | 11,790,979 | I changed my directory name and now my venv isn't working | <p>Changed my dir name from a test/development directory name to a proper name for release. (changed to "project" for this question because the actual name is rather long)</p>
<p>Now when I activate my venv, I get the following:</p>
<pre><code>(virtualEnv) PS ~\Desktop\dev\vbvarsel> pip --list
Fatal error ... | <python><python-venv> | 2024-11-27 12:08:11 | 2 | 713 | nos codemos |
79,230,163 | 446,137 | pyarrow parquet does not round trip for a very simple example | <pre><code>import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
table = pa.Table.from_pandas(pd.DataFrame(data={'a':np.arange(100)}))
with open('example.parquet', 'wb') as f:
pq.write_table(table, f)
with open('example.parquet', 'rb') as ff:
read_table = pq.read_table(ff)... | <python><hash><parquet><pyarrow> | 2024-11-27 11:54:45 | 0 | 1,790 | Hans |
79,230,082 | 633,001 | Shift data in a holoviews overlay | <p>My code creates an overlay by calculating multiple hv.Curve() together. The issue is, this takes quite some time (in total something like 5000 lines) - around a minute, and its for a webinterface, so waiting that long is just not good.</p>
<p>But: the grid it creates is always the same, except shifted along the X-Ax... | <python><holoviews> | 2024-11-27 11:32:50 | 0 | 3,519 | SinisterMJ |
79,229,946 | 13,392,257 | Failed to create new KafkaAdminClient in Docker | <p>I want to create kafka-topic in docker container and send message from my python code outside docker container to this topic</p>
<p>My actions
1 Read this article <a href="https://www.confluent.io/blog/kafka-listeners-explained/" rel="nofollow noreferrer">https://www.confluent.io/blog/kafka-listeners-explained/</a><... | <python><docker><apache-kafka> | 2024-11-27 10:53:59 | 0 | 1,708 | mascai |
79,229,740 | 955,273 | How to nest dask.delayed functions within other dask.delayed functions | <p>I am trying to learn dask, and have created the following toy example of a delayed pipeline.</p>
<pre><code>+-----+ +-----+ +-----+
| baz +--+ bar +--+ foo |
+-----+ +-----+ +-----+
</code></pre>
<p>So <code>baz</code> has a dependency on <code>bar</code> which in turn has a dependency on <code>foo</code></p>
<p... | <python><dask><dask-distributed><dask-delayed> | 2024-11-27 09:54:56 | 1 | 28,956 | Steve Lorimer |
79,229,678 | 270,043 | Optimize PySpark code on large dataframe that exceeds cluster resources | <p>I have a large PySpark dataframe containing 250 million rows, with only 2 columns. I am running the minHash code found <a href="https://towardsdatascience.com/scalable-jaccard-similarity-using-minhash-and-spark-85d00a007c5e" rel="nofollow noreferrer">here</a>. I tried to write the resulting dataframe to parquet file... | <python><dataframe><pyspark><optimization><parquet> | 2024-11-27 09:39:42 | 2 | 15,187 | Rayne |
79,229,633 | 7,652,266 | An iterative plot is not drawn in jupyter notebook while python works fine. Why? | <p>I have written an iterative plot code for python using plt.draw(). While it works fine for python interpreter and ipython also, but it does not work in jupyter notebook. I am running python in virtualenv in Debian. The codes are</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
N=5
x = np.arange(-3... | <python><animation><jupyter-notebook> | 2024-11-27 09:26:06 | 1 | 563 | Joonho Park |
79,229,604 | 1,172,907 | How to mock a function in a django custom command? | <p>How can I mock foo in order to have it NOT called?</p>
<p>Here's my latest attempt:</p>
<pre class="lang-py prettyprint-override"><code>#~/django/myapp/management/commands/acme.py
def foo():
pass
class Command(BaseCommand):
def handle(self, *args, **options):
foo()
#~/django/myapp/tests/test.py
from ... | <python><django><pytest> | 2024-11-27 09:17:55 | 0 | 605 | jjk |
79,229,523 | 2,552,713 | missing xaxis ticks with plotly | <p>I have a pandas dataframe with hourly data shown in 7 subplots for a weeks data.</p>
<pre><code>fig = make_subplots(
rows=7,
cols=1,
subplot_titles=subPlotNames,
shared_xaxes=True,
shared_yaxes='all'
)
</code></pre>
<p>My x-axis shows ticks at 0, 5, 10, 15, and 20 hours at the bottom of the page.... | <python><plotly><xticks> | 2024-11-27 08:56:35 | 0 | 519 | juerg |
79,229,490 | 2,781,031 | Fine tuning Gemma model that was downloaded from ollama | <p>I am new to running models locally. I was very happy that I could run a gemma2b model locally which I pulled using ollama. I am using (or loading?) this local model in my python application by using chatOllama as below</p>
<pre><code>llm = ChatOllama(model="gemma2")
</code></pre>
<p>But now I came to a sta... | <python><ollama><gemma> | 2024-11-27 08:43:33 | 0 | 5,006 | Vasanth Nag K V |
79,229,426 | 3,373,967 | Get absolute hyperlink from excel via python script | <p>I am using <code>openpyxl</code> to process information from a excel spreadsheet. The spreadsheet is in Microsoft sharepoint, when some hyperlink is added into it, if the hyperlink is in the same sharepoint, it will automatically been translated to relative URL when I click the "save" button.</p>
<p>If I c... | <python><excel><hyperlink><openpyxl> | 2024-11-27 08:16:23 | 1 | 973 | Eric Sun |
79,229,354 | 1,473,517 | How best to store millions of pairs of 64 bit ints in a set? | <p>I have millions of pairs of 64 bit integers I want to put into a set. Speed and space are important to me.</p>
<p>I could put tuples of python ints into the set but python ints use a lot more than 64 bits each. numpy has the type uint64 but I can’t add numpy arrays to a set afaik.</p>
<p>I would really like the RAM ... | <python><numpy> | 2024-11-27 07:47:50 | 3 | 21,513 | Simd |
79,229,227 | 6,212,530 | How to annotate type of Manager().from_queryset()? | <p>In Django I have custom <code>QuerySet</code> and <code>Manager</code>:</p>
<pre class="lang-py prettyprint-override"><code>from django.db import models
class CustomQuerySet(models.QuerySet):
def live(self):
return self.filter(is_draft=False)
class CustomManager(models.Manager):
def publish(self, i... | <python><django><django-orm><python-typing><pyright> | 2024-11-27 06:55:25 | 2 | 1,028 | Matija Sirk |
79,228,975 | 1,144,251 | How to change timezone of chart in lightweight_chart_python | <p>Currently when i plot my chart by default 9:30AM is 13:30 i think this is UTC time and not EST.</p>
<p>I'd like to plot the chart in EST how do i do that? Sample code:</p>
<pre><code>from lightweight_charts import PolygonChart
if __name__ == '__main__':
chart = PolygonChart(
api_key='<API-KEY>',
... | <python><tradingview-api><lightweight-charts> | 2024-11-27 04:53:16 | 1 | 357 | user1144251 |
79,228,802 | 2,016,157 | Generic class type can't be assigned to a union of types in a for loop in python/pylance/mypy | <p>In pylance/pyright, the following code raises an err:</p>
<pre class="lang-py prettyprint-override"><code>from typing import TypeVar, Generic
from dataclasses import dataclass
class ParentType: ...
class ChildType(ParentType): ...
T = TypeVar("T", bound=ParentType)
@dataclass
class MyClass(Generic[T])... | <python><python-typing><pyright> | 2024-11-27 02:40:06 | 0 | 403 | KevL |
79,228,615 | 6,862,601 | pip version inside virtual environment | <p>I am running a virtual environment:</p>
<pre><code>$ which python
/Users/myself/.venv/bin/python
$ which python3
/Users/myself/.venv/bin/python3
$ which pip
/Users/myself/.venv/bin/pip
</code></pre>
<p>To find out the version of pip, if I run <code>python -m pip --version</code>, I get a version number different fro... | <python><pip><virtualenv><pyenv-virtualenv> | 2024-11-27 00:16:52 | 0 | 43,763 | codeforester |
79,228,428 | 20,302,906 | Comma separated names list to parse into dictionary | <p>I'd like to parse a list of assignees into a dictionary field. Creating the dictionary is not a problem since Python <code>re.match()</code> returned value can be grouped into dictionary fields <code>re.match().groupdict()</code>.</p>
<p>My regex <code>r'assignees:((\s\w+){2}[\s|,])+'</code> matches as expected with... | <python><regex> | 2024-11-26 22:12:42 | 1 | 367 | wavesinaroom |
79,228,382 | 7,936,119 | Nested Tuple conversion to List | <p>I have some very edgy behavior that I want to circumvent in python.
Imagine that you have such structure:</p>
<pre class="lang-py prettyprint-override"><code>something = {
"data":{"mytuple":(1,2,3)}
}
</code></pre>
<p>Now I would like to access that tuple, for that I can do hthe following:</p>
<... | <python><data-structures><tuples> | 2024-11-26 21:53:27 | 0 | 370 | Pitchkrak |
79,228,345 | 1,718,989 | Python using oracledb to connect to Oracle database with Pandas DataFrame Error: "pandas only supports SQLAlchemy connectable (engine/connection)" | <p>I am pretty new to Python and even newer to Pandas and am hoping for some guidance</p>
<p>My company has an on-prem DEV Oracle database that I am trying to connect to using Python & Pandas. After some searching I found that the Python package "oracledb" was recommended to be used.</p>
<p>Using VS code ... | <python><pandas><dataframe><sqlalchemy><python-oracledb> | 2024-11-26 21:35:38 | 1 | 311 | chilly8063 |
79,228,343 | 14,909,621 | What do square brackets mean in Python function definitions? | <p>While watching a video about Python features, I came across the <a href="https://youtu.be/rc0tJaPleTg?list=PLbr8rVGhPD0WQgO97Ao67Q-QVuSbm_Zpz&t=406" rel="nofollow noreferrer">following code snippet</a>:</p>
<pre><code>def compose[_First, _Second, _Thirt](
first: Callable[[_First], _Second],
second: Calla... | <python> | 2024-11-26 21:35:19 | 0 | 7,606 | Vitalizzare |
79,228,027 | 16,092,023 | pymongo.errors.ServerSelectionTimeoutError in AKS cluster | <p>We are using <code>mcr.microsoft.com/azurelinux/base/python:3.12.3-4-azl3.0.20241101-amd64</code> as our base image to build python based application . when we are running our application built image in AKS , its failing to connect to azure cosmos db with error as below. We checked the connectivity from AKS containe... | <python><pymongo><pymongo-3.x><azure-linux> | 2024-11-26 19:35:21 | 0 | 1,551 | Vowneee |
79,228,017 | 1,406,168 | Adding custom properties and metrics from an Azure Python Function App | <p>I have the function below. Logs are successfully added to application insights however customDimensions/Properties are not. Any Pointers? Also the logger does not have logging for metrics, dont you have same options as in c#?</p>
<pre><code>import datetime
import logging
import azure.functions as func
app = func.Fu... | <python><azure><azure-functions><azure-application-insights> | 2024-11-26 19:32:03 | 1 | 5,363 | Thomas Segato |
79,227,950 | 5,777,697 | Community Detection with both Node and Edge Weights | <p>I have a directed graph where there are importance or weight attributes for both the nodes and edges. I am looking for a community or module detection implementation in <code>python</code> that will consider both attribute types when calculating or optimizing for community detection. I know there are many <code>pyth... | <python><cluster-analysis><graph-theory><igraph><subgraph> | 2024-11-26 18:57:49 | 1 | 401 | abbas786 |
79,227,921 | 16,092,023 | pip install failing in azurelinux based docker image | <p>We are using <code>mcr.microsoft.com/azurelinux/base/python:3.12.3-4-azl3.0.20241101-amd64</code> as our base image to build python based application . but when we are performing docker build from a ubuntu18 or 22 based host machine, with the pip command inside the dockerfile, we are getting below error. But when we... | <python><docker><ubuntu><pip><azure-linux> | 2024-11-26 18:43:08 | 0 | 1,551 | Vowneee |
79,227,872 | 807,037 | How to reuse tests with different subjects-under-test in python? | <p>This question is slightly different from <a href="https://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class">Python unit test with base and sub class</a> because the tests to be re-used exercise different subjects-under-test which are set by the subclasses</p>
<p>I have multiple implementa... | <python> | 2024-11-26 18:20:28 | 2 | 19,948 | Noel Yap |
79,227,779 | 7,465,462 | Query a specific model deployment in an endpoint inside Azure Machine Learning | <p>I'm working in Python. I already successfully deployed two model deployments in an Azure Machine Learning real-time endpoint, with a 50-50 traffic split.</p>
<p>Using the Python SDK, I know that to call a specific model deployment I have to specify the <code>deployment_name</code> parameter in the <code>invoke</code... | <python><rest><endpoint><azure-machine-learning-service> | 2024-11-26 17:46:38 | 1 | 9,318 | Ric S |
79,227,692 | 5,214,931 | "No module named numpy" when trying to install eif from pypi with pixi | <p>I am trying to use <code>pixi</code> for a python library, and it's running into an error when trying to install the pipy dependency <code>eif</code>.</p>
<pre><code>~/code> pixi init test-pixi-eif --format pyproject
✔ Created /home/oliver/code/test-pixi-eif/pyproject.toml
~/code/test-pixi-eif> cd test-pixi-ei... | <python><numpy><pypi><conda-forge><pixi-package-manager> | 2024-11-26 17:15:04 | 0 | 1,264 | oulenz |
79,227,655 | 2,772,805 | Rescale axes concerning visible artists only | <p>I have a request regarding the use of <code>autoscale_view()</code>. I was expecting it to scale the plot considering only the visible artists, but it does not have such an effect.</p>
<p>I have a small test script as follows, any help is welcome:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
x1... | <python><matplotlib><axis> | 2024-11-26 17:02:16 | 2 | 429 | PBrockmann |
79,227,618 | 3,705,139 | How is super() able to (apparently) resolve to, and call, multiple methods? | <p>I'm working on some Python code that seems like it'll be a good fit for multiple inheritance, and I'm reading about multiple inheritance and <code>super()</code> to make sure I correctly understand how they work.</p>
<p>My understanding of <code>super()</code> is that - to paraphrase - it walks a class's method reso... | <python><multiple-inheritance><super><method-resolution-order> | 2024-11-26 16:48:55 | 1 | 353 | Lux |
79,227,592 | 12,846,524 | Sinc-like feature removal with an FFT | <h3>Outline</h3>
<p>I have some Raman spectroscopy data that contains features that I want to remove. I'll point them out in the figure below:</p>
<p><a href="https://i.sstatic.net/gwlBAEyI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gwlBAEyI.png" alt="enter image description here" /></a></p>
<p>Here... | <python><filter><fft><spectrum> | 2024-11-26 16:42:47 | 1 | 374 | AlexP |
79,227,550 | 13,392,257 | Kafka in docker: No connection to node with id 1 | <p>I am trying to send data to local Kafka infrastructure</p>
<p>My infrastructure:</p>
<pre class="lang-yaml prettyprint-override"><code>version: "3.8"
services:
zookeeper:
image: bitnami/zookeeper:latest
ports:
- 2181:2181
environment:
- ALLOW_ANONYMO... | <python><apache-kafka> | 2024-11-26 16:30:24 | 0 | 1,708 | mascai |
79,227,481 | 1,883,304 | Populating CheckboxSelectMultiple widget using my own model in Wagtail admin | <h2>Context</h2>
<p>I've created a model, corresponding field model, and intend to reuse the built-in <code>CheckboxSelectMultiple</code> widget for use <em>within the Wagtail admin</em>. The concept is a multiple-select permission field that is saved as a bit-field:</p>
<pre class="lang-py prettyprint-override"><code>... | <python><django><wagtail><wagtail-admin> | 2024-11-26 16:14:01 | 1 | 3,728 | Micrified |
79,227,473 | 2,287,458 | Sort Polars Dataframe columns based on row data | <p>I have this data:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
pl.DataFrame({
'region': ['EU', 'ASIA', 'AMER', 'Year'],
'Share': [99, 6, -30, 2020],
'Ration': [70, 4, -10, 2019],
'Lots': [70, 4, -10, 2018],
'Stake': [80, 5, -20, 2021],
})
# shape: (4, 5)
# ┌────────┬──... | <python><dataframe><python-polars> | 2024-11-26 16:11:28 | 3 | 3,591 | Phil-ZXX |
79,227,455 | 8,384,910 | Principled Conditional Inheritance in Python | <p>I have a class that inherits <code>np.ndarray</code>:</p>
<pre class="lang-py prettyprint-override"><code>class A(np.ndarray):
def __new__(cls, foo: np.ndarray):
# Operate on foo...
x = np.array([1.]) + foo # (placeholder)
return x
def bar(self, x):
# Other stuff...
</code></pre>
<p>I want to a... | <python><inheritance> | 2024-11-26 16:07:12 | 2 | 9,414 | Richie Bendall |
79,227,390 | 10,637,300 | How to extract specific entities from unstructured text | <p>Given a generic text sentence (in a specific context) how can I extract word/entities of interest belonging to a specific "category" using python and any NLP library?</p>
<p>For example given a step for a culinary recipe <code>Add an onion to a bowl of carrots</code> as input text, I'd like to retrive <cod... | <python><machine-learning><nlp><nltk><spacy> | 2024-11-26 15:46:48 | 1 | 396 | Riccardo Raffini |
79,227,308 | 1,735,914 | What is the scope of a name defined using a Python with block? | <p>I am trying to update a test script written in Python. It has a construct I do not understand:</p>
<pre><code> with RequestTrap(self.channel) as trap:
request = self.task[0].svc.create({'task_use': TaskUse.STANDARD})
request.request_data.attribute_structures.task_use.idnum = attr
... | <python> | 2024-11-26 15:24:21 | 0 | 2,431 | ROBERT RICHARDSON |
79,227,288 | 9,072,753 | How to annotate zipping of dictionaries of differnt ypes? | <p>I want to zip dictionaries into keys to tuples of values. I would be happy to annotate only for specific number of arguments, I will only use up to 5 ever.</p>
<pre><code>from typing import Optional, Tuple, overload, TypeVar, overload
T1 = TypeVar("T1")
V1 = TypeVar("V1")
V2 = TypeVar("V2&q... | <python><overloading><python-typing> | 2024-11-26 15:18:06 | 0 | 145,478 | KamilCuk |
79,227,281 | 1,188,318 | from user's language to the locale string - how to? | <p>In our Django/Python/Linux stack we want to determine the correct locale from the user's language. The language might be 'de' and the locale could be something like de_DE or de_AT or even de_CH.UTF-8 - depending on what <code>locale -a</code> returns. In case of ambiguity we would just use the first valid entry for ... | <python><django><linux><locale> | 2024-11-26 15:15:13 | 1 | 3,749 | sers |
79,227,181 | 1,386,750 | In a Python regex (re), how can I match the start of a string (^) OR a non-alphanumeric character (\W)? | <p>I am using the Python regex package <code>re</code> for example to match a hashtag or url. A hashtag starts with a <code>#</code>, which cannot be in the middle of a word. Hence, it can be at the start of a word, which I can find with <code>\W</code> OR at the start of the string (<code>^</code>). How can I catch... | <python><regex><string><match> | 2024-11-26 14:46:57 | 1 | 468 | AstroFloyd |
79,227,057 | 1,207,971 | How to prevent Pandas to_csv double quoting empty fields in output csv | <p>I currently have a sample python script that reads a csv with double quotes as a text qualifier and removes ascii characters and line feeds in the fields via a dataframe. It then outputs the dataframe to a csv. However the output csv is double quoting empty fields. see below:</p>
<pre><code>import pandas as pd
impor... | <python><pandas><dataframe><csv> | 2024-11-26 14:13:02 | 1 | 301 | Eseosa Omoregie |
79,226,981 | 2,679,476 | Illegal instruction (core dumped) import keras | <p>If I try to do 'import keras', it gives core dump.</p>
<pre><code>python3 -c 'import keras; print(keras.__version__)'
Illegal instruction (core dumped)
</code></pre>
<p>or</p>
<pre><code>python3 test.py
Illegal instruction (core dumped)
</code></pre>
<p>I tried to uninstall and re-install keras, but no luck. Current... | <python><keras> | 2024-11-26 13:51:05 | 2 | 459 | user2679476 |
79,226,797 | 34,747 | How to build a cffi extension for inclusion in binary python wheel with uv | <p>I am migrating a <a href="https://github.com/AlertaDengue/pyreaddbc" rel="nofollow noreferrer">library of mine</a> to use <a href="https://docs.astral.sh/uv/" rel="nofollow noreferrer">uv</a> to manage the package. My package, however, includes a C extension that is wrapped and compiled through CFFI (there's a build... | <python><setuptools><python-cffi><uv> | 2024-11-26 12:53:16 | 1 | 6,262 | fccoelho |
79,226,717 | 15,520,615 | Unable to read file in Databricks with Pandas Errror: FileNotFoundError: [Errno 2] No such file or directory: '/FileStore/tables/ge_selection.csv' | <p>I have upload a file called ge_selection.csv to '/FileStore/tables/' in Databricks community edition.</p>
<p>When I run the following code the contents of the .csv is displayed:</p>
<pre><code>file_location = "/FileStore/tables/ge_selection.csv"
file_type = "csv"
# CSV options
infer_schema = &qu... | <python><pandas><databricks> | 2024-11-26 12:24:49 | 1 | 3,011 | Patterson |
79,226,669 | 6,251,742 | How lambda expresison can reference to itself before instanciation? | <p>For fun, I tried to create a linked list with lambda functions. I tried this little code as a first step, but my experimentation went short after facing an infinite loop:</p>
<pre class="lang-py prettyprint-override"><code>import itertools
stack = lambda: ("c", None)
stack = lambda: ("b", stack)... | <python><lambda><linked-list> | 2024-11-26 12:10:35 | 1 | 4,033 | Dorian Turba |
79,226,508 | 2,300,597 | PySpark GroupedData - chain several different aggregation methods | <p>I am playing with <code>GroupedData</code> in pyspark.</p>
<p>This is my environment.</p>
<pre class="lang-bash prettyprint-override"><code>Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 3.5.1
/_/
Using Scala version 2.12.1... | <python><apache-spark><pyspark> | 2024-11-26 11:25:29 | 2 | 39,631 | peter.petrov |
79,226,479 | 1,693,057 | How to Parse logfmt Error Messages in Datadog | <p>I'm currently trying to parse <code>logfmt</code> messages using <code>Datadog</code>, but I'm running into some issues. Here's an example log message that we're trying to parse:</p>
<pre class="lang-none prettyprint-override"><code>time="2024-11-25 10:07:11" level=ERROR logger=mycompany.gis.infra.maps_ser... | <python><logging><datadog> | 2024-11-26 11:17:58 | 1 | 2,837 | Lajos |
79,226,130 | 6,681,932 | GPS tracking streamlit in mobile device | <p>I'm running a Streamlit app where I try to retrieve the user's geolocation in streamlit.
However, when using geocoder.ip("me"), the coordinates returned are 45, -121, which point to Oregon, USA, rather than my actual location.</p>
<p>This is the function I use:</p>
<pre><code>def get_lat_lon():
# Use g... | <python><gps><ip><streamlit><interactive> | 2024-11-26 09:49:34 | 1 | 478 | PeCaDe |
79,225,846 | 1,406,168 | Deploying python function apps to azure | <p>I am trying to make my first python function app. The app is just a simple app that creates a blob file. The code runs locally. However when I deploy to Azure I dont see the function app.</p>
<p>If I remove this, then it works:</p>
<pre><code>from azure.identity import DefaultAzureCredential
from azure.storage.blob ... | <python><azure><azure-functions> | 2024-11-26 08:17:38 | 1 | 5,363 | Thomas Segato |
79,225,810 | 10,883,088 | Parameters for dataset and data-aware scheduling in Airflow | <p>Has anyone had issues with their DAG having tasks not complete when passing <code>default_args</code> to the consumer dag?</p>
<p>Producer DAG Upstream:</p>
<pre><code>from airflow.datasets import Dataset
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from airflow.operators.empty impo... | <python><python-3.x><airflow> | 2024-11-26 08:05:39 | 1 | 471 | dko512 |
79,225,780 | 614,944 | Huge memory consumption with SD3.5-medium | <p>I have a g4dn.xlarge AWS GPU instance, it has 16GB memory + 48GB swap, and a Tesla T4 GPU Instance with 16GB vRAM.</p>
<p>According to the <a href="https://stability.ai/news/introducing-stable-diffusion-3-5" rel="nofollow noreferrer">stability blog</a>, it should be sufficient to run SD3.5 Medium model.</p>
<p><a hr... | <python><torch><stability><diffusers> | 2024-11-26 07:53:54 | 1 | 23,701 | daisy |
79,225,757 | 17,580,381 | How to replace the deprecated WebElement.get_attribute() function in Selenium 4.27.0+ | <p>On some web pages, due to rendering issues (e.g., hidden element), <code>WebElement.text</code> may not reveal the underlying text whereas <code>WebElement.get_attribute("textContent")</code> will. Therefore I have written the following utility function:</p>
<pre><code>from selenium.webdriver.remote.webele... | <python><selenium-webdriver> | 2024-11-26 07:43:21 | 2 | 28,997 | Ramrab |
79,225,465 | 5,213,857 | Montreal Forced Aligner(MFA) taking too much time(almost 18 days still going on) to train a 33 GB corpus | <p>WE are using Montreal Forced Aligner (MFA) 3.x to train an acoustic model on a large dataset (~33GB of audio and transcripts in an Indian language). The training process takes an extremely long time(almost 18 days still going on) to complete.</p>
<p>Here are the details of my setup:</p>
<ul>
<li><p><strong>Hardware... | <python><nlp><speech-recognition><kaldi><phoneme> | 2024-11-26 05:53:39 | 0 | 1,881 | Swayangjit |
79,225,412 | 219,153 | Why this Pandas DataFrame column operation fails? | <p>This script works fine with Python 3.11 and Pandas 2.2:</p>
<pre><code>import pandas as pd
df = pd.read_csv(f'test.csv', comment='#')
df['x1'] = df['x1']*8
# df['y1'] = df['y1']*8
print(df)
</code></pre>
<p>and prints:</p>
<pre><code> x1 y1
0 0 0
1 16 6
2 32 12
</code></pre>
<p>but fails when I unco... | <python><pandas><dataframe> | 2024-11-26 05:22:39 | 2 | 8,585 | Paul Jurczak |
79,225,406 | 3,414,663 | How do you express the identity expression? | <p>How do you express the identity expression in Polars?</p>
<p>By this I mean the expression <code>idexpr</code> that when you do <code>lf.filter(idexpr)</code> you get the entirety of <code>lf</code>.</p>
<p>Similar to <code>SELECT(*)</code> in SQL.</p>
<p>I'm resorting to a logical expression like</p>
<pre><code>ide... | <python><python-polars> | 2024-11-26 05:19:41 | 2 | 589 | user3414663 |
79,225,262 | 6,702,598 | How to check the result of a mocked function without relying on calling convention | <p>In Python,</p>
<p>can check the parameters of a mocked function <em>using parameter names</em> in a test without relying on the way the function was called (either with args or with kwargs)?</p>
<h3>Concrete example</h3>
<p>I'd like this example to return a passing test:</p>
<pre><code>
# function under test.
# Plea... | <python><python-3.x><unit-testing><mocking> | 2024-11-26 03:43:56 | 0 | 3,673 | DarkTrick |
79,225,136 | 1,335,475 | Trouble building onnxruntime python bindings on macos | <p>I am curious if anyone is doing this successfully, and if so how?</p>
<p>I can build the shared libraries for inference successfully using the instructions on</p>
<p><a href="https://onnxruntime.ai/docs/build/inferencing.html" rel="nofollow noreferrer">https://onnxruntime.ai/docs/build/inferencing.html</a></p>
<p>Ho... | <python><macos><onnxruntime> | 2024-11-26 02:26:31 | 1 | 664 | Blunt Jackson |
79,225,016 | 11,741,232 | Altair layer chart, force x axis and y axis + ticks to be all together | <p>I have a bunch of dataframes that I don't want to merge because they have the same column names, I want them in different series.</p>
<p>So, I make separate charts and put them in a layerchart together at the end.</p>
<p>Sometimes though, the data is such that the chart changes, the x axis will be on the top or bott... | <python><altair> | 2024-11-26 01:08:22 | 0 | 694 | kevinlinxc |
79,224,936 | 11,751,799 | What to do with `matplotlib` graphs given in a list that a function returns (or what is an alternative function architecture)? | <p>I have a function that works something like this.</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.pyplot as plt
def plot_from_dave(n = 100, r = 10):
my_list = []
for i in range(r):
fig, ax = plt.subplots()
x = np.random.normal(0, 1,... | <python><matplotlib><graph> | 2024-11-26 00:14:40 | 1 | 500 | Dave |
79,224,916 | 3,808,982 | Finding the Second-order sections representation of the IIR filter in C# | <p>I was given a small amount of python code that quickly Calculates and returns a representation of the second-order sections of an IIR filter.</p>
<pre class="lang-py prettyprint-override"><code> from scipy.signal import butter
# Parameters
order = 1
sample_count = 2048 # Hz 2048
burst_length... | <python><.net><mathnet-filtering> | 2024-11-25 23:58:24 | 0 | 2,268 | Luke Hammer |
79,224,765 | 123,594 | ansible_python_interpreter_fallback is not working | <p>I have a playbook with a mix of <code>connection: local</code> tasks and remote tasks that use an AWS dynamic inventory. The Python interpreter has different paths on local and remote systems.</p>
<p>Through another question <a href="https://stackoverflow.com/questions/79157061/python3-venv-how-to-sync-ansible-pytho... | <python><ansible> | 2024-11-25 22:30:04 | 3 | 2,524 | jdog |
79,224,509 | 825,227 | Is there a way to do an Excel INDEX/MATCH within Python using two dataframes as inputs | <p>Have googled and only relevant answers prescribe a merge which isn't applicable in my case.</p>
<p>I have two data frames:</p>
<p><code>da</code></p>
<pre><code>2023-08-14 06:30:01 B C D E F G
2023-08-14 06:30:01 B C D E F G
2023-08-14 06:30:02 B C D E F G
2023-08-14 06:30:03 B C D ... | <python><algorithm><data-structures> | 2024-11-25 20:23:33 | 1 | 1,702 | Chris |
79,224,497 | 5,312,606 | Optimized build for pip | <p>This question is similar to
<a href="https://stackoverflow.com/questions/14359644/python-setuptools-distribute-optimize-option-in-setup-py">Python Setuptools Distribute: Optimize Option in setup.py?</a>,
but the question was asked 11 years ago and I hope that the python ecosystem developed further.</p>
<p>We have a ... | <python><pip><setuptools> | 2024-11-25 20:18:56 | 0 | 1,897 | mcocdawc |
79,224,491 | 141,650 | How to ensure that pytest-defined `request` fixture is available? | <p>I'm still wrestling with how/when I can use pytest's off-the-shelf fixtures (e.g.: <code>request</code>). I have a class structure of the form:</p>
<pre><code>abc.ABC -> TestBase -> IntegrationTestBase -> SomeSpecialTest
</code></pre>
<p>In <code>IntegrationTestBase</code>, I defined a teardown_method like ... | <python><pytest> | 2024-11-25 20:17:04 | 1 | 5,734 | Stephen Gross |
79,224,478 | 37,650 | How can I enforce a minimum age constraint and manage related models in Django? | <p>I am working on a Django project where I need to validate a model before saving it, based on values in its related models. I came up with this issue while extracting an app from an project using an old Django version (3.1) to a separate Django 5.1 project, then there error "ValueError: 'Model...' instance needs... | <python><django><validation> | 2024-11-25 20:10:28 | 2 | 1,752 | Danmaxis |
79,224,463 | 8,589,908 | matplotlib 3D line plot | <p>I am trying to plot a two series of data in 3d as lines but cant find a good example of how to structure the data to do this in python.</p>
<p>My example data is:</p>
<pre><code>x = np.array([[1,1,1,1,5,1,1,1,1], [4.5,5,5,5,5.5,5,5,5,4.5]])
</code></pre>
<p>But I presume to do this I need 3 series of data.</p>
<p>He... | <python><matplotlib><matplotlib-3d> | 2024-11-25 20:03:47 | 1 | 499 | Radika Moonesinghe |
79,224,436 | 2,856,552 | Why does my shapefile color a different polygon than intended? | <p>I have risk data which I would like to color on a map according to the risk level. I read a shapefile and a csv data file which I then merge. This works very well working with adm1 shapefile.</p>
<p>When I run the same script with adm2 shapefile, the results are completely weird: The polygons colored are way far fro... | <python><matplotlib> | 2024-11-25 19:50:06 | 1 | 1,594 | Zilore Mumba |
79,224,194 | 5,029,763 | Convert linearmodels results to DataFrame | <p>I have a lot of models that I wish to compare, so I wanted to concat their results into a single DataFrame. I was hoping to do something similar to this <a href="https://stackoverflow.com/a/63223691/5029763">solution</a>.</p>
<p>So I was going to use <code>as_csv()</code> to <code>summary.tables[0]</code> of each mo... | <python><linearmodels> | 2024-11-25 18:19:16 | 0 | 1,935 | user5029763 |
79,224,129 | 850,781 | Why does np.diff handle tz-naive and tz-aware indexes differently | <p>I just noticed that <a href="https://numpy.org/doc/stable/reference/generated/numpy.diff.html" rel="nofollow noreferrer"><code>np.diff</code></a> treats tz-naive timestamps:</p>
<pre><code>import numpy as np
import pandas as pd
np.diff(pd.DatetimeIndex(["2024-11-24", "2024-11-25"]))
==> array... | <python><pandas><numpy><datetime><timezone> | 2024-11-25 17:59:10 | 0 | 60,468 | sds |
79,224,061 | 7,921,684 | How to Control TP-Link Tapo Plugs from Another Network Using PlugP100 or Python-Kasa Libraries | <p>I am using the <strong><a href="https://github.com/petretiandrea/plugp100" rel="nofollow noreferrer">PlugP100</a></strong> / <strong><a href="https://github.com/python-kasa/python-kasa" rel="nofollow noreferrer">Python-Kasa</a></strong> library to control my TP-Link smart plugs. Currently, I can send commands to the... | <python> | 2024-11-25 17:33:23 | 1 | 586 | Gray |
79,223,897 | 1,802,693 | How to Specify return_dtype for Aggregation and Sorting in Polars LazyFrame? | <p>Let's assume I have a Polars LazyFrame or DataFrame.</p>
<p>In the first step, I execute a <code>with_columns</code> / <code>struct</code> / <code>map_elements</code> / <code>lambda function</code> combination to create dict objects from the columns specified in the struct.</p>
<pre class="lang-py prettyprint-overri... | <python><python-3.x><dataframe><python-polars><lazyframe> | 2024-11-25 16:39:53 | 0 | 1,729 | elaspog |
79,223,860 | 15,394,199 | Unexpected '__mul__' call during dot product | <p>So, I have been trying to implement a basic Autograd and Neural Network from scratch using some numpy. This is the part of code of my AD which matters for this question which has been greatly shorten down for MRE. This is grad.py</p>
<pre class="lang-py prettyprint-override"><code>from typing import Self
import nump... | <python><numpy><deep-learning> | 2024-11-25 16:27:54 | 1 | 2,318 | random_hooman |
79,223,745 | 2,402,577 | How can I use breakpoint inside a Hypercorn funtion for Python 3.9 | <p>I am using <code>Python 3.9</code>. I am unable to use <code>ipdb.set_trace()</code> inside an <code>Hypercorn</code> process. Please note that this works in <code>Python 3.7</code>.</p>
<p>My code:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import ipdb
async def app(scope, receive,... | <python><ipdb><hypercorn> | 2024-11-25 15:58:56 | 0 | 3,525 | alper |
79,223,646 | 9,371,999 | .venv folder not showing on vscode tree view | <p>The issue is as follows.
I usually work with Python to develop my apps. yesterday I wanted to try UV framework, and I found it very nice. However, I soon found out that the .venv folder created is not showing in my vscode tree view. Seethe picture as follows:
<a href="https://i.sstatic.net/H3Bhi6dO.png" rel="nofoll... | <python><visual-studio-code> | 2024-11-25 15:28:16 | 2 | 529 | GEBRU |
79,223,616 | 3,025,242 | Accessing / downloading artifacts from MLflow running in Docker | <p>I am currently working on a way to implement <code>testcontainers</code> like testing using an <code>MLflow</code> server running in Docker. I use a fairly simple Docker image to setup <code>MLflow</code> server and run a small training script that writes the resulting model as an artifact to <code>MLflow</code>:</p... | <python><docker><mlflow> | 2024-11-25 15:18:29 | 0 | 1,233 | mabergerx |
79,223,449 | 4,706,711 | Why ValueError is not handled upon my Django Middleware? | <p>I am Implementing a Basic view that raises a <code>ValueError</code>:</p>
<pre><code>from rest_framework.views import APIView
from django.http import HttpResponse
class ThreadView(APIView):
def get(self, request, *args, **kwargs):
limit = int(request.GET.get('limit', 10))
if li... | <python><django><error-handling> | 2024-11-25 14:31:03 | 1 | 10,444 | Dimitrios Desyllas |
79,223,398 | 2,990,052 | Missing Pandas methods in PyCharm (JetBrains) code completion | <pre><code>import pandas as pd
series = pd.Series([])
series.str.extract("")
</code></pre>
<p>While writing the above code, I expect PyCharm to start completing <code>series.str.ex...</code> with the available methods. It does not.</p>
<p>Example of what I am expecting using <code>pd...</code>:
<a href="http... | <python><pandas><pycharm><jetbrains-ide> | 2024-11-25 14:13:14 | 1 | 855 | PeterH |
79,223,224 | 6,151,948 | Cross-Region S3 Copy with SourceClient Fails in Boto3 and AWS CLI on Scaleway | <h3>TL;DR</h3>
<p>I have issues using boto3/aws cli to copy files between buckets that are in a different region (Note: I am using Scaleway as my cloud provider, not AWS).
I could not get it to work using boto3, but managed to find a solution using rclone. I would like to know whether boto3 is still a possibility to li... | <python><amazon-web-services><amazon-s3><boto3><rclone> | 2024-11-25 13:24:07 | 1 | 942 | Daan |
79,223,032 | 16,895,246 | tkinter set a different color for the tick and text in a checkbox | <p>I'm trying to use checkboxes in tkinter. My GUI has a dark theme so I'd like to use white text on a dark background. Unfortunately if I do this by setting <code>fg="white"</code> <code>bg="black"</code> then I get a black background except for the box where the tick appears which remains white. T... | <python><tkinter><tkinter.checkbutton> | 2024-11-25 12:28:53 | 0 | 1,441 | Pioneer_11 |
79,223,026 | 2,649,681 | Python Gimp plugin failing to register - gimp_wire_read() error | <p>I'm attempting to write a Python plugin for Gimp (2.10.38). Right now, it is absolutely barebones to just register the function and run <code>main</code>, but it is failing to register and show up in the program.</p>
<pre><code>#!/usr/bin/python
from gimpfu import *
def msg(txt):
pdb.gimp_message(txt)
msg('Ru... | <python><gimp><gimpfu><python-fu> | 2024-11-25 12:26:53 | 1 | 848 | user2649681 |
79,222,805 | 2,136,286 | pip install from private repo via GitHub Actions workflow | <p><strong>TL;DR</strong>: How do you pass GITHUB_TOKEN to <code>pip</code> in callable workflow? Any additional setup required?</p>
<p>I'm trying to write a set of workflows that installs dependencies located on a private GitHub repo.</p>
<p>The repos with packages have <em>"Access from repositories in the 'My Or... | <python><github><pip><github-actions> | 2024-11-25 11:17:42 | 1 | 676 | the.Legend |
79,222,706 | 12,466,687 | How to save PDF after cropping from each page of PDF using pdfplumber? | <p>I am using a PDF with multiple pages that has a table on top of each page that I want to get rid of. So I am cropping the PDF after the top table.</p>
<p>What I don't know is how to combine or save it as 1 single PDF after cropping it.</p>
<p>I have tried below:</p>
<pre><code>import pandas as pd
import pdfplumber
... | <python><pdf><pdfplumber> | 2024-11-25 10:49:14 | 1 | 2,357 | ViSa |
79,222,611 | 6,555,196 | Dedicated Exception handling function doesn't really except | <p>In order to avoid using numerous <code>try:except</code> blocks like the one below,
I've created a dedicated function that should handle any exception,
The thing is since the data it should handle does not exist, so it fail before it reaches the handle function.
So, basically making the handle function obsolete, and... | <python><python-3.x><aws-lambda> | 2024-11-25 10:19:51 | 1 | 305 | soBusted |
79,222,586 | 8,981,066 | Pydantic Nested Model Validation | <p>Need help setting up a nested Pydantic model that takes in restricted values</p>
<p>My current code:</p>
<pre><code>class Category(str, Enum):
Category: 'category'
Class Sub_Category(str, Enum):
Sub_Category: 'sub_category'
</code></pre>
<p>I however want to restrict this to pick up Categories and Sub-Categor... | <python><python-3.x><pydantic> | 2024-11-25 10:14:31 | 1 | 1,147 | Oday Salim |
79,222,489 | 2,481,350 | Why is this DFS + Memoization solution for selecting indices in two arrays too slow while a similar approach is more efficient? | <p>I was solving LeetCode problem <a href="https://leetcode.com/problems/maximum-multiplication-score/description/" rel="nofollow noreferrer">3290. Maximum Multiplication Score</a>:</p>
<blockquote>
<p>You are given an integer array <code>a</code> of size 4 and another integer array <code>b</code> of size at least 4.</... | <python><time-complexity><dynamic-programming><depth-first-search><memoization> | 2024-11-25 09:57:40 | 1 | 2,062 | souparno majumder |
79,222,345 | 1,986,532 | keras model does not learn if using tf.data pipeline | <p>A <code>keras</code> model <em>does</em> learn using Numpy arrays as the input, but fails to make any progress if reading data from a <code>tf.data</code> pipeline. What could be the reason potentially?</p>
<p>In particular, the model consumes batched multidimensional time series (so every point is an N x M tensor)... | <python><numpy><tensorflow><keras><tf.data> | 2024-11-25 09:07:39 | 1 | 2,552 | Dmitry Zotikov |
79,222,113 | 4,471,840 | Is there a shortcut for python docstring to document implicit raised exception? | <p>I'm working on a few python modules whose methods (by design) don't catch exceptions from functions called in their bodies. As far as I understand the results of my research, you should document any relevant exceptions in docstring <code>:raises ...:</code> blocks, in my case to primarily help users or their IDEs, n... | <python><docstring> | 2024-11-25 07:58:19 | 0 | 446 | bohrsty |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.