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,097,616
1,008,588
Django Summernote plugin upload image by userid
<p>I am using the Summernote plugin for Django and my target is to allow users to upload media inside the server. At the moment files are organized (by default) in a folder named with the upload date. Something like:</p> <ul> <li>&quot;ProjectName/media/django-summernote/<strong>2024-10-11</strong>/989d2f98-ad3c-47d6-9...
<python><django><django-forms><django-settings><summernote>
2024-10-17 10:18:49
1
2,764
Nicolaesse
79,097,475
4,489,082
MemoryError in creating large numpy array
<p>My objective is to plot a histogram given values and counts. <code>hist</code> only takes an array of data as input. I have tried to recreat data using <code>np.repeat</code>, but this gives <code>MemoryError: Unable to allocate 15.9 GiB for an array with shape (2138500000,) and data type float64</code>.</p> <p>Want...
<python><numpy><matplotlib>
2024-10-17 09:42:30
2
793
pkj
79,097,421
4,451,315
rolling sum with right-closed interval in duckdb
<p>In Polars / pandas I can do a rolling sum where row each row the window is <code>(row - 10 minutes, row]</code>. For example:</p> <pre class="lang-py prettyprint-override"><code>import polars as pl data = { &quot;timestamp&quot;: [ &quot;2023-08-04 10:00:00&quot;, &quot;2023-08-04 10:05:00&quot;...
<python><postgresql><python-polars><duckdb>
2024-10-17 09:29:59
2
11,062
ignoring_gravity
79,097,403
21,446,483
Azure python webapp deploy shows as running even though it is successful
<p>When I deploy my webapp using the azure CLI the command keeps running until it times out but the app itself deploys successfully and quickly. Sometimes, seemingly randomly, the cli command correctly detects this and shows a successful deploy.</p> <p>Command:</p> <pre><code>az webapp up --subscription &lt;subscriptio...
<python><azure><azure-web-app-service>
2024-10-17 09:25:33
1
332
Jesus Diaz Rivero
79,097,077
281,201
Converting .py file to Databricks with Markdown
<p>I wish to convert a python <code>.py</code> file into one that can be run on Databricks with multiple cells. I don't wish to do it in the GUI, as I'll eventually want an automated process for this. What is the minimal code to create a title cell and then have the rest of the code being Python code? I've tried this, ...
<python><markdown><databricks>
2024-10-17 07:49:56
2
3,519
Warpspace
79,096,977
3,580,213
Dynamic type instantiation of Local class in Python 3.7
<p>I'm trying to do some custom serialization/deserialization and must be able to handle custom data-classes, even local ones within functions. I found a <a href="https://stackoverflow.com/questions/4821104/dynamic-instantiation-from-string-name-of-a-class-in-dynamically-imported-module">question about this with a prop...
<python><python-3.7>
2024-10-17 07:21:06
1
867
freakinpenguin
79,096,965
4,094,231
How to append a middleware in specific spider along with the ones set in settings.py?
<p>There are certain middlewares enabled for all spiders in <code>settings.py</code>.</p> <p>How to append another middleware for one specific spider, along with all the ones in <code>settings.py</code>?</p> <p>Let say <code>settings.py</code> is:</p> <pre class="lang-py prettyprint-override"><code>DOWNLOADER_MIDDLEWAR...
<python><scrapy>
2024-10-17 07:18:13
2
21,655
Umair Ayub
79,096,544
21,305,238
What is the `πœ‹thon` executable?
<p>On Ubuntu and other Linux-based systems, Python 3.14's <code>venv</code> creates an extra executable named <code>πœ‹thon</code>:</p> <pre class="lang-bash prettyprint-override"><code>$ python --version Python 3.13.0 $ python -m venv .venv $ cd .venv/bin &amp;&amp; ls Activate.ps1 activate activate.csh activate.fis...
<python><python-venv>
2024-10-17 05:09:25
1
12,143
InSync
79,096,421
1,492,229
How to split my dataset into Test and Train without repitition?
<p>I am developing a Python script to test an algorithm. I have a dataset that I need to split into 80% for training and 20% for testing. However, I want to save the test set for further analysis, ensuring no overlap with previous test sets.</p> <p>Although my code works well overall, I encountered one issue: the test ...
<python><machine-learning><train-test-split>
2024-10-17 03:50:34
1
8,150
asmgx
79,096,144
5,350,089
Socket Timeout will kill the Thread in Python
<p>I am going to use the following Python program in my dedicated online server. My doubt is for each and every new connection to server, it is creating a new thread number. I already set the timeout function for the child. It is working fine, but the thread number keeps on increasing. I thought the thread is not clear...
<python><multithreading><sockets><tcp><timeout>
2024-10-17 00:35:10
1
445
Sathish
79,096,122
4,582,026
Call function within a function but keep default values if not specified
<p>I have two sub functions that feed into one main functions as defined below:</p> <p>Sub function 1:</p> <pre><code>def func(x=1, y=2): z = x + y return z </code></pre> <p>Sub function 2:</p> <pre><code>def func2(a=3, b=4): c = a - b return c </code></pre> <p>Main function:</p> <pre><code>def finalFun...
<python>
2024-10-17 00:15:47
4
549
Vik
79,096,118
1,809,784
Crypto.com Exchange API Create Order unauthorised
<p>I am trying to use Crypto.com API and when I am calling private/create-order to buy an instrument I am getting 401 Http status code with 40101 code, which means Unauthorised - Not authenticated, or key/signature incorrect</p> <p>I tried calling private/user-balance and i can successfully get my balance so it can't b...
<python><crypto.com-exchange-api>
2024-10-17 00:10:29
1
538
Robert Dinaro
79,095,934
9,983,652
how to extract a cell value from a dataframe?
<p>I am trying to extract a cell value from a dataframe, then why I always get a series instead of a value.</p> <p>For example:</p> <pre><code>df_test=pd.DataFrame({'Well':['test1','test2','test3'],'Region':['east','west','east']}) df_test Well Region 0 test1 east 1 test2 west 2 test3 eas well='test2' ...
<python><pandas><indexing>
2024-10-16 21:57:46
3
4,338
roudan
79,095,927
128,967
Providing an IPython Interpreter During Development in a Hatch Project
<p>I have a project using Hatch as a build system for <code>pyproject</code>. My <code>pyproject.toml</code> looks like this:</p> <pre class="lang-ini prettyprint-override"><code>[project] name = &quot;demo&quot; description = &quot;Demo Project&quot; version = &quot;0.0.1&quot; readme = &quot;README.md&quot; requires-...
<python><ipython><pyproject.toml><hatch>
2024-10-16 21:51:19
1
92,570
Naftuli Kay
79,095,884
642,793
pymqi - 2009 - FAILED: MQRC_CONNECTION_BROKEN
<p>I'm running a below simple python MQ put/get program in my local machine that connects to a list of qmgrs running on a remote machine 'qmgr.test.com'.</p> <p>I'm getting MQRC 2009 error.</p> <p><code>MQ Error for QMGR1: 2009 - FAILED: MQRC_CONNECTION_BROKEN</code></p> <p><code>MQ Error for QMGR2: 2009 - FAILED: MQRC...
<python><ibm-mq><pymqi>
2024-10-16 21:28:36
1
1,077
Vignesh
79,095,809
3,641,435
Using pyparsing for parsing filter expressions
<p>I'm currently trying to write a parser (using pyparsing) that can parse strings that can then be applied to a (pandas) dataframe to filter data. I've already got it working after much trial &amp; error for all kinds of example strings, however I am having trouble with extending it further from this point on.</p> <p>...
<python><pyparsing>
2024-10-16 20:55:06
1
491
Olorun
79,095,773
1,000,204
Github Actions cannot find my poetry-installed dev dependencies and therefore cannot find the aws_cdk module when trying to call cdk deploy
<p>I have a mangum python service with a cdk stack that I can deploy on my local box just fine. Here are my:</p> <p>pyproject.toml</p> <pre><code>[tool.poetry] name = &quot;dics-core-data-service&quot; version = &quot;0.1.0&quot; description = &quot;&quot; authors = [&quot;Clayton &lt;clayton.stetz@gmail.com&gt;&quot;...
<python><github-actions><aws-cdk><python-poetry>
2024-10-16 20:43:24
1
329
kamii
79,095,766
5,201,265
401 Unauthorized Error when fetching Apple's public keys
<p>I keep getting 401 Unauthorized error when fetching Apple's public keys.</p> <p>In [14]: print(f&quot;Error fetching public keys: {response.status_code} {response.text}&quot;) Error fetching public keys: 401 Unauthenticated</p> <p>I've verified that the Key ID, Issuer ID, and private key file are all correct, with t...
<python><ios><jwt><apple-push-notifications>
2024-10-16 20:41:24
1
647
Lucia
79,095,560
1,457,380
Technique for traveling through a dictionary
<p>Given a dictionary where the keys hold coordinates and the values hold a list of possible values, how to output a list of <strong>all</strong> the dictionaries that can be created with a single value taken from each list?</p> <pre><code>input = {(0, 0): [1, 2], (0, 1): [3, 4]} output = [{(0, 0): 1, (0, 1): 3}, {(0,...
<python><dictionary>
2024-10-16 19:27:14
1
10,646
PatrickT
79,095,529
4,400,686
Manim/python overwrites update function, animating only last updater
<p>I am attempting to make a Manim animation where dots follow a set of radial basis functions as a function of x. I've also made a vertical line that the dots should follow exactly. Strangely, the dots appear to overlap each other, making it look like only one dot is in the animation. Using <code>pdb.set_trace</code>,...
<python><manim>
2024-10-16 19:16:51
1
321
Eric Taw
79,095,508
16,869,946
Pandas groupby transform mean with date before current row for huge dataframe
<p>I have a Pandas dataframe that looks like</p> <pre><code>df = pd.DataFrame([['John', 'A', '1/1/2017', '10'], ['John', 'A', '2/2/2017', '15'], ['John', 'A', '2/2/2017', '20'], ['John', 'A', '3/3/2017', '30'], ['Sue', 'B', '1/1/2017', '10'], ...
<python><pandas><dataframe><group-by>
2024-10-16 19:10:34
2
592
Ishigami
79,095,468
425,895
How to pass parameters to this sklearn Cox model in a Pipeline?
<p>If I run the following Python code it works well:</p> <pre><code>target = 'churn' tranOH = ColumnTransformer([ ('one', OneHotEncoder(drop='first', dtype='int'), make_column_selector(dtype_include='category', pattern=f&quot;^(?!{target}).*&quot;) ) ], remainder='passthrough') dftrain2 = tranOH.fit_transform(dft...
<python><scikit-learn><cox-regression><scikit-learn-pipeline>
2024-10-16 18:58:18
1
7,790
skan
79,095,149
11,357,695
Pandas dataframe is mangled when writing to csv
<p>I have written a pipeline to send queries to <a href="https://www.uniprot.org/help/api" rel="nofollow noreferrer">uniprot</a>, but am having a strange issue with one of the queries. I've put this into a small test case below.</p> <p>I am getting the expected dataframe (<code>df</code>) structure (one row and 15 col...
<python><pandas><dataframe><csv><bioinformatics>
2024-10-16 17:18:59
1
756
Tim Kirkwood
79,095,041
2,979,749
detectron2 installation - No module named 'torch'
<p>I am trying to install detectron2 on ubuntu and face a weird python dependency problem. In short - pytorch is installed (with pip), torchvision is installed (with pip), but when I run</p> <pre><code>pip install 'git+https://github.com/facebookresearch/detectron2.git' </code></pre> <p>I get error ModuleNotFoundError:...
<python><pytorch>
2024-10-16 16:46:40
1
3,974
Lech Migdal
79,094,768
6,843,153
how to reset streamlit data_editor "edited_rows" dict
<p>I have the following code in streamlit:</p> <pre><code> print(st.session_state[self._key][&quot;edited_rows&quot;]) with grid_container: save_button_click = st.button( label=&quot;**Save**&quot;, key=f&quot;{self._key}_save_button&quot;, ) if not...
<python><streamlit>
2024-10-16 15:28:07
0
5,505
HuLu ViCa
79,094,679
3,225,420
Reading Excel file returns 'Invalid Request' error
<p>My goal is to use Python to read and write to an Excel file in SharePoint that other users will accessing. I developed a solution to a problem on my local machine using <code>Pandas</code> to read and <code>xlWings</code> to write. Now I'm trying to move it to SharePoint for others to use.</p> <p>The solution is a...
<python><azure><microsoft-graph-api>
2024-10-16 15:04:35
1
1,689
Python_Learner
79,094,616
891,919
python error with faiss on GPU with cuda despite successful installation
<p>I'm working on a Google Cloud VM with CUDA 12. I tried to install either <code>faiss-gpu-cu12</code> or <code>faiss-gpu-cu12[fix_cuda]</code> using either a venv or pyenv virtual environment, under python 3.12.4. For the application we also need langchain packages as below:</p> <pre><code>python --version Python 3.1...
<python><gpu><py-langchain><faiss>
2024-10-16 14:49:42
3
1,185
Erwan
79,094,586
2,215,904
Nonblocking child process output read
<p>I can't figure why I can't proper communicate with child process. I have program in C and python. Python need to start C program and then capture output from C in nonblocking way. In the example the C program will output 10 lines per second and will terminate after 5 seconds.</p> <blockquote> <p>The ccode.c compiled...
<python><popen><nonblocking>
2024-10-16 14:43:17
0
460
eSlavko
79,094,532
14,386,187
Python skips recursion if yield is present
<p>I have the following XML file:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;xliff version=&quot;1.2&quot; xmlns=&quot;urn:oasis:names:tc:xliff:document:1.2&quot; xmlns:okp=&quot;okapi-framework:xliff-extensions&quot; xmlns:its=&quot;http://...
<python><xml><yield>
2024-10-16 14:28:52
1
676
monopoly
79,094,259
5,013,752
how to add spark config to DatabricksSession
<p>I used to work with a custom spark object define as follow :</p> <pre class="lang-py prettyprint-override"><code>from pyspark.sql import SparkSession spark_builder = SparkSession.builder.appName(settings.project_name) config = {**self.DEFAULT_CONFIG, **spark_config} for key, value in config.items(): spark_builde...
<python><apache-spark><pyspark><azure-databricks>
2024-10-16 13:23:41
1
15,420
Steven
79,094,198
2,449,857
Attributes on Python flag enums
<p>I was very happy to learn <code>Enum</code> types can effectively carry named attributes:</p> <pre class="lang-py prettyprint-override"><code>from enum import Enum class ActivityType(Enum): NEXT = 0, &quot;N&quot; JOIN = 3, &quot;J&quot; DIVIDE_REAR = 1, &quot;DR&quot; DIVIDE_FRONT = 2, &quot;DF&quo...
<python><python-3.x><enums><flags>
2024-10-16 13:12:29
2
3,489
Jack Deeth
79,093,929
1,814,420
AttributeError: get_motor_collection when setting fetch_links=True
<p>I'm using Beanie with FastAPI. For example, my Beanie models look like this:</p> <pre class="lang-py prettyprint-override"><code>class Project(Document): id: PydanticObjectId = Field(default_factory=PydanticObjectId) items: list[Link[ItemDB]] | None = None class ItemDB(Document): creator: Indexed(str) <...
<python><mongodb><fastapi><beanie>
2024-10-16 12:00:38
1
12,163
Triet Doan
79,093,909
41,284
Error in docker container in qdrant client - ValueError: Unsupported embedding model but the same value is present as a valid model in the description
<p>We are using the qdrant python client and setting the embedding model in the client object.</p> <p>The error received is</p> <pre><code> File &quot;/app/.venv/lib/python3.12/site-packages/qdrant_client/qdrant_fastembed.py&quot;, line 122, in set_model self._get_or_init_model( File &quot;/app/.venv/lib/pytho...
<python><docker><qdrantclient>
2024-10-16 11:53:58
1
1,354
alok
79,093,782
12,890,458
Continue process while waiting in simpy
<p>In simpy I simulate a car driving day and night. As soon as my tank fills below 70% and it is daytime I go to fill up. If my tank gets below 70% at night I just drive on and go fill up as soon as it gets light. I know in advance when it gets light. So I can compute beforehand how many hours (<code>dt_hours</code>) I...
<python><simpy>
2024-10-16 11:14:28
0
460
Frank Tap
79,093,508
4,725,707
Problem selecting a "check-box" with python Selenium: click() launches the link in the HTML code
<p>I am automating with Selenium &amp; python some searches in a website (<a href="https://hemerotecadigital.bne.es/hd/es/advanced" rel="nofollow noreferrer">https://hemerotecadigital.bne.es/hd/es/advanced</a>). Most of it is already done but one specific step I am still doing manually, and for this I'd appreciate your...
<python><selenium-webdriver><checkbox>
2024-10-16 09:57:22
1
538
RiGonz
79,093,281
984,077
Python in Excel: How to install other Anaconda packages
<p>Python in Excel includes some packages in the Anaconda distribution. <a href="https://support.microsoft.com/en-us/office/open-source-libraries-and-python-in-excel-c817c897-41db-40a1-b9f3-d5ffe6d1bf3e" rel="nofollow noreferrer">+info</a>, <a href="https://docs.anaconda.com/anaconda/allpkglists/2024.06-1/" rel="nofoll...
<python><excel><lightgbm><shap>
2024-10-16 09:01:18
1
2,823
FZNB
79,093,236
12,466,687
How to create multiple columns in output on when condition in Polars?
<p>I am trying to <strong>create 2 new columns</strong> in output on checking condition but not sure how to do that.</p> <p><strong>sample df:</strong></p> <pre><code>so_df = pl.DataFrame({&quot;low_limit&quot;: [1, 3, 0], &quot;high_limit&quot;: [3, 4, 2], &quot;value&quot;: [0, 5, 1]}) </code></pre> <pre><code>low_li...
<python><python-polars>
2024-10-16 08:49:28
2
2,357
ViSa
79,093,231
11,233,365
Unable to access public GitHub repo via its API endpoint when submitting request through FastAPI
<p>I am trying to write a FastAPI mirror to return publicly available GitHub repos for download on a local machine that cannot see the wider internet. However, when I poke the endpoint I've written, I receive a &quot;Bad credentials&quot; response from GitHub.</p> <p>Interestingly, when I make the same request via Pyth...
<python><python-requests><fastapi><github-api>
2024-10-16 08:48:48
0
301
TheEponymousProgrammer
79,093,115
2,826,018
Format "04x" produces more than 4 hex digits
<p>I thought <code>f&quot;0x{number:04x}&quot;</code> produces a hex number with four digits. But I recently noticed that this is not the case:</p> <p><code>f&quot;0x{13544123:04x}&quot; = &quot;0xceaabb&quot;</code> which has 6 digits. What am I doing wrong here?</p>
<python><number-formatting>
2024-10-16 08:25:14
1
1,724
binaryBigInt
79,093,102
3,956,017
Why do I need a empty window.attributes() to create a transparent window using tkinter (in python)?
<p>When I create a transparent window with <code>tkinter</code> in python I need to start with a empty <code>window.attributes()</code> call.<br>Otherwise it doesn't become transparent. Is this a bug or wanted behavior ?</p> <p>Example code:</p> <pre><code>#!/usr/bin/env python3 import tkinter as tk window = tk.Tk() wi...
<python><tkinter><tk-toolkit>
2024-10-16 08:23:31
1
1,530
Garo
79,093,078
662,642
python problem with chained stdin to stdout
<p>I want to have several python scripts to modify text files. For example, 'do1' accepts input from either stdin or a file, and sends output to either stdout or a file:</p> <pre><code>#!/usr/bin/env python3 import sys import select fi = sys.stdin if select.select([ sys.stdin, ], [], [], 0.0 )[ 0 ] else None ofname ...
<python><pipe>
2024-10-16 08:18:36
3
516
PatB
79,093,014
1,581,090
Moviepy is unable to load video
<p>Using python 3.11.10 and moviepy 1.0.3 on ubuntu 24.04.1 (in a VirtualBox 7.1.3 on windows 10) I have problems to load a video clip. The test code is just</p> <pre><code>from moviepy.editor import VideoFileClip clip = VideoFileClip(&quot;testvideo.ts&quot;) </code></pre> <p>but the error is</p> <pre><code>Traceback ...
<python><ffmpeg><virtualbox><moviepy><ubuntu-24.04>
2024-10-16 07:59:28
2
45,023
Alex
79,092,651
7,580,944
3D cylindrical polar plot in python (beamforming per different frequencies)
<p>Is it possible to make this figure in Matplotlib or any other libraries in Python?</p> <p>The top figure can be easily achieved with <code>plt.polar</code> in mattplo, but how about the bottom one? Would Tikz be more appropriate?</p> <p><a href="https://i.sstatic.net/65pzYPVB.png" rel="nofollow noreferrer"><img src=...
<python><matplotlib><plot><polar-coordinates>
2024-10-16 06:03:28
0
359
Chutlhu
79,092,547
4,451,521
How to call one poetry environment from a different poetry environment
<p>I have two different folders or locations. Let's call these &quot;app&quot; and &quot;source&quot;. In the source folder there is a script.</p> <h1>The Previous situation</h1> <p>Before each folder had its own virtual environment (created with venv)</p> <p>The app folder had a RestAPI script (written with FastAPI) t...
<python><subprocess><python-poetry>
2024-10-16 05:13:51
1
10,576
KansaiRobot
79,092,542
5,057,078
Django change on_delete at runtime
<h1>Story</h1> <p>I am making a <a href="https://github.com/Brambor/Jurnal" rel="nofollow noreferrer">Jurnal app</a>. Currently working on synchronization across multiple machines. I want to synchronize model by model, not the whole database at once. I even allow synchronization of just a few entries, image: <a href="h...
<python><django><database><sqlite>
2024-10-16 05:10:15
1
696
Brambor
79,092,103
2,778,405
Shift by month shifts to wrong date
<p>Can someone explain this result to me?</p> <pre class="lang-py prettyprint-override"><code>d = [ {'Date Enrolled': pd.Timestamp('2013-11-30'), 'metric': 2}, {'Date Enrolled': pd.Timestamp('2013-12-01'), 'metric': 0}, {'Date Enrolled': pd.Timestamp('2013-12-02'), 'metric': 0}, {'Date Enrolled': pd.Timestamp('...
<python><pandas>
2024-10-16 00:21:53
1
2,386
Jamie Marshall
79,092,005
4,003,134
Gradio 5.0.2 Image: how to dispatch the start_recording event
<p>On my <strong>WSL</strong> with <strong>Ubuntu 22.04</strong> and <strong>Python 3.10</strong> and <strong>Node 20.10</strong>, I would like to receive the <strong>&quot;start_recording&quot;</strong> event from <em>gr.Image</em>, running in <em>&quot;webcam&quot;</em> mode. Since the event is dispatched in the <em>...
<python><gradio>
2024-10-15 23:13:14
1
1,029
x y
79,091,886
1,783,688
How to update JSON columns in FastAPI
<p>I am trying to set the value for a key in a json stored on a column in the database (MySql).</p> <p>Sample Code:</p> <pre><code>import json from sqlmodel import Field, JSON from fastapi.middleware.cors import CORSMiddleware from settings import settings from typing import Annotated from sqlmodel import Session, crea...
<python><fastapi><sqlmodel>
2024-10-15 22:06:56
1
1,039
otaku
79,091,722
10,012,446
Unable to install `evals` python cli for OpenAI
<p>Failing to install: <code>pip install evals</code>. For complete logs please see <a href="https://gist.github.com/sahilrajput03/e86baa88d35e5f5c0f63946671edbb77" rel="nofollow noreferrer">this gist file here</a>.</p> <p>Tools Version:</p> <ol> <li><code>python --version</code>: <code>Python 3.9.6</code></li> <li><co...
<python><python-3.x><pip><openai-api>
2024-10-15 20:54:40
2
414
Sahil Rajput
79,091,689
7,473,954
HTTP certificate file authentication works fine with curl, with openssl, but not with Python module "requests"
<p>I'm trying to make a post via &quot;requests&quot; in python, on a url where client certificate authentication is mandatory. Certificates are production ones (not self signed)</p> <p>Script is simple :</p> <pre><code>import requests print(requests.post('https://my_url.com', cert=('client.pem', 'key.pem'),data='&lt;...
<python><curl><python-requests><openssl>
2024-10-15 20:44:00
1
528
Julien
79,091,636
8,849,755
How to install this package with `pip -e`?
<p>I want to install <a href="https://github.com/thliebig/CSXCAD" rel="nofollow noreferrer">this package</a>, which is part of <a href="https://github.com/thliebig/openEMS-Project" rel="nofollow noreferrer">the openEMS project</a>, in &quot;development mode&quot; so that I can change the code and see what happens. I ha...
<python><pip>
2024-10-15 20:24:34
1
3,245
user171780
79,091,627
1,732,969
How to detect 2d datamatrix in image with Python
<p>I have a set of medical forms that may or may not contain a 2d datamatrix into a corner of the page. I need to detect if the 2d datamatrix is present or not. For now, it's not necessary to read the content of the barcode. I've been looking for different libraries but I can't find one with OCR or something that may d...
<python><amazon-web-services><ocr><barcode><datamatrix>
2024-10-15 20:19:27
2
1,593
eduardosufan
79,091,469
1,747,834
How to convert Java serialization data into JSON?
<p>A vendor-provided application we're maintaining stores (some of) its configuration in the form of &quot;<em>Java serialization data, version 5</em>&quot;. A closer examination shows, that the actual contents is a <code>java.util.ArrayList</code> with several dozens of elements of the same vendor-specific type (<code...
<python><java><serialization><deserialization>
2024-10-15 19:25:55
1
4,246
Mikhail T.
79,091,467
19,048,408
In Polars >=v1, what is the correct way to check if a datatype meets a selector criteria?
<p>Prior to v1, this was the prefered way to check if a Polars datatype (e.g., looked up from a schema dict) is numeric:</p> <pre class="lang-py prettyprint-override"><code>import polars as pl assert pl.UInt8 in pl.selectors.NUMERIC_DTYPES assert pl.UInt8 not in pl.selectors.TEMPORAL_DTYPES </code></pre> <p>However, a...
<python><python-polars>
2024-10-15 19:25:32
2
468
HumpbackWhale194
79,091,455
2,778,405
shift by frequency groups by date?
<p>I'm trying to create a simple data cube, of one metric by many different time freqencies. Example:</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd import numpy as np r = [{'Date Enrolled': pd.Timestamp('2022-04-13 00:00:00'), 'metric': 1, 'weekly_cumsum': 1, 'monthly_cumsum': 1, 'yearly_...
<python><pandas>
2024-10-15 19:23:04
1
2,386
Jamie Marshall
79,091,430
13,058,538
Request with proxy can't reach FastAPI webserver
<p>I want to test my HTTP downloaders in GitLab CI/CD. So I chose FastAPI as the web server to which downloaders will be tested.</p> <p>Currently, I am trying to make it work locally, but the request always fails with the 503 status code when I am using proxies (that I must use for testing). Without proxies I get 200 s...
<python><docker-compose><fastapi><aiohttp>
2024-10-15 19:14:01
0
523
Dave
79,091,213
2,772,805
Detach tabs with PyQt5 - keeping all widgets into the detached tabs
<p>With a PyQt application, I wanted to deliver detachable tabs where user can by a double click detach a tab and reattach it to the main window by closing the detached tab.</p> <p>I have minimize the problem to the following script that almost works except that when I have multiple QWidgets in the layout, only 1 on 2 ...
<python><pyqt5>
2024-10-15 18:05:19
1
429
PBrockmann
79,091,168
3,252,285
How to apply a threshold filter to a layer?
<p>Having an array like this :</p> <pre><code>input = np.array([[0.04, -0.8, -1.2, 1.3, 0.85, 0.09, -0.08, 0.2]]) </code></pre> <p>I want to change all the values (of the last dimension) between -0.1 and 0.1 to zero and change the rest to 1</p> <pre><code>filtred = [[0, 1, 1, 1, 1, 0, 0, 1]] </code></pre> <p>Using the ...
<python><numpy><keras>
2024-10-15 17:49:49
1
4,864
Nassim MOUALEK
79,090,997
3,070,181
How can I run a tkinter application to allow pyautogui locateOnScreen function to process?
<p>The frame appears at the top of the screen, but although I am using <em>update_idletasks()</em>, the buttons do not appear before the <em>locateOnScreen</em> function is called</p> <p>If I include <em>update()</em>, then the buttons do appear. However, the <em>_locate_button</em> call in <em>main</em> does not find ...
<python><tkinter><pyautogui>
2024-10-15 16:57:54
0
3,841
Psionman
79,090,953
8,284,452
How to debug segfault and mod_wsgi conda/mamba environments?
<p>I have tried in vain to get core dumping and gdb to work, but cannot seem to get a core to dump or gdb to find the symbols it needs. So here's the gist of everything happening.</p> <p>I have installed miniforge3. I have done <code>mamba install mod_wsgi</code> in the base environment to install mod_wsgi 5.0.0. I hav...
<python><apache><flask><mod-wsgi>
2024-10-15 16:42:40
1
686
MKF
79,090,875
6,510,273
I need to acsess data in an XML via looping over the elements
<p>I have a xml file and need to accsess a specific part.</p> <p>I get close to it with:</p> <pre><code>from lxml import objectify path = xml_path xml = objectify.parse(open(path)) root = xml.getroot() # Access the list of 'Evt' elements in 'History' events = root.getchildren()[1].History.getchildren() </code></pre>...
<python><xml><dataframe><schema>
2024-10-15 16:23:33
2
2,177
Florida Man
79,090,640
14,839,602
How can I segment the handwritten lines in this type of documents?
<p>This is the document page. I want to segment the 10 handwritten lines perfectly and then crop it to save it to train my model.</p> <p>What methods can I use??</p> <p>I don't want to make my own model to segment those lines. I am looking a another straightforward method.</p> <p><a href="https://i.sstatic.net/lQkrHG19...
<python><opencv><computer-vision><image-segmentation>
2024-10-15 15:20:52
2
434
Hama Sabah
79,089,938
9,707,473
Can you set permission classes per function in class-based views?
<p>Let's say we have the following <em>class-based</em> view (CBV) implementing DRF's <code>APIView</code>:</p> <pre><code>class ExampleListAPIView(APIView): permission_classes = [IsAuthenticatedOrReadOnly] def get(self, request): ''' List all examples ''' examples = Example.obj...
<python><django><django-rest-framework><permissions>
2024-10-15 12:29:25
2
512
lezaf
79,089,298
9,081,267
Azure Communication Services python, how do I send a Whatsapp message with parameters
<p>In the Meta Whatsapp Business portal you can define message templates which include parameters, for example a users name or multiple parameters.</p> <p>Example: <code>&quot;You made a purchase for {{1}} using a credit card ending in {{2}}.&quot;</code></p> <p>I want to send a whatsapp message template which includes...
<python><azure><whatsapp><azure-communication-services>
2024-10-15 09:21:32
1
43,326
Erfan
79,089,047
534,238
Writing protobufs to BigQuery using Apache Beam (Dataflow) using Python
<p>As the title says, I am trying to write a protocol buffer message to a BigQuery table, in Python.</p> <p>Is there an equivalent to <a href="https://beam.apache.org/releases/javadoc/2.50.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.html#writeProtos-java.lang.Class-" rel="nofollow noreferrer">Java's <code>writePro...
<python><google-bigquery><apache-beam><apache-beam-io>
2024-10-15 08:23:39
0
3,558
Mike Williamson
79,088,973
12,466,687
Unable to install pdftotext on windows/Ubuntu
<p>From weeks I have been trying to <strong>install</strong> <code>pdftotext</code> for <code>python</code> but have faced challenges &amp; failed due to poppler earlier.</p> <p>So recently I have:</p> <ol> <li><strong>Upgraded</strong> <code>Windows 10</code> to <code>Windows 11</code> to enable <code>Sudo</code> &amp...
<python><windows><ubuntu><pdftotext><poppler>
2024-10-15 08:09:56
1
2,357
ViSa
79,088,876
881,712
How to send OSC bundle using python-osc?
<p>On the repository page of <a href="https://github.com/attwad/python-osc" rel="nofollow noreferrer">python-osc</a> I read:</p> <p><strong>Building bundles</strong></p> <pre><code>from pythonosc import osc_bundle_builder from pythonosc import osc_message_builder bundle = osc_bundle_builder.OscBundleBuilder( osc_b...
<python><osc>
2024-10-15 07:43:47
1
5,355
Mark
79,088,863
9,363,181
Superset Invalid Login Issue while Implementing SSO
<p>I am having a superset running in AWS EC2 instance using docker compose. While I am doing docker compose up the server gets up and I can see server running. Additionally I have configured an SSO for Microsoft for the superset to login.</p> <p>So the flow will be A user comes to login page of superset enter its Micro...
<python><docker><single-sign-on><apache-superset>
2024-10-15 07:41:26
1
645
RushHour
79,088,765
6,721,603
How to find dropdown name in HTML code for Selenium's Select class?
<p>I want to download the CSV data shown at the end of the page using Python:</p> <p><a href="https://www.cboe.com/delayed_quotes/spx/quote_table/" rel="nofollow noreferrer">https://www.cboe.com/delayed_quotes/spx/quote_table/</a></p> <p>Specifically, before downloading the data, I need Python to select the dropdowns <...
<python><csv><selenium-webdriver>
2024-10-15 07:04:48
1
1,010
freddy888
79,088,388
14,154,784
Configuring Django Testing in PyCharm
<p>I have a simple django project that I'm making in pycharm. The directory structure is the following:</p> <pre><code>zelda_botw_cooking_simulator |-- cooking_simulator_project |---- manage.py |---- botw_cooking_simulator # django app |------ init.py |------ logic.py |------ tests.py |------ all_ingredients.py |----...
<python><django><pycharm><django-testing><django-tests>
2024-10-15 04:21:39
2
2,725
BLimitless
79,088,085
807,797
Running Python 3.12 asyncio tasks in parallel
<p>What specifically needs to change in the Python 3.12 code below in order for each and every one of the calls to the <code>write_to_file(linesBuffer)</code> function to run in parallel instead of running sequentially?</p> <p>In other words,</p> <ol> <li>We want for the program execution to continue without waiting fo...
<python><python-3.x><asynchronous><python-asyncio>
2024-10-15 00:53:56
1
9,239
CodeMed
79,088,004
6,618,225
Count number of rows in grouped column in Pandas
<p>I have a simple dataset and I am trying to group a column by its values and create a new column that contains how many rows are returned for that group.</p> <p>I have tried several options but nothing seems to work.</p> <p>A simple (not working) example could be like this:</p> <pre><code>import pandas as pd data = {...
<python><pandas><group-by>
2024-10-14 23:45:46
0
357
Kai
79,087,880
1,235,269
What's the idiomatic way to waste the output of a generator in Python?
<p>Sometimes I need to consume everything that a generator outputs but don't actually need the output. In one case, some callers need progress updates from a coroutine, but some callers don't; in another case, some callers need to iterate through the results but some callers only need the side effects.</p> <p>What's th...
<python><iterator><coroutine>
2024-10-14 22:27:58
1
2,604
zmccord
79,087,767
258,418
Use typealias defined inside generic class in method signature
<p>Given a generic class, one might have multiple methods which use a deduced type in their signature. To avoid repetition I would like to define a typealias. What is the best way to access it in a method signature?</p> <pre><code>class Y[X]: type Z = list[X] # this one works def works_with_pyright_but_ugl...
<python><python-typing><pyright>
2024-10-14 21:30:52
1
5,003
ted
79,087,732
10,859,585
Google Drive PDF File - FileNotDownloadable and FileNotExportable
<p>Having issues with using Google Drive API to either export or download a pdf. I've tried using both <code>export_media()</code> and <code>get_media()</code>. Both error out with a message about trying it's opposite's self. The error occurs in each function right after <code>.next_chunk()</code>.</p> <p>I've used the...
<python><google-drive-api>
2024-10-14 21:09:03
0
414
Binx
79,087,707
6,843,153
Get row index of a pandas row knowing the row number
<p>I have a Pandas dataframe that is the result of filtering over another dataframe, so the index of rows are not sequential since only some of the rows of the base dataframe are kept in the resulting dataframe.</p> <p>I want to know the index of a given row position of the resulting dataframe. Let's say we want the in...
<python><pandas>
2024-10-14 20:54:45
1
5,505
HuLu ViCa
79,087,652
1,492,337
Adding accuracy, recall and f1 metrics to SFTTrainer
<p>I'm working on fine tuning an LLM using <code>SFTTrainer</code>.</p> <p>For some reason, during validation phase it only yields the <code>eval_loss</code>. While this is nice, I actually interested also on other metrics (accuracy for example), but I wasn't able to figure out yet how to do it.</p> <p>I've seen many e...
<python><huggingface-transformers><large-language-model><fine-tuning>
2024-10-14 20:37:50
0
433
Ben
79,087,599
10,714,273
Azure OpenAI Embedding Skill - Cannot iterate over non-array '/document/contentVector'
<p>The following code runs successfully but the indexer execution history shows the warning:</p> <pre><code>Cannot iterate over non-array '/document/contentVector'. Could not map output field 'contentVector' to search index. Check the 'outputFieldMappings' property of your indexer. </code></pre> <p>Based on the split s...
<python><azure><azure-openai>
2024-10-14 20:12:04
1
359
cap
79,087,531
26,843,912
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' on Mac
<p>I was developing my fastapi project in my windows PC and everything was working fine there, but I recently got a new macbook and installed the lastest python 3.13 version and everything is just giving error</p> <p>When I try to run my fastapi server, its giving this error :-</p> <pre><code>(venv) venvlisa@Lisas-MacB...
<python><python-3.x><django><fastapi>
2024-10-14 19:44:44
2
323
Zaid
79,087,362
6,141,238
Why does Scalene produce no results or partial results on my Windows 10 PC?
<p>I just installed Scalene 1.5.45 and have Python 3.12.0 and VS Code 1.94.2 already installed. I am running Windows 10 on a Dell laptop.</p> <p>I am using the test script below introduced at about 24:30 in <a href="https://www.youtube.com/watch?v=Uq60vknROcM" rel="nofollow noreferrer">this</a> video and have saved it...
<python><windows><profiling><line-by-line><scalene>
2024-10-14 18:47:52
0
427
SapereAude
79,087,296
999,881
Importing Python modules from different directories
<p>I have the following folder setup</p> <pre><code>user_test.py factories/ user_factory.py pb/ user_pb2.py user_pb2_grpc.py </code></pre> <p>This is how the imports are in each of the files</p> <pre><code>user_test.py import factories.user_factory factories/user_factory.py import pb.user_pb2_grpc ...
<python><grpc>
2024-10-14 18:20:17
1
441
dg428
79,087,092
3,949,008
All source traveling sales person
<p>I have a &quot;small-scale&quot; TSP problem where exact solution can be trivially computed as follows. I am trying to get this to work by spitting out &quot;all source&quot; TSP paths. I don't have to start at a fixed node. I can start any where, and want to know all possible optimal paths from each vertex. How can...
<python><traveling-salesman>
2024-10-14 17:13:15
1
10,535
Gopala
79,086,960
10,014,361
undefined error not raising NameError and program runs fine
<p>Why is my code here not raising a NameError or Syntax error when I clearly am using non existing error name?</p> <pre class="lang-py prettyprint-override"><code>def fun(x): assert x &gt;= 0 return x ** 0.5 def mid_level(x): try: fun(x) except ButtError: print(333) raise ...
<python><python-3.x><exception>
2024-10-14 16:31:07
2
2,479
Aven Desta
79,086,936
162,758
How do I log the queries used by Feast for point in time joins
<p>I have a Feast feature store setup with a Snowflake offline store, Snowflake registry and a DynamoDB online store. I am playing around with some feature store retrieval scenarios and would like to understand the queries Feast is using to retrieve historical data. How can I log or print these queries?</p>
<python><snowflake-cloud-data-platform><feast>
2024-10-14 16:18:22
1
2,344
VDev
79,086,873
12,011,020
Pandas / Polars: Write list of JSONs to Database fails with `ndarray is not json serializable`
<p>I have multiple json columns which I concat to an array of json columns. The DataFarme looks like this</p> <pre><code>β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ json_concat β”‚ β”‚ --- β”‚ β”‚ list[str] β”‚ β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•‘ β”‚ [&quot;{&quot;int...
<python><json><pandas><sqlalchemy><python-polars>
2024-10-14 15:57:22
1
491
SysRIP
79,086,849
2,532,408
python collation sort "shift-trimmed"
<p>How would I make this test pass?</p> <pre class="lang-py prettyprint-override"><code>names = [ &quot;cote&quot;, &quot;cotΓ©&quot;, &quot;cΓ΄te&quot;, &quot;cΓ΄tΓ©&quot;, &quot;ReasonE&quot;, &quot;Reason1&quot;, &quot;ReasonΔ”&quot;, &quot;Reason Super&quot;, &quot;ReasonΓ…&quot;, ...
<python><sorting><collation><icu>
2024-10-14 15:50:13
0
4,628
Marcel Wilson
79,086,695
7,504,750
List containers/folders/subfolders in Azure DataLake in Python
<p>I have a python code snippet to connect to Azure. The functions are to connect, get the containers, and get the blobs of the container.</p> <p>The <code>get_containers()</code> can already list the up to the first folder, problem is I cannot get the subfolders.</p> <p>The directory structure in Azure looks something...
<python><azure-blob-storage>
2024-10-14 15:05:16
1
451
Ricky Aguilar
79,086,623
1,554,020
Can asyncio.shield be correctly called with a coroutine argument?
<p><a href="https://docs.python.org/3/library/asyncio-task.html#shielding-from-cancellation" rel="nofollow noreferrer"><code>asyncio.shield</code> docs</a> say:</p> <blockquote> <p>If <code>aw</code> is a coroutine it is automatically scheduled as a <code>Task</code>.</p> </blockquote> <p>and</p> <blockquote> <p>Import...
<python><garbage-collection><python-asyncio>
2024-10-14 14:42:04
0
14,259
yuri kilochek
79,086,262
18,618,577
Panda read_csv, ignore line that contain specific string
<p>I've a dataframe that list datalogger name and there password. The password is generated inside my script if the datalogger have a blank in the password field. And if there is not a generic password, then I put the specific password in this field for this datalogger. Third case, for some of datalogger, I set a speci...
<python><pandas><read-csv>
2024-10-14 13:01:03
1
305
BenjiBoy
79,086,247
7,086,023
Segmentation fault after printing function output, works line-by-line
<p>I'm working on a chemical clustering script in Python using the following packages:</p> <ul> <li><p><code>pubchempy</code> for fetching SMILES of chemical compounds</p> </li> <li><p><code>rdkit</code> for generating fingerprints and computing Tanimoto similarity</p> </li> </ul> <pre><code>import numpy as np import p...
<python><pandas><numpy>
2024-10-14 12:57:10
0
373
lizaveta
79,086,014
12,011,020
concat_list with NULL values, or how to fill NULL in pl.List[str]
<p>I want to concat three list columns in a <code>pl.LazyFrame</code>. However the Lists often contain NULL values. Resulting in NULL for <code>pl.concat_list</code></p> <h2>MRE</h2> <pre class="lang-py prettyprint-override"><code>import polars as pl # Create the data with some NULLs data = { &quot;a&quot;: [[&quo...
<python><dataframe><list><python-polars>
2024-10-14 11:38:03
1
491
SysRIP
79,085,836
1,254,515
how to parallelize data extraction from netcdf to files in python
<p>I have data from a netCDF source (<a href="https://cds.climate.copernicus.eu/datasets/reanalysis-era5-pressure-levels?tab=overview" rel="nofollow noreferrer">ECMWF ERA5</a>) which I read using xarray. It has four dimensions (say x, y, z and t) and three variables (say r, h and g). I have to write it to plain text fi...
<python><parallel-processing><concurrent.futures>
2024-10-14 10:45:58
1
323
Oliver Henriot
79,085,795
15,456,681
Batched matrix multiplication with JAX on GPU faster with larger matrices
<p>I'm trying to perform batched matrix multiplication with JAX on GPU, and noticed that it is ~3x faster to multiply shapes (1000, 1000, 3, 35) @ (1000, 1000, 35, 1) than it is to multiply (1000, 1000, 3, 25) @ (1000, 1000, 25, 1) with f64 and ~5x with f32.</p> <p>What explains this difference, considering that on cpu...
<python><numpy><jax><cupy>
2024-10-14 10:34:46
1
3,592
Nin17
79,085,768
3,960,991
How to Access the Attributes in an iFrame in Python
<p>I'm learning web scraping for data analysis.</p> <p>I have successfully retreived several elements of interest on this page such as Title, Date, Upvotes etc. <a href="https://old.reddit.com/r/JoeRogan/comments/cmxmtc/jre_1330_bernie_sanders/" rel="nofollow noreferrer">https://old.reddit.com/r/JoeRogan/comments/cmxmt...
<python><html><selenium-webdriver><web-scraping><iframe>
2024-10-14 10:28:35
1
368
AndrΓ© Foote
79,085,760
10,425,150
Second .connect with paramiko (ssh)
<p>Form the main Linux OS (connected, working) I would like to run another &quot;.connect&quot;.</p> <p>Here is the code:</p> <pre><code>import paramiko hostname = &quot;hostaname&quot; ip = &quot;1111.111.11.11&quot; username = &quot;user&quot; password = &quot;pass&quot; ssh = paramiko.SSHClient() ssh....
<python><ssh><paramiko>
2024-10-14 10:26:36
1
1,051
GΠΎΠΎd_MΠ°n
79,085,604
12,011,020
Using is_in with a Polars LazyFrame causing TypeError
<p>I am getting the following TypeError</p> <pre><code>Traceback (most recent call last): File &quot;/my/path/my_project/src/my_project/exploration/mre_lazyframe_error.py&quot;, line 39, in &lt;module&gt; current.with_columns(pl.col(&quot;foo_bar&quot;).is_in(reference[&quot;foo_bar&quot;])) File &quot;/my/path...
<python><dataframe><python-polars>
2024-10-14 09:41:01
1
491
SysRIP
79,085,207
3,303,266
oci: How to use REST sdk call to create instance with GPU shape setting gpus
<p>I can do the below command in CLI and</p> <pre><code>oci compute instance launch -c ocid1.compartment.AK00684129.broom15.xri7sc0a2upguqn5cn8ajnwi9664jtbc9cd7vib6x974ghk1dfg757hxpme5 --availability-domain AD-1 --shape VM.C3.GPU.L40S.Flex --shape-config '{&quot;gpus&quot;: 1,&quot;ocpus&quot;:4,&quot;memoryInGBs&quot;...
<python><oracle-cloud-infrastructure>
2024-10-14 07:52:26
1
371
user3303266
79,085,124
5,134,817
Extract a class from a static method
<p>Given a function which is a <code>staticmethod</code> of a class, is there a way to extract the parent class object from this?</p> <pre class="lang-py prettyprint-override"><code>class A: @staticmethod def b(): ... ... f = A.b ... assert get_parent_object_from(f) is A </code></pre> <p>I can see this buried i...
<python><static-methods>
2024-10-14 07:30:03
1
1,987
oliversm
79,085,070
7,227,146
Interrupting the kernel 'Python 3.12.7' timed out. Do you want to restart the kernel instead? All variables will be lost
<p>This might be a nooby question so bear with me.</p> <p>Sometimes when I execute Python Jupyter Notebook cells on VSCode, they take too long and I want to terminate the execution so I click on the top-left corner of the cell, where there's a square and you hover over it and it says &quot;stop cell execution&quot;.</p...
<python><jupyter-notebook>
2024-10-14 07:15:29
0
679
zest16
79,084,987
1,496,362
Blockchain API only gives me data for every 4 days
<p>Trying to download daily bitcoin miner fees using the blockchain.com API. However, even though the graph on the website (<a href="https://www.blockchain.com/explorer/charts/transaction-fees" rel="nofollow noreferrer">https://www.blockchain.com/explorer/charts/transaction-fees</a>) shows daily data, the API only give...
<python><blockchain>
2024-10-14 06:45:02
1
5,417
dorien