QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,838,719 | 12,724,648 | Get driver to update after page click in selenium | <p>I'm trying to build a simple webscraper. I want it to work by inputting a value into a webpage, clicking enter and then scraping the new page after the it loads.</p>
<p>So far initially loading up the webpage, inputting the value and clicking enter works but the driver does not seem to update when the new page loads... | <python><selenium-webdriver><selenium-firefoxdriver> | 2024-08-06 11:16:41 | 2 | 325 | KGreen |
78,838,529 | 1,942,868 | It becomes array when sending Django nested dict to API | <p>I sent the dict data with this in Python:</p>
<pre><code> data = {
"test":{
"A":"Adata",
"B":"Bdata",
"C":"Cdata"
}
}
response = self.client.post("/api_patch/",dat... | <python><django> | 2024-08-06 10:29:34 | 1 | 12,599 | whitebear |
78,838,421 | 4,892,210 | Ollama with RAG for local utilization to chat with pdf | <p>I am trying to build ollama usage by using RAG for chatting with pdf on my local machine.
I followed this GitHub repo: <a href="https://github.com/tonykipkemboi/ollama_pdf_rag/tree/main" rel="nofollow noreferrer">https://github.com/tonykipkemboi/ollama_pdf_rag/tree/main</a>
The issue is when I am running code, there... | <python><large-language-model><python-embedding><ollama><rag> | 2024-08-06 10:02:03 | 1 | 321 | NIrbhay Mathur |
78,838,219 | 7,699,037 | Regex pattern match until the next occurence of the pattern | <p>I'm trying to split a string using a regex pattern and including everything in between (could also be nothing) until the next occurrence of the pattern. However, the "everything in between" is matched with the next occurrence. So for example I have the following string:</p>
<pre><code>content = ""... | <python><regex> | 2024-08-06 09:15:41 | 1 | 2,908 | Mike van Dyke |
78,838,209 | 22,963,183 | Error When Using unstructured to Partition PDF Files | <p>I'm trying to use the <strong>unstructured</strong>, <strong>unstructured[pdf]</strong> library in <strong>Python</strong> to partition a .pdf file, but I'm encountering an error that I can't seem to resolve. The pdf file contains text, table, image,...</p>
<p>Here's a brief overview of what I'm doing:</p>
<pre clas... | <python><python-3.x><large-language-model><rag> | 2024-08-06 09:14:06 | 1 | 515 | happy |
78,837,922 | 11,067,209 | Multiheritance preferences on python classes does not take proper super() | <p>Good morning everyone. I am creating Mixin classes in a project to simplify the overall logic of a class diagram, for which I am using multiherences. However, the issue of multi-inheritance preferences is not very clear to me, or at least it is not clear to me how to avoid what is happening to me. Here is the simpli... | <python><oop> | 2024-08-06 08:06:57 | 1 | 665 | Angelo |
78,837,870 | 1,216,635 | Prometheus metrics in Sanic | <p>I'm trying to add metrics to my Sanic app.
Prometheus provides Python client running as ASGI app - <a href="https://prometheus.github.io/client_python/exporting/http/asgi/" rel="nofollow noreferrer">https://prometheus.github.io/client_python/exporting/http/asgi/</a> .</p>
<p>The question is how to run 2 ASGI apps at... | <python><prometheus><metrics><asgi><sanic> | 2024-08-06 07:58:09 | 1 | 2,077 | tulsluper |
78,837,861 | 14,132 | Automatic use of aliases for relationships | <p>I have a schema that includes, among other things, self-joins and many-to-many relationships, like this:</p>
<pre class="lang-py prettyprint-override"><code>from typing import List, Optional
from sqlalchemy import create_engine
from sqlalchemy.orm import (
aliased,
DeclarativeBase,
Session,
Mapped,
... | <python><sqlalchemy><alias> | 2024-08-06 07:55:55 | 1 | 12,742 | moritz |
78,837,838 | 4,772,565 | How to test calls of a mocked dataclass in Python? | <p>I want to write a unit test to a function which instantiates a dataclass twice followed by calling its method. However, the actual calls of the instantiation includes the calling of the method. This is confusing to me.</p>
<p><code>person.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>from dataclasse... | <python><python-unittest><python-dataclasses><python-mock> | 2024-08-06 07:50:44 | 2 | 539 | aura |
78,837,775 | 678,861 | Cast variable to right type automatically in Python | <p>Is there a way in Python to implement type-casting that automatically chooses the right type?</p>
<p>Say you have a class:</p>
<pre><code>class Foo:
foo: list[int]
def __init__(self):
self.foo = cast(list[int], api.get())
</code></pre>
<p>You know that <code>api.get()</code> always returns <code>lis... | <python><casting><python-typing> | 2024-08-06 07:37:07 | 2 | 957 | Dawn Drescher |
78,837,463 | 14,250,641 | HuggingFace: Efficient Large-Scale Embedding Extraction for DNA Sequences Using Transformers | <p>I have a very large dataframe (60+ million rows) that I would like to use a transformer model to grab the embeddings for these rows (DNA sequences). Basically, this involves tokenizing first, then I can get the embeddings.
Because of RAM limits, I have found that tokenizing and then embedding all in one py file won'... | <python><huggingface-transformers><huggingface><huggingface-tokenizers><huggingface-datasets> | 2024-08-06 06:09:24 | 0 | 514 | youtube |
78,837,003 | 6,030,951 | VSCode Pylance Errors on FastAPI Response Type that Converts | <p>I'm using VSCode and the default Python Language Support extension from MS, whcih lints with Pylance. I have a Python 3.12 FastAPI project which uses type annotations to indicate which models should be returned as responses from the handlers using the pattern suggested by the FastAPI docs (<a href="https://fastapi.t... | <python><fastapi><pydantic><pyright><sqlmodel> | 2024-08-06 02:27:04 | 0 | 2,021 | Dave |
78,836,989 | 5,029,509 | TensorFlow for Differential Privacy | <p>I am testing an example code from the <strong>TensorFlow</strong> website using <strong>Jupyter Notebook</strong>. You can find the code at the following link:</p>
<p><a href="https://www.tensorflow.org/responsible_ai/privacy/tutorials/classification_privacy" rel="nofollow noreferrer">https://www.tensorflow.org/resp... | <python><tensorflow><machine-learning><privacy> | 2024-08-06 02:18:31 | 0 | 726 | Questioner |
78,836,766 | 4,171,481 | Is there a way to enforce the number of members an enum is allowed to have? | <p>Making an enum with exactly <em>n</em> many members is trivial if I've defined it myself:</p>
<pre><code>class Compass(enum.Enum):
NORTH = enum.auto()
EAST = enum.auto()
SOUTH = enum.auto()
WEST = enum.auto()
## or ##
Coin = enum.Enum('Coin', 'HEADS TAILS')
</code></pre>
<p>But what if this enum wi... | <python><enums> | 2024-08-05 23:47:52 | 2 | 542 | ibonyun |
78,836,542 | 18,050,861 | How to set the start date of the workweek for a month using Python? | <p>I have a database with a date column in the following format:</p>
<p><a href="https://i.sstatic.net/WiUzvBXw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WiUzvBXw.png" alt="data" /></a></p>
<p>However, I need to work with this database so that it can be recognized as a time series. In this case, th... | <python><dataframe><datetime><time-series> | 2024-08-05 21:44:43 | 2 | 375 | User8563 |
78,836,505 | 678,572 | How to evaluate nested boolean/logical expressions in Python? | <p>I'm working on a complex rule parser that has the following properties:</p>
<ul>
<li>A space character separates rules</li>
<li>A "+" character indicates an "AND" operator</li>
<li>A "," character indicates an "OR" operator</li>
<li>A "-" indicates an optional elemen... | <python><parsing><boolean><boolean-logic><evaluate> | 2024-08-05 21:30:15 | 4 | 30,977 | O.rka |
78,836,482 | 3,103,957 | Path parameter type in Python's FastAPI | <p>In Python FastAPI, while associating path parameter with type, can we use only use path type (to mention a file path)?</p>
<p>For example, the below is accepted and works fine:</p>
<pre><code>@api.get("/{a:path}")
def get(a):
return "Hello"
</code></pre>
<p>Does it not accept any other type ?... | <python><fastapi><starlette><path-parameter> | 2024-08-05 21:21:35 | 3 | 878 | user3103957 |
78,836,438 | 10,997,667 | QFiledDialog setFileMode(Directory) with nameFilters | <p>In a python program using Qt I would like to be able to select a directory using <code>QtWidgets.QFileDialog()</code> with <code>Directory</code> mode of <code>setFileMode()</code> method, but also filter the contents of the selected directory using the <code>setNameFilter()</code> method. I'm currently using:</p>
<... | <python><pyqt> | 2024-08-05 21:04:59 | 0 | 787 | osprey |
78,836,273 | 14,617,547 | HTTPConnectionPool(host='0.0.0.0', port=8000): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3 | <p>I wrote a FASTapi program that I used to run it with <code>ngrok</code> library to create external ports for it as I run it on Colab. Then I dockerized it without <code>ngrok</code> like this:</p>
<pre><code>FROM python:3.10-slim
RUN apt-get update && apt-get install -y ffmpeg
WORKDIR /app
COPY . /app
RU... | <python><docker><connection><google-colaboratory><fastapi> | 2024-08-05 20:07:48 | 0 | 410 | Beryl Amend |
78,836,171 | 14,345,989 | Periodic writes while reading large amount of data | <p>I have a large number of image files (~220,000) stored on a fast, local SSD. Using python and the <a href="https://pypi.org/project/tifffile/" rel="nofollow noreferrer">tifffile library</a> I read the images in as numpy arrays, which are then combined into a single array and saved to disk. Reading this combined arra... | <python><numpy><multiprocessing> | 2024-08-05 19:35:46 | 1 | 886 | Mandias |
78,836,105 | 3,156,085 | Why isn't the `pytest_addoption` hook run with the configured `testpaths`? (usage error) | <h1>Summary:</h1>
<p>I'm trying to set up a custom pytest option with the <a href="https://docs.pytest.org/en/8.1.x/example/simple.html#pass-different-values-to-a-test-function-depending-on-command-line-options" rel="nofollow noreferrer"><code>pytest_addoption</code></a> feature.</p>
<p>But when trying to configure my ... | <python><pytest> | 2024-08-05 19:15:32 | 1 | 15,848 | vmonteco |
78,836,094 | 11,824,828 | LangChain Chat History | <p>I am struggling with passing context to conversational rag chain when using RunnableWithMessageHistory.</p>
<p>I have the following query function:</p>
<pre><code>def query(query_text, prompt, session_id, metadata_context):
# History retrieval test
contextualize_q_prompt = ChatPromptTemplate.from_messages(
[
... | <python><langchain><large-language-model><rag> | 2024-08-05 19:12:34 | 1 | 325 | vloubes |
78,836,067 | 3,183,808 | SQLAlchemy - psycopg2.errors.InvalidSchemaName: no schema has been selected to create in | <p>I am connecting a FastAPI and SQLAlchemy app to a postgres deployment using kubernetes.</p>
<p>I am specifying my connection string and schema as follows:</p>
<pre><code>DB_URL = f"postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{DB}:5432/{DB_NAME}"
engine = create_engine(DB_URL, connect_args={&... | <python><postgresql><sqlalchemy><psycopg2> | 2024-08-05 19:05:43 | 1 | 435 | jm22b |
78,835,929 | 13,971,251 | Unable to find Chromium that works with Chrome | <p>My chrome is version Version 127.0.6533.89 64-bit. I downloaded the according chromedriver from [https://googlechromelabs.github.io/chrome-for-testing/#stable][1], which is version 127.0.6533.88 (mine is .89).</p>
<p>When I run my program I get the following errors:</p>
<pre><code>Traceback (most recent call last):
... | <python><selenium-webdriver><path> | 2024-08-05 18:24:48 | 1 | 1,181 | Kovy Jacob |
78,835,812 | 10,145,953 | ROC curve *without* a model estimator? | <p>I have created an AI Tool which extracts content from an image and then reviews that content for completeness and accuracy. I am trying to evaluate the performance of this tool and am gathering metrics to do so.</p>
<p>I have a resulting table that looks similar to the below; the true values come from manual ground ... | <python><scikit-learn><classification><roc> | 2024-08-05 17:53:18 | 2 | 883 | carousallie |
78,835,771 | 181,783 | StopIterator seemingly raised prematurely by generator in nested for loop | <p>I expected the above generator to produce at least 16 values but for reasons beyond me a <code>StopIterator</code> is raised at the end of the innermost for loop.</p>
<p>What am I doing wrong?</p>
<pre class="lang-py prettyprint-override"><code>>>> def generator():
... counter = 0
... upper_index = ... | <python><generator> | 2024-08-05 17:43:43 | 1 | 5,905 | Olumide |
78,835,718 | 13,016,237 | SQL case when in where condition | <p>I'm trying to conver SQL to Python, have added the sqlfiddle <a href="https://sqlfiddle.com/oracle/online-compiler?id=c38f55d2-6992-43fe-8ef5-484446c86794" rel="nofollow noreferrer">here</a></p>
<p>This link has the input & expected output along with SQL as below:</p>
<pre><code>select a.id, b.country, a.person,... | <python><pandas><join> | 2024-08-05 17:31:11 | 2 | 614 | pc_pyr |
78,835,509 | 9,363,181 | Dynamically infer schema of JSON data using Pyspark | <p>I have a <code>MongoDB</code> server from which I load the data in a <code>PySpark</code> Dataframe. However, the problem is due to some differences between the systems(I also tried legacy data types) I can't load the data directly from <code>MongoDB</code>. So, I have to provide an external schema. Now, the problem... | <python><json><mongodb><pyspark> | 2024-08-05 16:34:49 | 3 | 645 | RushHour |
78,835,397 | 7,985,055 | how to extract dataframe values to form an array? | <p>I have an excel sheet, which I am trying to process with Python as part of an ETL process.</p>
<p>I have an Excel sheet with a bunch of data in it. But the columns are not the first row on the Excel sheet, which is a dump of JIRA isssues.</p>
<p>file.xlsb</p>
<pre><code>time stamp row.
Export x number of issue
Pro... | <python><pandas><dataframe> | 2024-08-05 16:11:13 | 2 | 525 | Mr. E |
78,835,286 | 14,358,734 | seaborn countplot that only counts total number of data points below and above a threshold | <p>Here's my data structure:</p>
<pre><code>betterTrue = [random.randint(0,1) for x in range(500)]
betterFalse = [(x + 1) % 2 for x in betterTrue]
data = {
"model": ["A" for x in range(500)] + ["B" for x in range(500)],
"safety": [random.randint(0,4) for x in range(1000)... | <python><seaborn> | 2024-08-05 15:46:28 | 1 | 781 | m. lekk |
78,835,220 | 7,920,004 | Ariflow Tasks in TaskGroup run out of order | <p>I'm using <code>Dynamic Task Mapping</code> feature with <code>Task Groups</code> to generate n number of tasks for my input list. DAG gets generated but at execution I'm seeing odd behaviour.
<a href="https://i.sstatic.net/iDbTPLj8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iDbTPLj8.png" alt="en... | <python><airflow><mwaa> | 2024-08-05 15:33:14 | 1 | 1,509 | marcin2x4 |
78,835,219 | 243,755 | Failed to install pandas due to error "pytz >= 2011k" | <p>I failed to install pandas due to the following error, what might be wrong? Thanks</p>
<pre><code>Collecting pandas==0.23.4
Using cached pandas-0.23.4.tar.gz (10.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing meta... | <python><pandas> | 2024-08-05 15:33:10 | 1 | 29,674 | zjffdu |
78,835,135 | 12,182,475 | pyplot's contourf does not apply colors according to levels | <p>I am trying to plot some data with pyplot's <code>contourf</code> function. I want to define 9 levels, not linearly spaced. In my understanding each level should then receive its own color given that I use a colormap with 9 colors. I want values below and above the defined levels to be colored in the same color as t... | <python><matplotlib><colormap><contourf> | 2024-08-05 15:13:00 | 1 | 415 | Olmo |
78,835,070 | 3,906,713 | Jupyterlab widgets do not work, resulting in "Loading widgets..." text | <p>I have <code>Python=3.10.8</code>, <code>jupyterlab=4.2.4</code>, <code>jupyterlab_widgets=3.0.11</code>, <code>ipywidgets=8.1.3</code></p>
<p>Importing basic ipywidgets</p>
<pre><code>import ipywidgets as widgets
slider = widgets.IntSlider(value=5, min=0, max=10, step=1)
slider
</code></pre>
<p>results in <code>Loa... | <python><widget><jupyter-lab> | 2024-08-05 14:57:03 | 0 | 908 | Aleksejs Fomins |
78,835,050 | 2,329,968 | Multiple elements in set with the same hash | <p>I was reading through <a href="https://github.com/sympy/sympy/wiki/release-notes-for-1.13.0" rel="nofollow noreferrer">SymPy 1.13.0 release notes</a> when an entry caught my attention (emphasis mine):</p>
<blockquote>
<p>The hash function for <code>Floats</code> and expressions involving Float now respects the hash ... | <python><hash><set><sympy><hash-collision> | 2024-08-05 14:51:21 | 3 | 13,725 | Davide_sd |
78,835,020 | 22,538,132 | Camera calibration using OpenCV 4.10 | <p>I have a ChArUco board and I do like to do intrinsic camera calibration using OpenCV 4.10, what I have tried is to mimic this <a href="https://stackoverflow.com/a/74975523/22538132">answer</a>:</p>
<pre class="lang-py prettyprint-override"><code>import os
import cv2
import glob
img_folder_path = f"{os.getenv('... | <python><opencv><camera-calibration><aruco> | 2024-08-05 14:45:12 | 1 | 304 | bhomaidan90 |
78,834,627 | 23,260,297 | Replace an empty value with nan in dataframe | <p>I have a dataframe with empty values in some rows like this:</p>
<pre><code>ID Date Price Curr
A Jan 21 (10,0) USD
B Aug 8 (10,0) USD
C Sep 29 (10,0) USD
settle Aug 24 ( ,)
</code></pre>
<p>where the last row has 2 empty values in <code>Price</code> and <c... | <python><pandas> | 2024-08-05 13:16:15 | 4 | 2,185 | iBeMeltin |
78,834,604 | 5,816,253 | create a query with string variable using python gql and psycopg2 | <p>Let's say Ia have the following string to be passed as query for an API call using python:</p>
<pre><code>import psycopg2
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
from datetime import datetime
start_year = str(datetime.now().year -4)
end_year = str(datetime.now().year)
q... | <python><gql> | 2024-08-05 13:10:45 | 0 | 375 | sylar_80 |
78,834,557 | 5,790,653 | How to join the last two occurences of each ID in a list of dictionaries into one list | <p>I have a list like this:</p>
<pre class="lang-py prettyprint-override"><code>list1 = [
{'id': 'ABC', 'created_at': datetime.date(2024, 8, 1, 11, 22, 3)},
{'id': 'ABC', 'created_at': datetime.date(2024, 8, 2, 11, 22, 3)},
{'id': 'ABC', 'created_at': datetime.date(2024, 8, 3, 11, 22, 3)},
{'id': 'ABC',... | <python> | 2024-08-05 13:00:00 | 2 | 4,175 | Saeed |
78,834,504 | 10,513,151 | Spark Code Completion in Visual Studio Code | <p>I am trying to use Visual Studio Code for Spark development.</p>
<p>My PySpark code all runs fine, but there is no code completion/hints.</p>
<p>How can I add these features for VS Code?</p>
<p>I have the Python and Pylance extensions installed.</p>
<p>In PyCharm this all work perfectly as expected.</p>
| <python><apache-spark><visual-studio-code><pyspark><vscode-extensions> | 2024-08-05 12:47:05 | 2 | 671 | Bob |
78,834,503 | 10,517,777 | How to manage changes in the configuration files of a python project | <p>I have the following folder structure in my python project:</p>
<pre><code>main_folder/
|-- python_code_subfolder/
| |-- .git
| |-- .venv
| |-- tests/
| |-- test_code.py
| |-- __init__.py
| |-- code.py
|-- config.json
|-- headers.json
|-- body.json
</code></pre>
<p>The folder "<strong>python_co... | <python><git> | 2024-08-05 12:46:50 | 0 | 364 | sergioMoreno |
78,834,447 | 9,542,989 | Optimizing Record Parsing from DynamoDB PartiQL Query Execution via Python | <p>I am running PartiQL queries against my DynamoDB tables using <code>boto3</code> and I want to be able to parse these records into a tabular format (<code>pandas</code> DataFrame).</p>
<p>This is what my code looks like:</p>
<pre><code>import boto3
from boto3.dynamodb.types import TypeDeserializer
import panads as p... | <python><amazon-dynamodb><boto3> | 2024-08-05 12:28:42 | 1 | 2,115 | Minura Punchihewa |
78,834,232 | 1,191,068 | Floating point precision loss in python numpy calculations | <p>I have a very strange situation: I calculate angle between two vectors in spherical coordinate system. First I calculate scalar product of two vectors. Calculation using <code>numpy</code> array gives result with relative precision 10^(-16), as it should be for 64-bit floating numbers. But then I call <code>acos</co... | <python><numpy><precision> | 2024-08-05 11:35:06 | 0 | 1,109 | John Smith |
78,834,127 | 948,655 | Define a class (e.g. dataclass or Pydantic BaseModel or TypedDict) whose fields are defined by a collection of strings | <p>Suppose I have a collection of strings defined as a <code>StrEnum</code>:</p>
<pre class="lang-py prettyprint-override"><code>class ValidNames(StrEnum):
OLLY = auto()
ADAM = auto()
ANNA = auto()
</code></pre>
<p>I want to define a class, ideally with Pydantic (for type verification and conversion) that l... | <python><pydantic> | 2024-08-05 11:07:44 | 2 | 8,813 | Ray |
78,834,040 | 12,285,101 | "nbdev_export Fails When Notebook is Nested Inside a Subfolder within the nbs Folder" | <p>I have a repository where I’ve installed nbdev. Previously, on Linux, I was able to create subfolders inside the nbs directory and successfully run nbdev_export. However, now that I'm using Windows, I encounter an error when trying to use nbdev_export with notebooks inside subfolders. The error message is:</p>
<bloc... | <python><jupyter-notebook><nbdev> | 2024-08-05 10:42:12 | 0 | 1,592 | Reut |
78,834,030 | 1,485,926 | VannaAI (with Ollama and ChromaDB) sample program fails at training model step | <p>I'm starting to test VannaAI, and I'm running a sample program based on <a href="https://github.com/vanna-ai/notebooks/blob/main/postgres-ollama-chromadb.ipynb" rel="nofollow noreferrer">Generating SQL for Postgres using Ollama, ChromaDB</a>:</p>
<pre><code>from vanna.ollama import Ollama
from vanna.chromadb import ... | <python><chromadb><ollama> | 2024-08-05 10:40:24 | 1 | 12,442 | fgalan |
78,833,796 | 2,109,064 | Reload module that is imported into __init__.py | <p><strong>What works:</strong> I have a package <code>version_info</code> in which I define a string <code>version_info</code>. When I increment <code>version_info.version_info</code>, the main code prints out the incremented value after the <code>reload</code>.</p>
<p><strong>What doesn't work:</strong> When I increm... | <python> | 2024-08-05 09:43:00 | 2 | 7,879 | Michael |
78,833,765 | 7,173,479 | No matching distribution found for types-pkg-resources | <p>During a Python pre-commit run with the following steps:</p>
<pre><code>...
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies: [types-all]
...
</code></pre>
<p>The following error is presented:</p>
<pre><code>Run poetry run pre-commit ru... | <python><github-actions><pre-commit-hook> | 2024-08-05 09:34:01 | 1 | 869 | George |
78,833,741 | 7,577,930 | In-place operation causes a memory leak. Why? | <p>I have the following piece of code:</p>
<pre class="lang-python prettyprint-override"><code>eigvecs = torch.randn(n, b, dtype=eigval_approximations.dtype, device=eigval_approximations.device)
eigvecs /= torch.linalg.norm(eigvecs, dim=0)
for _ in range(iterations):
eigvecs = torch.linalg.solve(mats - eigval_appr... | <python><pytorch><memory-leaks><out-of-memory><in-place> | 2024-08-05 09:28:41 | 0 | 346 | Moon |
78,833,640 | 241,515 | Pandas: group and sort entire dataframe basing on the value of two columns, preserving within-group order | <p>I have a pandas DataFrame like this:</p>
<pre><code>sample closest_signature distance patient cluster correlation biopsy similarity n_biopsy
0 21506-A HU.1 0.416795 21506 HU.1 0.994611 A 2.399261 2.0
1 21506-B HU.1 0.340269 21506 HU.1 0.993852 B 2.938855 2.0
2 2150... | <python><pandas><dataframe> | 2024-08-05 09:04:57 | 1 | 4,973 | Einar |
78,833,469 | 4,041,117 | Pyplot animation not working properly when plt.pause() is used | <p>I'm trying to create a pyplot simulation using plt.pause() but I can't make even the simplest example work. This is the <a href="https://matplotlib.org/stable/gallery/animation/animation_demo.html" rel="nofollow noreferrer">code</a>:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
np.random.seed(1... | <python><matplotlib><pause> | 2024-08-05 08:24:26 | 1 | 481 | carpediem |
78,833,013 | 7,787,648 | Could not interpret value ` ` for parameter `hue` | <p>I am trying to color a scatterplot by a categorical column. Here is a sample data, the column I want to color the scatterplot by is 'cat'.</p>
<pre><code>data = {
'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'y': [2, 3, 5, 7, 11, 13, 17, 19, 23, 29],
'z': [1, 2, 2, 3, 3, 4, 4, 5, 6, 6],
'cat': ['A', 'A', 'B', 'B', 'A', '... | <python><pandas><seaborn> | 2024-08-05 06:22:46 | 1 | 313 | Jst2Wond3r |
78,832,646 | 2,707,864 | Abaqus scripting: Create a Set from a Face object | <p>I created in Abaqus v6.14 scripting an extruded Part <code>p</code> with <code>BaseSolidExtrude</code>, which is then a cylinder (not necessarily circular). I want to create three sets, one for the top and bottom surface, and one for the lateral surface.
The first two are easy, with</p>
<pre><code>faces = p.faces
fa... | <python><scripting><mask><abaqus> | 2024-08-05 03:36:12 | 2 | 15,820 | sancho.s ReinstateMonicaCellio |
78,832,496 | 4,710,409 | Django- how to convert <class 'django.core.files.uploadedfile.InMemoryUploadedFile'> to an image? | <p>I have a form that uploads an image to my view; the uploaded image type is:</p>
<pre><code><class 'django.core.files.uploadedfile.InMemoryUploadedFile'>
</code></pre>
<p>I want to process the image though; thus I need it in PIL or CV2 format.</p>
<p>How can I do that ?</p>
| <python><django><forms><opencv><python-imaging-library> | 2024-08-05 01:57:53 | 1 | 575 | Mohammed Baashar |
78,832,340 | 7,846,884 | get an item of the output after applying str.split to a polars dataframe column | <p>how can i select last item of list in <code>paths</code> column after applying the str.split("/") function?</p>
<pre><code>dataNpaths = pl.scan_csv("test_data/file*.csv", has_header=True, include_file_paths = "paths").collect()
dataNpaths.with_columns(pl.col("paths").str.split... | <python><string><python-polars> | 2024-08-04 23:29:27 | 1 | 473 | sahuno |
78,832,077 | 875,317 | Why is my string considered an Invalid Argument in Python? | <p>I am brand new to Python.</p>
<p>I have this as the beginnings of my code which is to read and parse a google doc:</p>
<pre><code>from pathlib import Path
def retrieve_parse_and_print_doc(docURL):
path = Path(docURL)
contents = path.read_text()
lines = contents.splitlines()
for line in lines:
... | <python><windows><pathlib> | 2024-08-04 20:39:58 | 1 | 10,717 | B. Clay Shannon-B. Crow Raven |
78,832,062 | 8,275,139 | Least privilege principle to create files in a bucket | <p>I'm trying to grant a service account a limited set of permissions and allow it to create files on a specific bucket. Instead of creating a custom role, I thought on using the <code>roles/storage.objectCreator</code> predefined one on the bucket.</p>
<p>After that, I run the following lines of code by impersonating ... | <python><google-cloud-storage> | 2024-08-04 20:29:31 | 1 | 1,077 | Luiscri |
78,831,561 | 14,684,366 | Printing subprocess stdout lines output | <p>I created a simple Python function:</p>
<pre class="lang-py prettyprint-override"><code>import subprocess
from io import TextIOWrapper
def run_shell_command(command: list, debug: bool = False):
'''
Run shell command
:param command: Shell command
:param debug: Debug mode
:return: Result code an... | <python><python-3.x><subprocess> | 2024-08-04 16:16:04 | 1 | 591 | Floren |
78,831,547 | 22,987,224 | Python - ModuleNotFoundError: No module named 'swig' | <p>When trying to run the gymnasium package under Windows 11, Visual Studio Code, I get the following errors</p>
<pre><code>PS C:\Users\[...]\Code\Gymnasium> & c:/Users/Thomas.koeppen/Code/Gymnasium/.venv/Scripts/python.exe c:/Users/Thomas.koeppen/Code/Gymnasium/main.py
Traceback (most recent call last):
File &q... | <python><swig><gymnasium> | 2024-08-04 16:10:32 | 1 | 355 | Mercutio1243 |
78,831,535 | 15,547,292 | python metaclasses: editing the namespace after `__set_name__` methods have been called? | <p>Suppose we are defining a class with a metaclass.
In the class body, objects are assigned that implement <code>__set_name__</code> to register themselves in a data structure of the class.</p>
<p>Is it possible to edit the namespace <em>after</em> <code>__set_name__</code> methods have been run? Like, detach the fill... | <python><metaclass> | 2024-08-04 16:05:09 | 2 | 2,520 | mara004 |
78,831,454 | 8,543,025 | Update spacing between Plotly subplots | <p>Is there a way to change the vertical/horizontal spacing between subplots in an existing figure?
I couldn't find anything in the docs or user forum, and the following throws a <code>Bad property</code> error:</p>
<pre><code>import numpy as np
import plotly.graph_object as go
from plotly.subplots import make_subplots... | <python><plotly><subplot> | 2024-08-04 15:31:41 | 0 | 593 | Jon Nir |
78,831,453 | 6,357,916 | No module named 'django' when debugging inside vscode even though django is installed | <p>I am trying to debug my django app inside docker container. I have specified following in my requirements file:</p>
<p><strong>requirements.txt</strong></p>
<pre><code>Django==3.2.5
psycopg2-binary==2.9.1
djangorestframework==3.12.4
django-rest-swagger==2.2.0
</code></pre>
<p><strong>Dockerfile</strong></p>
<pre><co... | <python><django><docker><visual-studio-code><docker-compose> | 2024-08-04 15:31:24 | 1 | 3,029 | MsA |
78,831,434 | 16,869,946 | New column in Pandas dataframe using least squares from scipy.optimize | <p>I have a Pandas dataframe that looks like the following:</p>
<pre><code>Race_ID Date Student_ID feature1
1 1/1/2023 3 0.02167131
1 1/1/2023 4 0.17349148
1 1/1/2023 6 0.08438952
1 1/1/2023 ... | <python><pandas><dataframe><scipy><scipy-optimize> | 2024-08-04 15:23:38 | 1 | 592 | Ishigami |
78,831,181 | 9,542,989 | Migrating Stored Procedures Using Alembic | <p>I am using an Alembic project to migrate my database schema between my development and production servers.</p>
<p>I am autogenerating my migration scripts by maintaining a <code>models.py</code> containing the SQLAlchemy models for my tables and then running the following command anytime an update is made to the sch... | <python><stored-procedures><sqlalchemy><database-migration><alembic> | 2024-08-04 13:19:57 | 1 | 2,115 | Minura Punchihewa |
78,831,103 | 2,913,106 | How to handle self-closing tags without end-slash in html.parser.HTMLParser | <p>By default it seems that <code>html.parser.HTMLParser</code> cannot handle self closing tags correctly, if they are not terminated using <code>/</code>. E.g. it handles <code><img src="asfd"/></code> fine, but it incorrectly handles <code><img scr="asdf"></code> by considering it as a... | <python><html><html-parsing> | 2024-08-04 12:41:15 | 1 | 11,728 | flawr |
78,830,955 | 865,220 | In a pandas dataframe, for a given column, How to multiple a value in same row of df with another value in previous row of its own column? | <p>I want to transform a datafram like this</p>
<pre><code>date | colA | ColB
------------------------------------
1971-10-01 0.002451 NaN
1971-11-01 0.002445 NaN
1971-12-01 0.002439 NaN
1972-01-01 0.002433 NaN
1972-02-01 0.004854 NaN
19... | <python><pandas><dataframe> | 2024-08-04 11:33:50 | 1 | 18,382 | ishandutta2007 |
78,830,929 | 21,294,350 | How to write `compose` similar to that in SDF with python? | <p>Recently when I self-learnt MIT 6.5151 course, I first read CS 61AS Unit 0 as the preparation. Then I have read SICP 1 to 2.1 (with related lecture notes) as <a href="https://groups.csail.mit.edu/mac/users/gjs/6.945/psets/ps00/dh.pdf" rel="nofollow noreferrer">ps0</a> requires (also read 2.2.1 as <a href="https://pe... | <python><arguments><scheme><parameter-passing> | 2024-08-04 11:23:12 | 0 | 782 | An5Drama |
78,830,890 | 6,778,374 | How to print only the opening tag of an element in etree? | <p>Given an Element from <code>etree</code>, I would like to print only the opening tag. This would be immensely useful for debugging.</p>
<p>For example:</p>
<pre class="lang-py prettyprint-override"><code>>>> from lxml import etree
>>> elem = etree.fromstring(b'''<bbq taste="awful" smel... | <python><lxml><elementtree> | 2024-08-04 11:05:09 | 1 | 675 | NeatNit |
78,830,862 | 11,357,695 | Testing static methods with pytest | <p>I am trying to test the <code>write_nodes</code> static method from <code>PrunedGraphWriter</code> (please see below). The original function copies files (nodes) from one dir to another, whereas the mocked function just checks that the nodes to be written are what I expect in the test case.</p>
<p>I am getting:</p>... | <python><unit-testing><class><testing><pytest> | 2024-08-04 10:53:22 | 1 | 756 | Tim Kirkwood |
78,830,794 | 14,358,734 | Why is this list index out of range for a return statement but not for a print statement? | <p>The goal: Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.</p>
<p>Return the sum of the three integers.</p>
<p>I've written up a potential solution. At the end, I have a list of lists <code>solution</code>. When I try to print the firs... | <python><list> | 2024-08-04 10:26:03 | 2 | 781 | m. lekk |
78,830,766 | 13,520,223 | How to click the next link with Zyte browser automation? | <p>The <a href="https://docs.zyte.com/web-scraping/tutorial/setup.html#create-your-first-spider" rel="nofollow noreferrer">Zyte tutorial "Create your first spider"</a> crawls <a href="http://books.toscrape.com/catalogue/category/books/mystery_3/index.html" rel="nofollow noreferrer">this page</a> which has a p... | <javascript><python><web-scraping><zyte> | 2024-08-04 10:11:25 | 2 | 693 | Ralf Zosel |
78,830,678 | 865,220 | Combining two dataframes indexed on date based (matching month and year only) | <p>Ignore the date column we just need to merge based on YYYY-MM .
First table has one rwo for each month but second table may have multiple rows for each month. First rows matching month's data should be merged to all of them.</p>
<p>data-frame 1:</p>
<pre><code>2020-01-01 1.480
2020-02-01 1.620
2020-03-01 1.000... | <python><pandas><dataframe> | 2024-08-04 09:22:24 | 2 | 18,382 | ishandutta2007 |
78,830,523 | 140,100 | Align the time range across two or more separate time series | <p>I have several time series that fall within the same time range, but with different sampling rates. The start and end times are the same for all series.</p>
<pre><code>series_a_times = ['2023-01-01', '2023-01-03', '2023-01-04', '2023-01-08']
series_b_times = ['2023-01-01', '2023-01-04', '2023-01-04', '2023-01-08']
s... | <python><algorithm><time-series> | 2024-08-04 07:46:38 | 1 | 21,420 | Night Walker |
78,830,224 | 3,104,963 | How can I get around an unresolved hostname or unrecognized name error using HTTP(S) in java or python? | <p>I a trying to access a website's information programmatically, but on both Java and Python it is unable to resolve a hostname. If I specify the IP address, it changes the error to TLSV1_UNRECOGNIZED_NAME. This website is able to resolve without any additional work through any browser though.</p>
<p>I have looked thr... | <python><java><ssl><https><python-requests> | 2024-08-04 03:57:00 | 1 | 402 | KM529 |
78,830,098 | 4,616,233 | Timeout Issue with aiohttp but not with Requests | <p>I'm trying to fetch a webpage in Python using two different methods: <code>requests</code> and <code>aiohttp</code>. The requests method works fine, but the aiohttp method results in a timeout. Here's the code:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
import aiohttp
import requests
headers... | <python><python-3.x><python-requests><python-asyncio><aiohttp> | 2024-08-04 01:31:37 | 2 | 1,251 | graille |
78,829,943 | 8,190,068 | How do I programmatically add an AccordionItem to an Accordion? | <p><strong>UPDATED WITH MORE EXAMPLE CODE</strong></p>
<p>I have a test application which contains an Accordion. <strong>I want to be able to add items to the Accordion from within my python code.</strong></p>
<p>Here is the kv code:</p>
<pre><code>#:kivy 1.0.9
<LayoutTest>:
BoxLayout:
id: mainBox
... | <python><kivy> | 2024-08-03 22:58:42 | 2 | 424 | Todd Hoatson |
78,829,913 | 8,190,068 | How do I implement a Splash screen for my app? | <p>I have a simple test application, and I want to see how to add a splash screen to my app. I tried using a popup for this (<em>is there a better way?</em>), and the popup will preferably have no buttons, just an image that lingers for a short amount of time, then the popup closes automatically.</p>
<p>What I have no... | <python><kivy> | 2024-08-03 22:35:37 | 2 | 424 | Todd Hoatson |
78,829,884 | 7,317,985 | Cannot install Flask with pip on MacOS | <p>I am trying to install flask on my MacOS Ventura with the command:</p>
<pre><code>Pip3 install Flask
</code></pre>
<p>which gives me the following error:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lan... | <python><macos><flask><homebrew> | 2024-08-03 22:12:48 | 1 | 301 | haroon khan |
78,829,678 | 6,597,296 | Is there a way to do this with a list comprehension? | <p>I have a list that looks something like this:</p>
<pre class="lang-py prettyprint-override"><code>data = ['1', '12', '123']
</code></pre>
<p>I want to produce a new list, that looks like this:</p>
<pre class="lang-py prettyprint-override"><code>result = ['$1', '1', '$2', '12', '$3', '123']
</code></pre>
<p>where the... | <python><list-comprehension> | 2024-08-03 20:08:41 | 8 | 578 | bontchev |
78,829,629 | 1,403,470 | date conversion and any() in Pony ORM with SQLite | <p>I am building a web application tutorial using <a href="https://docs.ponyorm.org/" rel="nofollow noreferrer">Pony ORM</a>. My Python is working, but feels very clunky: in particular, I'm managing date conversion by hand after fetching records, and am doing concatenate-then-split string operations to handle a one-to-... | <python><sqlite><ponyorm> | 2024-08-03 19:39:37 | 0 | 1,403 | Greg Wilson |
78,829,500 | 3,018,860 | Querying data from Simbad using astroquery | <p>I'm making a script in Python to get information for all objects from the NGC and IC catalogs. Actually, I already have this information from OpenNGC, however, coordinates don't have the same precision, so I need to combine both dataframes.</p>
<p>What I want is: the name, RA in J2000, Dec in J2000 and the type. Wha... | <python><astropy><astroquery><simbad> | 2024-08-03 18:46:06 | 2 | 2,834 | Unix |
78,829,305 | 10,181,236 | Use python to automatically post on Instagram | <p>I am using instabot package on python to build an app that automatically post photos on my profile.</p>
<p>This is the code I wrote</p>
<pre><code>from instabot import Bot
import configparser
# Reading Configs
config = configparser.ConfigParser()
config.read("config.ini")
# Setting configuration values... | <python><instagram> | 2024-08-03 17:12:39 | 2 | 512 | JayJona |
78,829,255 | 726,373 | concurrent kafka client offset commit management data structure | <h3>Question: Comparing Ring Buffer with Hash Map and Interval Designs for Kafka Client - Which is Better?</h3>
<p>I'm working on optimizing a Kafka client for high-throughput message processing. We're considering two different designs for managing message offsets and statuses: a ring buffer with a hash map and an inte... | <python><go><apache-kafka><concurrency> | 2024-08-03 16:48:08 | 0 | 642 | Jack Peng |
78,829,063 | 3,343,378 | Exclude decorators in pdoc documentation | <p>I would like to exclude decorators from my API documentation using <code>pdoc</code>. Is there any possible way I can achieve that?</p>
<p>For an example, if I write:</p>
<pre><code>@xl_func("blah", "blah")
def examples_are_blah()
print("blah")
</code></pre>
<p>I get the following... | <python><documentation-generation><pdoc> | 2024-08-03 15:25:44 | 1 | 444 | blah_crusader |
78,828,880 | 5,561,472 | strange `re.sub` behaviour if the string include `\n` symbol | <p>I am trying to extract a part of string prior to substring:</p>
<pre class="lang-py prettyprint-override"><code>import re
s = "ab\nc"
print(re.sub(r"(.*)b.*", r"\1", s)) # a\nc
</code></pre>
<p>I would expect to get <code>a</code>, but I am getting <code>a\nc</code>.</p>
<p>Why is it?<... | <python><regex> | 2024-08-03 14:04:41 | 1 | 6,639 | Andrey |
78,828,715 | 934,904 | Finding config.json for Llama 3.1 8B | <p>I installed the Llama 3.1 8B model through Meta's <a href="https://github.com/meta-llama/llama-models" rel="nofollow noreferrer">Github page</a>, but I can't get their example code to work. I'm running the following code in the same directory as the Meta-Llama-3.1-8B folder:</p>
<pre><code>import transformers
import... | <python><pytorch><huggingface><llama><llama3> | 2024-08-03 12:54:18 | 1 | 5,966 | MatthewScarpino |
78,828,636 | 4,489,082 | ValueError while saving a dataframe | <p>I am facing hurdle while saving a pandas data frame to parquet file</p>
<p>Code I am using -</p>
<pre><code>import pandas as pd
import yfinance as yf
start_date = "2022-08-06"
end_date = "2024-08-05"
ticker = 'RELIANCE.NS'
data = yf.download(tickers=ticker, start=start_date, end=end_date, inter... | <python><pandas><yfinance> | 2024-08-03 12:15:03 | 3 | 793 | pkj |
78,828,344 | 315,427 | How to modify Excel sheet without losing extensions? | <p>I am trying to modify excel file, which has number of VBA actions(not created by me). I had gentle attempt to modify single combo box item.</p>
<pre><code>from openpyxl import load_workbook
# Load the workbook
workbook = load_workbook('input.xlsx')
# Select the worksheet
worksheet = workbook['Monthly']
# Change t... | <python><excel> | 2024-08-03 09:30:38 | 1 | 29,709 | Pablo |
78,828,192 | 6,718,081 | What caused Python 3.13-0b3 ( compiled with GIL disabled ) be slower than 3.12.0? | <p>I did a simple performance test on python <code>3.12.0</code> against python <code>3.13.0b3</code> compiled with a <code>--disable-gil</code> flag. The program executes calculations of a Fibonacci sequence using <code>ThreadPoolExecutor</code> or <code>ProcessPoolExecutor</code>. The docs on the PEP introducing disa... | <python><performance><cpython><gil><pep> | 2024-08-03 08:11:39 | 2 | 923 | K4liber |
78,828,009 | 10,200,497 | How can I get the group that has the largest streak of negative numbers in a column and add another condition to filter the groups? | <p>This is an extension to this accepted <a href="https://stackoverflow.com/a/78824669/10200497">answer</a>.</p>
<p>My DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [-3, -1, -2, -5, 10, -3, -13, -3, -2, 1, 2, -100],
'b': [1, 2, 3, 4, 5, 10, 80, 90, 100, 99, 1, 12]
}
)
<... | <python><pandas><dataframe> | 2024-08-03 06:34:34 | 3 | 2,679 | AmirX |
78,828,007 | 4,399,016 | Integrating Holoviz Panel and Django to build Dashboard Webapps | <p>I am looking for any working example of a Django project that is integrated with <a href="https://panel.holoviz.org/" rel="nofollow noreferrer">Panel Apps</a>. There is a section in the <a href="https://panel.holoviz.org/how_to/integrations/Django.html" rel="nofollow noreferrer">user guide</a> that gives tips on how... | <python><django><web-applications><dashboard><holoviz-panel> | 2024-08-03 06:32:24 | 0 | 680 | prashanth manohar |
78,827,959 | 3,442,922 | How to get the index of an ordinal value from a numpy 3d array? | <p>I have a 3d array of shape: (2, 3, 3) from which I would like to get the index of the 10th value. I have built a program through the conventional method of using loops.
Below is my solution:</p>
<pre><code>import numpy as np
arr = np.arange(1, 19).reshape(2, 3, 3)
el = 10
count = 0
loc = ()
for each_arr in np.arang... | <python><numpy> | 2024-08-03 06:03:01 | 0 | 336 | Vivek |
78,827,743 | 11,748,924 | resample_poly of one-hot encoded masking | <p>I have these tensors:</p>
<pre><code>X_test = X_unseen_flutter[0,0,:][None, :] # (Batch Size, Amplitude Length) -> (1, 3208)
y_true = y_unseen_flutter[0,0,:][None, :] # (Batch Size, Mask Length, Num of Classes) -> (1, 3208, 4) (One-Hot Encoded)
</code></pre>
<p>I can resample the <code>X_test</code>, but I hav... | <python><numpy><machine-learning><scipy><signal-processing> | 2024-08-03 03:21:27 | 0 | 1,252 | Muhammad Ikhwan Perwira |
78,827,639 | 5,255,911 | Playwright - issue with the footer template parsing | <p>Playwright (Python) save a page as PDF function works fine when there's no customisation in the header or footer. However, when I try to introduce a custom footer, the values don't seem to get injected appropriately.</p>
<p>Example code:</p>
<pre class="lang-py prettyprint-override"><code>from playwright.sync_api im... | <python><playwright><playwright-python> | 2024-08-03 01:10:04 | 1 | 896 | MaduKan |
78,827,396 | 4,023,639 | Python 3d scatter plot linking annotation between subplots | <p>I have two (or more) 3d scatter plots in subplots, each showing different 3 variables of a data set. When I hover over a data in one subplot, I'd like other subplots to also automatically show the same data sample. Currently, I am able to show annotation (on hover) for one plot using mplcursors module (in jupyter no... | <python><matplotlib><hover><scatter-plot> | 2024-08-02 22:17:27 | 1 | 1,083 | user32147 |
78,827,386 | 54,873 | How to use xxhash in hashlib.file_digest? | <p>I want to quickly compute hash values of large files on disk to compare them to one another.</p>
<p>I'm using the following:</p>
<pre><code> import hashlib
def sha256sum(filename):
with open(filename, 'rb', buffering=0) as f:
return hashlib.file_digest(f, 'sha256').hexdigest()
</code></pre>
<p>But I'd l... | <python><hash><sha><hashlib> | 2024-08-02 22:11:53 | 1 | 10,076 | YGA |
78,827,379 | 610,569 | What is the max_tokens number I can put for OpenAI GPT generate function? | <p>I've tried to use 100_000, 20_000 but seems like only 10_000 is possible:</p>
<pre><code>from openai import OpenAI
client = OpenAI()
messages = {"role": "user", "content": "Hello"}
completion = client.chat.completions.create(
model="gpt-4o-mini", messages=m... | <python><openai-api><large-language-model><gpt-4o-mini> | 2024-08-02 22:09:30 | 1 | 123,325 | alvas |
78,827,074 | 6,197,439 | Visual replacement of area of subwidgets in pair of custom widgets with a single widget in PyQt5? | <p>In the example code below, I have a CustomWidget consisting of a main label (red) on top, and sub label (yellow) on bottom - and I instantiate several of those in a scroll area:</p>
<p><a href="https://i.sstatic.net/0k9O4HMC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0k9O4HMC.png" alt="starting w... | <python><pyqt5> | 2024-08-02 20:00:38 | 1 | 5,938 | sdbbs |
78,827,002 | 2,233,608 | How to query a MultiIndex by MultiIndex and choose the "best" row? | <p>Say I have a <code>MultiIndex</code> by <code>MultiIndex</code> <code>DataFrame</code> similar to the one generated here (in the real use case the list of races is dynamic and not known ahead of time):</p>
<pre class="lang-py prettyprint-override"><code>import random
import pandas as pd
random.seed(1)
data_frame_... | <python><pandas><dataframe><multi-index> | 2024-08-02 19:37:49 | 2 | 1,178 | niltz |
78,826,732 | 13,469,674 | How do create_history_aware_retriever and RunnableWithMessageHistory interact when used together? | <p>I am building a chatbot, following the Conversational RAG example in langchain's documentation: <a href="https://python.langchain.com/v0.2/docs/tutorials/qa_chat_history/" rel="nofollow noreferrer">https://python.langchain.com/v0.2/docs/tutorials/qa_chat_history/</a></p>
<p>So far I was able to create the bot with c... | <python><langchain><py-langchain> | 2024-08-02 18:06:59 | 1 | 955 | DPM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.