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,157,061 | 123,594 | python3 venv - how to sync ansible_python_interpreter for playbooks that mix connection:local and target system | <p>I'm running ansible playbooks in python venv</p>
<p>My playbooks often involve a mix of cloud infrastructure (AWS) and system engineering. I have configured them to run cloud infrastructure tasks with connection: local - this is to minimize access rights required on the target system.</p>
<p>However since using venv... | <python><python-3.x><ansible><python-venv> | 2024-11-04 21:33:03 | 2 | 2,524 | jdog |
79,156,971 | 1,319,998 | SciPy sparse matrix csr_matrix and csc_matrix functions - how much intermediate memory do they use? | <p>For the scipy functions csr_matrix, and csc_matrix, and specifically the forms that take the row and column indices:</p>
<pre class="lang-py prettyprint-override"><code>csr_matrix((data, (row_ind, col_ind)), [shape=(M, N)])
csc_matrix((data, (row_ind, col_ind)), [shape=(M, N)])
</code></pre>
<p>How much intermediate... | <python><scipy><sparse-matrix> | 2024-11-04 20:51:39 | 1 | 27,302 | Michal Charemza |
79,156,913 | 2,927,719 | PySpark can't find existing file in Blob storage | <p>I want to open Excel files in Azure Databricks that reside in ADSL2 with this code:</p>
<pre><code>#%pip install openpyxl pandas
import pandas as pd
display(dbutils.fs.ls("/mnt/myMnt"))
path = "/mnt/myMnt/20241007112914_Statistik_789760_0000_327086871111430.xlsx"
df_xl = pd.read_excel(path, engin... | <python><databricks><azure-databricks><pyspark-pandas> | 2024-11-04 20:29:16 | 1 | 341 | Prefect73 |
79,156,739 | 6,145,729 | Python Pandas to read_excel but provide NULL where columns expected but not found | <p>I'm using Python 3 with pandas.</p>
<p>Is there a way to read_excel but provide NULL where columns expected are not found?</p>
<p>For example, I'm looping through many workbooks, but sadly, not all the sheets do not have the column 'SEQ ID'. So I'm getting the below error:-</p>
<p><strong>ValueError: Usecols do not ... | <python><pandas> | 2024-11-04 19:26:49 | 1 | 575 | Lee Murray |
79,156,737 | 407,528 | Specifying a Conditional (Switch) field in Python Construct that depends on a look-ahead value | <p>I'm building a parser for a (slightly bizzare) format that defines the tag of a data field <em>after</em> the value record. It is guaranteed that the value field would always be 4 bytes interpreted depending on the tag.</p>
<p>This code works (but is cumbersome to use, and requires manually switching to the correct ... | <python><parsing><construct> | 2024-11-04 19:26:17 | 0 | 6,545 | qdot |
79,156,682 | 2,168,548 | Association abort does not close TCP connection | <p>Using pydicom store SCP. The after sending the files, PACS does not release the association. Hence the association is aborted due to timeout</p>
<pre><code>E: Network timeout reached
I: Aborting Association
</code></pre>
<p>And then I ran <strong>ss -ant</strong> command , and I see the TCP connection is in <strong>... | <python><pydicom><pynetdicom> | 2024-11-04 19:03:49 | 0 | 359 | ShoibAhamed |
79,156,664 | 4,046,947 | Optimize memory use of Python function | <p><strong>Updated</strong></p>
<p>I have the following function, which is used in a spatial statistical model. I'm able to run the model on a subset of my data (1 US state) using a few GB of RAM, but it runs out of memory when I extend it to the full US.</p>
<p>I've made multiple adjustments from the original function... | <python><optimization><memory> | 2024-11-04 18:57:14 | 0 | 655 | Jason Hawkins |
79,156,347 | 1,080,014 | Generate array of positive integers that sum of to k | <p>My task is simple: I want to generate an (ideally numpy) array containing all combinations of m positive (>=0), but bounded (<= e) integers that sum exactly to k. Note that k and m might be relatively high, so generating all combinations and filtering will not work.</p>
<p>I have implemented it in plain, recur... | <python><numpy><pytorch> | 2024-11-04 16:54:55 | 4 | 1,396 | Leander |
79,156,239 | 17,487,457 | How do I turn-off this horizontal line in the FFT plot | <p>I am trying to show the trend in observation data and the corresponding <code>fft</code> . A horizontal line keeps appearing in the <code>fft</code>, part that I do not need to show in the chart.</p>
<p>I give a MWE (pseudo data) below.</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
from scip... | <python><numpy><matplotlib><fft> | 2024-11-04 16:24:05 | 1 | 305 | Amina Umar |
79,156,198 | 214,296 | How to overcome Python3 installation Fatal Python error: init_fs_encoding | <p>While attempting to troubleshoot an issue on my Ubuntu for Windows installation I uninstalled all the python instances. The issue has been resolved, but now I'm unable to get python3 reinstalled.</p>
<pre class="lang-bash prettyprint-override"><code>$ sudo apt install python3
Reading package lists... Done
Building ... | <python><python-3.x><ubuntu><installation><windows-subsystem-for-linux> | 2024-11-04 16:10:19 | 0 | 14,392 | Jim Fell |
79,156,083 | 12,424,131 | Is there an elegant way to subclass a Python list which keeps its subclass when adding and slicing, etc | <p>I want to extend the functionality of a standard list, subclassing seems like the obvious way. Actually, I'm using this to store a mathematical expression in Reverse Polish Notation (RPN) for a genetic programming project.</p>
<pre><code>class RPN(list):
def evaluate(self, vars):
# evaluate the RPN expre... | <python><python-3.x><subclass> | 2024-11-04 15:35:32 | 2 | 466 | Steven Dickinson |
79,155,921 | 1,883,304 | Wagtail CMS - Programmatically enabling user access to manage Pages within the Admin panel | <h2>Context</h2>
<p>Wagtail CMS has a <a href="https://docs.wagtail.org/en/stable/topics/permissions.html" rel="nofollow noreferrer">permission system</a> that builds on that of Django's. However, customizing it for users that are <em>neither</em> an admin nor using the pre-made groups <code>Moderator</code> or <code>E... | <python><wagtail><wagtail-admin> | 2024-11-04 14:53:52 | 2 | 3,728 | Micrified |
79,155,737 | 16,611,809 | Join differently nested lists in polars columns | <p>As you might have recognized from my other questions I am transitioning from pandas to polars right now. I have a polars df with differently nested lists like this:</p>
<pre><code>ββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββ¬βββββββ
β col1 ... | <python><python-polars> | 2024-11-04 14:01:34 | 2 | 627 | gernophil |
79,155,604 | 1,564,070 | Can't set value of input element using Selenium | <p>I'm trying to update the value of an input element using python and selenium webdriver. This is on Windows 10 using Edge. The page loads normally, and I can interact with the element using keyboard & mouse, but when I try to set the value using code I get the "element not interactable" error. Code:<... | <python><selenium-webdriver> | 2024-11-04 13:19:53 | 1 | 401 | WV_Mapper |
79,155,290 | 1,221,812 | Dutch sentiment analysis RobBERTje outputs just positive/negative labels, netural label is missing | <p>When I run Dutch sentiment analysis RobBERTje, it outputs just positive/negative labels, netural label is missing in the data.</p>
<p><a href="https://huggingface.co/DTAI-KULeuven/robbert-v2-dutch-sentiment" rel="nofollow noreferrer">https://huggingface.co/DTAI-KULeuven/robbert-v2-dutch-sentiment</a></p>
<p>There ar... | <python><nlp><bert-language-model><roberta-language-model> | 2024-11-04 11:36:35 | 1 | 473 | pjercic |
79,155,283 | 1,609,514 | Unusual Memory Error when plotting line on secondary y axis using Pandas/Matplotlib | <p>I'm getting the following memory error when adding a line to the secondary axis:</p>
<pre class="lang-none prettyprint-override"><code>MemoryError: Unable to allocate 48.2 GiB for an array with shape (1726364447,) and data type [('val', '<i8'), ('maj', '?'), ('min', '?'), ('fmt', 'S20')]
</code></pre>
<p>The erro... | <python><pandas><matplotlib><plot> | 2024-11-04 11:34:45 | 1 | 11,755 | Bill |
79,154,874 | 5,816,253 | combine different shapefile feature classes based on their names and geometry | <p>I have a shapefile which contains various feature classes I'm able to read</p>
<p>I improved my code thanks to the suggestions of @Pieter</p>
<pre><code>import geopandas as gpd
from shapely import box
from shapely.geometry.polygon import Polygon
from shapely.geometry.multipolygon import MultiPolygon
shapefile = &qu... | <python><geopandas><shapefile> | 2024-11-04 09:28:43 | 1 | 375 | sylar_80 |
79,154,737 | 11,696,358 | insert new line into duckdb table with a map column from python dict | <p>I have a duckdb table with a MAP(INT, MAP(TEXT, TEXT)) column.</p>
<p>I have a python dict with the same structure.</p>
<p>I want to insert a new line into the duckdb table putting the python dict as value of the map column.</p>
<p>How can it be done?</p>
<p>I expect something like</p>
<pre><code>my_dict = {0: {'tes... | <python><duckdb> | 2024-11-04 08:41:01 | 1 | 478 | user11696358 |
79,154,674 | 5,304,366 | How to migrate from a simple Python project : requirements.txt setup.py (setuptools), to a uv project | <p>If I want to use <a href="https://docs.astral.sh/uv/" rel="noreferrer">uv</a> in an already existing project named <code>my_project</code> with only a <code>requirements.txt</code> (or <code>requirements.in</code>), and simple <code>setup.py</code>(setuptools), that has been installed with <code>pip install -e .</c... | <python><setuptools><packaging><requirements.txt><uv> | 2024-11-04 08:18:08 | 2 | 2,179 | Adrien Pacifico |
79,154,580 | 2,307,441 | Check if string does not contain strings from the list with wildcard when % symbol in the list value | <pre><code>newlist = ['test', '%ing', 'osh', '16fg']
tartext = 'Singing'
</code></pre>
<p>I want to check my tartext value doesn't matching with any value with newlist. if the newlist string contains % symbol in the value then I need to match this as wildcard charecter.</p>
<p>I want to achieve condition as below.</p>
... | <python><list> | 2024-11-04 07:46:50 | 1 | 1,075 | Roshan |
79,154,452 | 22,146,392 | How to import python functions from a module in a local Ansible collection? | <p>I have a local Ansible collection. This is what my folder structure looks like:</p>
<pre><code>/
|_ collections
| |_ ansible_collections
| |_ my # Namespace
| |_ tools # Collection
| |_ plugins
| |_ modules
| |_ my_module.py # Module
|_ my_playbook.yml
</code></pre>... | <python><ansible><ansible-collections> | 2024-11-04 06:50:10 | 0 | 1,116 | jeremywat |
79,154,422 | 3,553,814 | Python sockio SimpleClient fails to connect to python-socketio | <p>I've got a python backend with <code>python-socketio</code> as server. I have a react application which can connect to it just fine. However, my python client app always raises a 'connectionError'.</p>
<p>I need some help to get the settings correct.</p>
<p>Python client</p>
<pre><code>socket_client.connect(
... | <python><python-socketio> | 2024-11-04 06:34:39 | 1 | 549 | Edgar Koster |
79,154,413 | 4,586,008 | How to run python -m build behind proxy | <p>I am trying to build a Python package via <code>python -m build</code>.</p>
<p>However, I am behind a corporate proxy. When I run the command it tries to download the prerequisites and fails with <code>ConnectTimeoutError</code> after several retries:</p>
<p><code>< WARNING: Retrying (Retry(total=4, connect=None,... | <python><proxy> | 2024-11-04 06:31:41 | 0 | 640 | lpounng |
79,154,263 | 18,562,467 | Object tracking using MMtrack from detected masks and bounding boxes from MMdetection | <p>I am working with a custom image dataset and instance segmentations generated using Mask R-CNN from MMDetection. I followed your configuration and data conversion instructions but encountered an error.</p>
<p>Custom Dataset Directory Structure:</p>
<pre class="lang-css prettyprint-override"><code>Workspace\
----Data... | <python><pytorch><tracking> | 2024-11-04 05:15:20 | 0 | 412 | im_vutu |
79,153,853 | 5,067,748 | Adding 2D numpy arrays with differing axes arrays: how to properly replace the deprecated interp2d with RectBivariateSpline? | <p>I need to add two 2D numpy arrays of possibly different shapes and different corresponding axes arrays.</p>
<p>What I mean is this: Lets define two different sets of x- and y-axes, and calculate the z-values according to some function (here: a 2D Gaussian distribution):</p>
<pre class="lang-py prettyprint-override">... | <python><multidimensional-array><scipy><interpolation><numpy-ndarray> | 2024-11-03 23:32:33 | 2 | 376 | Douglas |
79,153,512 | 894,067 | coremltools Error: ValueError: perm should have the same length as rank(x): 3 != 2 | <p>I keep getting an error ValueError: perm should have the same length as rank(x): 3 != 2 when trying to convert my model using coremltools.</p>
<p>From my understanding the most common case for this is when your input shape that you pass into coremltools doesn't match your model input shape. However, as far as I can ... | <python><tensorflow><machine-learning><keras><coremltools> | 2024-11-03 19:49:49 | 1 | 20,944 | Charlie Fish |
79,153,488 | 726,730 | How to match the wmi camera names with cv2 camera index | <p>With wmi I can find the camera names (like HP True Vision HD). How to match this camera names to cv2 indexes?</p>
<p>There is a mismatch trying to match.</p>
<p>Is there any alternative? (for example list camera true names with cv2 directly)?</p>
| <python><opencv><wmi> | 2024-11-03 19:36:00 | 0 | 2,427 | Chris P |
79,153,372 | 7,093,241 | How/Where does PyTorch max documentation show that you can pass in 2 tensors for comparison? | <p>I am learning <code>pytorch</code> and deep learning. The documentation for <a href="https://pytorch.org/docs/stable/generated/torch.max.html" rel="nofollow noreferrer"><code>torch.max</code></a> doesn't make sense in that it looks like we can compare 2 tensors but I don't see where in the documentation I could have... | <python><pytorch><max> | 2024-11-03 18:25:02 | 1 | 1,794 | heretoinfinity |
79,153,340 | 6,574,178 | Qt: how to calculate image coordinates on label? | <p>I am writing an app, that displays an image and allows the User to interact with the image using mouse. The image size is predefined, and in the code below it is 2000x2000. Since the window size may be smaller, the image is scaled to the window size. Also I plan to add zoom feature, and therefore use scroll area.</p... | <python><qt><pyqt><pyqt5><coordinates> | 2024-11-03 18:03:53 | 0 | 905 | Oleksandr Masliuchenko |
79,153,015 | 1,169,091 | How to programmatically determine if the default parameter value was used? | <p>Given a function:</p>
<pre><code>def foo(num = 42, bar = 100):
print("num:", num)
</code></pre>
<p>How might I add code to foo to learn if foo was invoked with no argument for the num and/or bar parameters?</p>
| <python><function><methods><parameters> | 2024-11-03 15:13:06 | 2 | 4,741 | nicomp |
79,152,993 | 3,458,191 | json file validation with schema not working | <p>I am trying to validate a json file with a schema but it always says it is valid even when I am removing some fields from the loaded file, see:</p>
<pre><code>import jsonschema
from jsonschema import validate
my_schema = {
'ID': {'type': 'string'},
'Country': {'type': 'string'},
'Name': {'type': 'string... | <python><json><jsonschema> | 2024-11-03 15:04:18 | 1 | 1,187 | FotisK |
79,152,988 | 1,867,093 | Manim's FuntionGraph to generate the function f(x) = -1/(x**2) | <p>With manim, I tried a simple FuntionGraph for the function</p>
<blockquote>
<p>f(X)=-1/(x**2)</p>
</blockquote>
<p>The python code is given below</p>
<pre><code>from manim import *
class SimpleFunction(Scene):
def construct(self):
graph = FunctionGraph(lambda x: -1/(x**2))
self.add(graph)
</code... | <python><manim> | 2024-11-03 15:03:29 | 0 | 391 | Senthil |
79,152,985 | 4,465,928 | Why is BeautifulSoup find_all() method stopping after HTML comment tag? | <p>I'm using <code>BeautifulSoup</code> to parse this website:</p>
<p><a href="https://www.baseball-reference.com/postseason/1905_WS.shtml" rel="nofollow noreferrer">https://www.baseball-reference.com/postseason/1905_WS.shtml</a></p>
<p>Inside the website, there's followig element</p>
<pre><code><div id="all_po... | <python><web-scraping><beautifulsoup><python-requests> | 2024-11-03 15:02:14 | 1 | 331 | Anthony |
79,152,959 | 2,595,546 | French locale has \xa0 (space) as mon_thousands_sep, but throws error when reading in number with space | <p>I'm using <code>locale.setlocale(locale.LC_ALL, 'fr_FR')</code>. The thousands separator in French is a space -- when checking using <code>locale.localeconv()['mon_thousands_sep']</code>, the output is <code>\xa0</code>, which apparently stands for non-breaking space.</p>
<p>The problem arises when I start reading i... | <python><locale><number-formatting> | 2024-11-03 14:48:02 | 1 | 868 | Fly |
79,152,583 | 17,176,829 | converting email.message.EmailMessage to dictionary in python | <p>I was working with strings like below in python:</p>
<pre><code>'Message-ID: <9803411.1075852365218.JavaMail.evans@thyme>\nDate: Thu, 24 May 2001 15:27:00 -0700 (PDT)\nFrom: john.forney@enron.com\nSubject: Send in your registration card\nMime-Version: 1.0\nContent-Type: text/plain; charset=us-ascii\nContent-Tr... | <python><dictionary><email><parsing> | 2024-11-03 11:19:45 | 0 | 433 | Narges Ghanbari |
79,152,369 | 774,575 | How to change default cmap behavior with plot_surface()? | <p>How can I use <code>cmap</code> to have a color gradient determined by <code>x</code> values rather than by <code>z</code> values?</p>
<p><a href="https://i.sstatic.net/6EA2MoBM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6EA2MoBM.png" alt="enter image description here" /></a></p>
<pre><code>impor... | <python><matplotlib><surface> | 2024-11-03 09:03:42 | 2 | 7,768 | mins |
79,152,012 | 489,607 | Cannot decrypt private ED25519 key generated with cryptography Python module in ssh-keygen | <h3>1. Minimal Python code</h3>
<pre class="lang-none prettyprint-override"><code>import os
from stat import S_IRUSR
from stat import S_IWUSR
from cryptography.hazmat.primitives.asymmetric import ed25519
from cryptography.hazmat.primitives.serialization import BestAvailableEncryption
from cryptography.hazmat.primitive... | <python><cryptography><python-cryptography> | 2024-11-03 03:34:28 | 0 | 16,248 | davidcesarino |
79,151,731 | 2,043,397 | Error computing phase angle between two time series using Hilbert Transform | <p>I'm trying to compute the phase angle between two time-series of real numbers. To check if my function is working without errors I have created two sine waves with a phase of 17 degrees. However, when I compute the phase angle between those two sine waves I do not get the 17 degrees. Here's my script:</p>
<pre><code... | <python><scipy><signal-processing> | 2024-11-02 23:03:05 | 1 | 662 | TMoover |
79,151,675 | 12,633,371 | Spotify API get tracks information from playlist with over 100 tracks using Python | <p>I use plain Python to access the <code>Spotify API</code>. What I want, is to get specific information (song name, artist, album etc.) from the playlists of my account. I have managed to do that, but for playlists with less than 100 songs. <code>Spotify API</code> has a limit of 100 songs to its <code>get</code> req... | <python><spotify> | 2024-11-02 22:14:08 | 2 | 603 | exch_cmmnt_memb |
79,151,595 | 481,061 | Elements in scrollable frame below certain offset aren't rendered in TkInter | <p>I'm using a canvas with a scrollable frame, but elements below a certain scroll offset aren't rendered. Here is an example app demonstrating that behavior. It contains 100 resizable squares in a long list, and a slider on top to set the sidelength. Above ca. 318 pixels sidelength, the lowest boxes aren't rendered an... | <python><tkinter><scrollable> | 2024-11-02 21:13:38 | 0 | 14,622 | Felix Dombek |
79,151,398 | 1,931,605 | view size is not compatible with input tensor's size and stride | <p>I'm trying to training F-RCNN based on coco dataset on my images. Image size is 512X512
I've tested dataloader separately and it works and prints the batch images and BB details
Also i've tried to print the loss in NN and it does print the <code>batch_mean</code> as well and after that ERROR occurs.</p>
<pre class="... | <python><pytorch><pytorch-lightning> | 2024-11-02 18:51:41 | 1 | 10,425 | Shan Khan |
79,151,373 | 11,357,695 | python app does not work when launched from subprocess | <p>I have installed an app with <code>pip</code> in editable mode (<code>App</code>). I am using <code>App</code> in a script via <code>subprocess</code>. <code>App</code> should make a subfolder within the folder containing an input <code>csv</code>, and then add 4 more CSV files to this subfolder. When I call this... | <python><pip><command-line><environment-variables><subprocess> | 2024-11-02 18:36:14 | 1 | 756 | Tim Kirkwood |
79,151,355 | 1,404,332 | How to Use Memory Mapping and Other Techniques to Reduce Memory Usage | <p>I have a sample dataset of 2M vectors with 512 dimensions, each vector being a float32. I have an id field that is int64.</p>
<p>So, the size of raw vectors is 2M * 512 * 4 = 4GB.</p>
<p>The collection is memory-mapped. I have three collections with FLAT, IVF_FLAT, and HNSW indexes on the single vector field in ea... | <python><vector-database><milvus> | 2024-11-02 18:27:46 | 1 | 503 | Tim Spann |
79,151,303 | 1,306,892 | How to add the plane y = x to a 3D surface plot in Plotly? | <p>I am currently working on a 3D surface plot using Plotly in Python. Below is the code I have so far:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import plotly.graph_objects as go
# Definition of the domain
x = np.linspace(-5, 5, 100)
y = np.linspace(-5, 5, 100)
X, Y = np.meshgrid(x, y)
#... | <python><numpy><plotly> | 2024-11-02 17:59:34 | 2 | 1,801 | Mark |
79,151,259 | 1,942,868 | Django model filter for string | <p>I have table which has string such as</p>
<pre><code>id | url
1 | /myapi/1241/
2 | /myapi/
3 | /myapi/1423/
4 | /myapi/
</code></pre>
<p>Now I want to filter them like this below</p>
<pre><code>myModel.Objects.filter(url="/myapi/****/")
</code></pre>
<p>Is it possible , or is there any method to do thi... | <python><django><model> | 2024-11-02 17:45:12 | 1 | 12,599 | whitebear |
79,151,249 | 7,946,082 | why _run_once won't called when custom coroutine called? | <h2>What I did</h2>
<pre class="lang-py prettyprint-override"><code>async def inner() -> None:
print("inner")
async def main() -> None:
print("main start")
await inner()
print("main end")
if __name__ == "__main__":
import asyncio
asyncio.run(main... | <python><python-asyncio> | 2024-11-02 17:42:31 | 1 | 513 | Jerry |
79,151,113 | 3,700,428 | Why am I getting conflicting dependencies from the requirements file when deploying mwaa? | <p>I'm deploying MWAA with Airflow version 2.10.1 on a non-public network, with the following requirements file:</p>
<pre><code>--find-links /usr/local/airflow/plugins
--no-index
pyarrow==14.0.2
filelock==3.15.4
platformdirs==4.2.2
pydantic==2.8.2
virtualenv==20.26.3
distlib==0.3.8
snowflake-connector-python==3.12.1
s... | <python><airflow><mwaa> | 2024-11-02 16:47:06 | 2 | 808 | Sam Helmich |
79,151,017 | 11,770,390 | Importing python function that lives in a sub-subfolder | <p>The following directory structure:</p>
<pre><code>repo/
ββ third_party/
β ββ project/
β β ββ src/
β β β ββ moduledir/
β β β β ββ __init__.py
β β β β ββ main.py
ββ pythonscript.py
</code></pre>
<p>In <code>main.py</code> there's a (dummy) function:</p>
<pre><code>def get_version():
return "1.0&... | <python><python-module> | 2024-11-02 15:51:45 | 2 | 5,344 | glades |
79,150,877 | 689,194 | How to get all fields with choices in a Django model? | <p>I have a Django model with dozen fields with Choice options and I want to serialize their values to write an CSV file.</p>
<p>How can I traverse the fields to find the ones with Choices options?
Something like that:</p>
<pre><code>for field in MyModel._meta.fields:
if field.has_choices_on_it():
print(f.n... | <python><django><django-models> | 2024-11-02 14:36:54 | 1 | 1,714 | Josir |
79,150,620 | 18,445,352 | Closing a httpx client results in a "RuntimeError: Event loop is closed" | <p>I need to maintain a persistent httpx client in my code to utilize its connection pool throughout the lifespan of my application. Below is a simplified version of my implementation:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
import weakref
from threading import Lock
import nest_asyncio
from ... | <python><python-asyncio><aiohttp><httpx> | 2024-11-02 12:05:16 | 1 | 346 | Babak |
79,150,545 | 1,070,833 | CPM constraints for continuous grids | <p>I'm learning CPM using CPMpy mostly and I'm bashing my head trying to figure out constraints for one of my test problems.</p>
<p>Lets say I have a simple 2d grid 5x5. Each cell can be either a road (1) or not a road (0). I want to make sure that all the roads are connected together. Since I'm adding new roads to the... | <python><constraint-programming><cpmpy> | 2024-11-02 11:26:32 | 0 | 1,109 | pawel |
79,150,522 | 2,550,576 | python opencv connect to camera and cannot open your camera | <p>I used Python and OpenCV to connect my program to camera IP.
I try to connect my camera to VLC tool, it can show camera normal. and try connect from python to camera as:</p>
<p>This is my sources:</p>
<pre><code>import cv2
url = 'rtsp://myuser:mypassword@192.168.1.3:port/onvif1?rtsp_transport=udp'
# Open the video... | <python><opencv><video-streaming><rtsp> | 2024-11-02 11:12:22 | 1 | 515 | Khanh Luong Van |
79,150,520 | 9,315,690 | How should I type a function that takes the return value of ArgumentParser.add_subparsers as parameter? | <p>I'm type hinting a codebase that uses argparse to parse command-line arguments, and in this part of the code there are some functions that make operations on the value returned by <code>argparse.ArgumentParser.add_subparsers</code>. I couldn't figure out what type this would return from looking at <a href="https://d... | <python><python-typing><argparse><mypy> | 2024-11-02 11:10:08 | 0 | 3,887 | Newbyte |
79,150,497 | 13,982,768 | Efficently saving code from Python REPL without gui | <p>I often use REPL in my terminal to quick test simple things. With 3.13 update repl gets better and much more usefull so increased my usage but i can't easily save from repl. My current solution is to copy paste from ui.</p>
<p>Is there any methods that allow me to save my session as a .py file or coppy last comman... | <python><read-eval-print-loop> | 2024-11-02 10:55:29 | 0 | 367 | Onuralp Arslan |
79,149,912 | 9,596,339 | Failed to resolve 'gwcdfas0csrtxc09.search.windows.net' ([Errno -2] Name or service not known) | <p>I'm running graphrag solution accelerator from Microsoft to build an index, I'm getting an error at step 7. The application is deployed to kubernetes clusters. There is a pod for frontend and backend. Iβm running the backend pod to create the index. The permissions are given correctly by the infra team. But somehow ... | <python><kubernetes><large-language-model><graphrag><ms-graphrag> | 2024-11-02 03:32:19 | 0 | 331 | Luiy_coder |
79,149,825 | 2,449,857 | Enumerated dataclass types: subclass or custom constructors? | <p>I often find myself making dataclasses of enumerated type - for instance an <code>Action</code> dataclass that has a few parameters and can be one of several types.</p>
<p>I can see two ways to code this. First is to encapsulate everything into one class and provide custom constructors for convenience:</p>
<pre clas... | <python><python-3.x><python-dataclasses> | 2024-11-02 02:15:44 | 1 | 3,489 | Jack Deeth |
79,149,763 | 1,393,162 | Python 3.13 REPL with vim or emacs key bindings? | <p>I just upgraded to Python 3.13 and found that the vim key bindings that I had set up via readline and ~/.editrc, which worked in previous releases of the Python REPL, no longer work. Is there some way to get vim (or emacs) key bindings to work in the new REPL?</p>
| <python><read-eval-print-loop><python-interactive><python-3.13> | 2024-11-02 01:00:18 | 1 | 5,120 | Ben Kovitz |
79,149,745 | 16,611,809 | Use pl.when to create a list with same number of elements, but different content | <p>I asked a <a href="https://stackoverflow.com/questions/79138384/use-np-where-to-create-a-list-with-same-number-of-elements-but-different-conten">similar question for Pandas</a> already, but as I mentioned elsewhere, I am switching to Polars. So, now I need a solution for Polars doing the same thing:</p>
<p>I have a ... | <python><python-polars> | 2024-11-02 00:37:32 | 2 | 627 | gernophil |
79,149,716 | 2,213,289 | Pandas memory_usage inconsistent for in-line numpy | <p>Could someone help explain why there's a difference of results here?</p>
<p>In particular, the memory usage outputted after serialization/deserialization is dramatically different.</p>
<p>The only clue I have is that <code>df["data"][0].flags</code> outputs 'OWNDATA` differently from the latter.</p>
<pre><... | <python><pandas><dataframe><numpy> | 2024-11-02 00:12:40 | 1 | 2,055 | richliaw |
79,149,626 | 1,660,508 | How to fold python code using sed and/or awk? | <p>I have a large python code base. I want to get a feel of how a <code>BaseClass</code> is subclassed by 'grepping-out' the name of the sub class and the functions in the class, but only for classes that inherit from SomeBaseClass.</p>
<p>So if we have multiple files that have multiple classes, and some of the classe... | <python><awk><sed> | 2024-11-01 23:00:26 | 3 | 1,618 | Bitdiot |
79,149,521 | 18,385,480 | Python Cross table count Issue | <p>I'm trying to create a cross table in Python to count data based on specific bins for a data analysis task. My goal is to classify entries by distance and sample size categories based on thresholds, then count occurrences for each category combination. However, Iβm encountering discrepancies between the expected and... | <python><group-by><pivot><pivot-table><bin> | 2024-11-01 22:01:31 | 0 | 723 | bsraskr |
79,149,503 | 5,025,009 | Recursive one-step forecasting in timeseries model | <p>I am trying to implement a <strong>recursive one-step forecasting approach</strong> for a Random Forest model.</p>
<p>The idea is to get a 12-months forecast in an iterative way where each prediction becomes part of the history before the next prediction.</p>
<p>Given that I do not retrain the model and that the err... | <python><scikit-learn><time-series><random-forest><forecasting> | 2024-11-01 21:53:16 | 0 | 33,417 | seralouk |
79,149,485 | 417,896 | Can't install tensortrade on M2 mac | <p>I am trying to install TensorTrade on an M2 mac. It fails becuase it can't install tensorflow 2.9.3</p>
<pre><code> - Installing tensorflow (2.9.3): Failed
</code></pre>
<p>I have already installed:</p>
<pre><code>tensorflow-macos = "2.9.2"
tensorflow-metal = "0.5.0"
</code></pre>
<p>Is there a... | <python><tensorflow> | 2024-11-01 21:42:06 | 1 | 17,480 | BAR |
79,149,425 | 19,500,571 | Plotly: How to make subplots with multiple traces | <p>I am plotting two figures in Plotly using this code:</p>
<pre><code>d = {'1': pd.DataFrame({'x': [1,2,3], 'y': [2,4,6]}), '2': pd.DataFrame({'x': [2,4,6], 'y': [4,6,8]})}
def p1(df, n):
x = df.x.tolist()
y = df.y.tolist()
y_upper = (2*df.y).tolist()
y_lower = (0.5*df.y).tolist()
fig = go.Figur... | <python><plot><plotly><subplot> | 2024-11-01 21:04:51 | 1 | 469 | TylerD |
79,149,293 | 4,516,027 | Calling Numba cfunc from njitted function with numpy array argument | <p>I'm trying to call a <code>cfunc</code>tion inside <code>njit</code>ted function, but Numba does not have <code>data_as()</code> method for its array to cast double pointer. Could anyone help me figure out how to make it work?</p>
<pre class="lang-py prettyprint-override"><code>import ctypes
import numpy as np
impor... | <python><numba> | 2024-11-01 20:07:16 | 1 | 5,803 | kesh |
79,149,274 | 4,299,527 | Why Google Translator API is not outputting accurate translation | <p>I am trying to use the google translator API for translating non-english words (<strong>transliterated words</strong>) to english word. For example, the word "Xingbie" is a Chinese transliterated word which is "Gender" in english word.</p>
<p><a href="https://i.sstatic.net/p0K9Hgfg.png" rel="nofo... | <python><google-translate><google-translation-api> | 2024-11-01 20:00:15 | 1 | 12,152 | Setu Kumar Basak |
79,149,172 | 8,092,340 | Python replace period if it's the only value in column | <p>How do I replace '.' in a dataframe if it's the only value in a cell without also replacing it if it's part of a decimal number?</p>
<p>Here's the dataframe</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>id</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.2222</td>
</tr>
<tr>
<td>.</td>
</tr>
<tr>... | <python> | 2024-11-01 19:21:58 | 1 | 903 | Dread |
79,149,147 | 2,383,070 | Prepend and append characters to all string columns in Polars dataframe | <p>For a DataFrame, I want to prepend and append all the strings with extra characters.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
import polars.selectors as cs
df = pl.DataFrame(
{
"A": [1, 2, 3],
"B": ["apple", "orange", "g... | <python><python-polars> | 2024-11-01 19:03:59 | 3 | 3,511 | blaylockbk |
79,149,035 | 13,849,446 | Ryu controller not forwarding packet after changes in mininet topology | <p>I had written a simple mininet code to make a topology that was working well with my controller logic. The topology I had was
h refers to host, of refers to openflow switch</p>
<pre><code>h1 <-> of1
h2 <-> of2
h3 <-> of2
h4 <-> of3
of1 <-> of2
of2 <-> of3
</code></pre>
<p>After th... | <python><mininet><sdn><ryu> | 2024-11-01 18:21:31 | 0 | 1,146 | farhan jatt |
79,148,924 | 11,590,208 | How to Replace XML Special Characters From Text Within HTML Tags Using Python | <p>I am quite new to Python. I've been working on a web-scraping project that extracts data from various web pages, constructs a new HTML page using the data, and sends the page to a document management system</p>
<p>The document management system has some XML-based parser for validating the HTML. It will reject it if ... | <python><html><xml> | 2024-11-01 17:35:04 | 2 | 611 | cjt |
79,148,882 | 14,179,793 | Python pexpect: Command only happens after subsequent commands are sent | <p><strong>Objective</strong>*
I am trying to use <code>aws ecs execute-command</code> in conjunction with <code>pexpect.spawn()</code> to start an interactive bash session in a container running on an EC2 instance.</p>
<p><strong>Sample Code</strong></p>
<pre><code>import sys
import time
import boto3
import pexpect
... | <python><bash><aws-cli><pexpect> | 2024-11-01 17:14:54 | 0 | 898 | Cogito Ergo Sum |
79,148,803 | 1,824,064 | Docker compose launched through Python's subprocess.Popen is still responding to CTRL-C even though I've overridden the signal handler | <p>I'm trying to launch Docker Compose as a subprocess in Python with <code>subprocess.Popen</code>. I've overridden the signal handler for the parent script and the subprocess, but Compose is still responding to CTRL-C.</p>
<pre><code>def pre_exec():
signal.signal(signal.SIGINT, signal.SIG_IGN)
try:
# block S... | <python><docker><subprocess> | 2024-11-01 16:41:00 | 0 | 1,998 | amnesia |
79,148,755 | 1,642,076 | In a Python plotly bar chart, can I toggle discrete x-axis items in addition to a legend? | <p>I have a plot like this that shows 'Metrics' across different 'Regions':</p>
<p><a href="https://i.sstatic.net/iVilmAIj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iVilmAIj.png" alt="Plotly graph" /></a></p>
<p>I can filter regions by clicking on the legend, and I can switch to showing individual ... | <python><plot><graph><plotly><visualization> | 2024-11-01 16:25:21 | 0 | 497 | Ashley |
79,148,736 | 7,773,898 | Fetch Page Content from Common Crawl | <p>I have thousands of web pages of different websites. Is there a fast way to get content of all those web pages using Common Crawl and Python.</p>
<p>Below is code i am trying but this process is slow.</p>
<pre><code>async def search_cc_index(url):
encoded_url = quote_plus(url)
index_url = f'{SERVER}{INDEX_NA... | <python><python-3.x><common-crawl> | 2024-11-01 16:17:51 | 1 | 383 | ALTAF HUSSAIN |
79,148,566 | 164,171 | With Python, how to apply vector operations to a neighborhood in an n-D image? | <p>I have a 3D image with vector components (i.e., a mapping from R3 to R3). My goal is to replace each vector with the vector of maximum norm within its 3x3x3 neighborhood.</p>
<p>This task is proving to be unexpectedly challenging. I attempted to use scipy.ndimage.generic_filter, but despite its name, this filter onl... | <python><numpy><image-processing><scipy><scikit-image> | 2024-11-01 15:30:10 | 2 | 56,902 | static_rtti |
79,148,429 | 1,931,605 | pytorch : view size is not compatible with input tensor's size and stride | <p>I'm trying to training F-RCNN based on coco dataset on my images. Image size is 512X512
I've tested dataloader separately and it works and prints the batch images and BB details
Also i've tried to print the loss in NN and it does print the <code>batch_mean</code> as well and after that ERROR occurs.</p>
<p>This is t... | <python><pytorch><torchvision> | 2024-11-01 14:50:32 | 0 | 10,425 | Shan Khan |
79,148,292 | 13,392,257 | Sqlalchemy select AttributeError: 'dict' object has no attribute | <p>I am build fastapi + sqlalchemy app</p>
<p>My code</p>
<p>sql.py</p>
<pre><code>form sqlalchemy import Table, String, BigInteger, MetaData
metadata = MetaData()
custom_datasets = Table(
"custom_datasets",
metadata,
Column("project_id", String(500), primary_key=True),
Column(&quo... | <python><sqlalchemy> | 2024-11-01 14:10:18 | 1 | 1,708 | mascai |
79,148,243 | 16,611,809 | transposing within a Polars df lead to "TypeError: not yet implemented: Nested object types" | <p>I have this data:</p>
<pre><code>ββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β col1 β col2 β
β --- β --- β
β list[str] β list[list[str]] β
ββββββββββββββͺββββββββββββββββββββββββββββββββββββββ‘
β ["a"] ... | <python><dataframe><transpose><python-polars> | 2024-11-01 13:53:47 | 3 | 627 | gernophil |
79,148,210 | 19,203,856 | EndpointConnectionError using Localstack with Django | <p>I'm working on setting up Localstack in my Django app so we don't need to connect to S3 for local development. This is the relevant part of my docker-compose:</p>
<pre><code> app:
build:
context: .
dockerfile: docker/app.Dockerfile
command: >
bash -c "poetry run python manage.py ru... | <python><django><amazon-s3><localstack><django-storage> | 2024-11-01 13:43:55 | 1 | 376 | Dillon Brock |
79,148,025 | 8,964,393 | Create random partition inside a pandas dataframe and create a field that identifies partitions | <p>I have created the following pandas dataframe:</p>
<pre><code>ds = {'col1':[1.0,2.1,2.2,3.1,41,5.2,5.0,6.1,7.1,10]}
df = pd.DataFrame(data=ds)
</code></pre>
<p>The dataframe looks like this:</p>
<pre><code>print(df)
col1
0 1.0
1 2.1
2 2.2
3 3.1
4 41.0
5 5.2
6 5.0
7 6.1
8 7.1
9 10.0
</code></pre... | <python><pandas><dataframe><random><partition> | 2024-11-01 12:40:42 | 3 | 1,762 | Giampaolo Levorato |
79,147,875 | 1,942,868 | How to get the log and result of websocket async_to_sync calling | <p>I have websocket and simply send the mesasges to <code>channel_layer</code></p>
<pre><code>from channels.layers import get_channel_layer
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
'{}'.format(mychannelname),
{
"type": "chat_message&... | <javascript><python><django><websocket> | 2024-11-01 11:42:01 | 1 | 12,599 | whitebear |
79,147,705 | 544,721 | How can I redirect `prompt_toolkit` `prompt` output to standard error? | <p><em>How can I redirect <code>prompt_toolkit</code> output to standard error?</em></p>
<p>Iβm working with a script that uses <code>from prompt_toolkit.shortcuts import prompt</code>, and I'm trying to display a progress bar to standard error instead of standard output. Hereβs the core of my setup:</p>
<pre class="la... | <python><command-line><stderr><prompt-toolkit><python-prompt-toolkit> | 2024-11-01 10:41:04 | 1 | 10,883 | Grzegorz Wierzowiecki |
79,147,445 | 480,118 | pandas pivot data, fill Mult index column horizontally | <p>i have the following code:</p>
<pre><code>import pandas as pd
data = {
'name': ['Comp1', 'Comp1', 'Comp2', 'Comp2', 'Comp3'],
'entity_type': ['type1', 'type1', 'type2', 'type2', 'type3'],
'code': ['code1', 'code2', 'code3', 'code1', 'code2'],
'date': ['2024-01-31', '2024-01-31', '2024-01-29', '2024-... | <python><pandas> | 2024-11-01 09:07:59 | 1 | 6,184 | mike01010 |
79,147,385 | 3,825,996 | Running unit tests during pip install when using scikit-build-core with pyproject.toml | <p>Is there a way to automatically test the installation of a python package that is built using scikit-build-core? I already got the C++ unit-tests as part of the C++ build like <a href="https://stackoverflow.com/questions/32901679/unit-testing-as-part-of-the-build">so</a>, can something like this be done for the pyth... | <python><pip><pyproject.toml><scikit-build> | 2024-11-01 08:46:00 | 0 | 766 | mqnc |
79,147,359 | 4,355,878 | How to convert a convolutional to a fully connected ones in PyTorch with integrated bias | <p>How to add a bias to the Toepletiz matrix?</p>
<p>The following <a href="https://stackoverflow.com/questions/56702873/is-there-an-function-in-pytorch-for-converting-convolutions-to-fully-connected-n">approach</a> just shows how to convert the kernel matrix such that</p>
<pre><code>Y = A*X
</code></pre>
<p>But I want... | <python><machine-learning><pytorch> | 2024-11-01 08:34:09 | 0 | 1,533 | j35t3r |
79,147,234 | 4,451,521 | How to correctly do consolde overwrites for hydra | <p>I have a yaml file</p>
<pre><code>cars:
- model: "Sedan"
length: 4.5
width: 1.8
height: 1.4
fuel_efficiency:
- 12 # City
- 15 # Highway
- 13 # Combined
- model: "SUV"
length: 4.8
width: 2.0
height: 1.7
fuel_efficiency:
- 10
- 12
- 1... | <python><fb-hydra> | 2024-11-01 07:29:20 | 1 | 10,576 | KansaiRobot |
79,147,028 | 4,451,521 | TypeError: conlist() got an unexpected keyword argument 'min_items' | <p>I am using pydantic and strictyaml to read a yaml config file. I am using this class</p>
<pre><code>class CarData(BaseModel):
model: str
length: float
width: float
height: float
fuel_efficiency: conlist(item_type=float, min_items=3, max_items=3) # Ensures exactly 3 values
# fuel_efficiency: ... | <python><pydantic> | 2024-11-01 05:34:22 | 1 | 10,576 | KansaiRobot |
79,146,880 | 963,844 | How to prevent python run program at import? | <p>I want my python program can apply changes real time, like a php. So I write <code>run.py</code> to achieve this purpose.</p>
<p>Everybody say never use exec, then I use <code>importlib.reload</code>, but there is a problem, <code>print("main1")</code> will run two times.</p>
<p>If I put it into <code>if _... | <python> | 2024-11-01 03:44:29 | 1 | 3,769 | CL So |
79,146,794 | 1,111,088 | CORS error on Azure Storage calls from Javascript to commit chunked uploads | <p>I want users to upload a huge file directly into Azure Storage. I have a Flask Python web app but I do not want the file to be uploaded into my web server due to size constraints.</p>
<p>When the user has selected the file they want to upload and clicks the upload button, the following happens:</p>
<ol>
<li>An API i... | <javascript><python><cors><azure-blob-storage> | 2024-11-01 02:38:35 | 2 | 2,480 | rikitikitik |
79,146,589 | 6,630,397 | Named argument passed as a dict: SyntaxError: syntax error at or near "%" or SyntaxError: type modifiers must be simple constants or identifiers | <p>I'm facing some troubles when trying to execute a PostgreSQL <code>CREATE TABLE</code> query with a dictionary of parameters using psycopg:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 1 09:32:32 2024
@author: me
"&quo... | <python><postgresql><psycopg2><psycopg3> | 2024-10-31 23:36:00 | 1 | 8,371 | swiss_knight |
79,146,572 | 5,264,127 | How do I obtain the parsed tz offset when parsing tz-aware strings with Polars? | <p>When using Polars to parsing datetime strings with offset information, the output is always in UTC:</p>
<pre class="lang-py prettyprint-override"><code>pl.Series(['2020-01-01T01:00+10:00']).str.to_datetime()
</code></pre>
<pre><code>shape: (1,)
Series: '' [datetime[ΞΌs, UTC]]
[
2019-12-31 15:00:00 UTC
]
</cod... | <python><timezone><python-polars> | 2024-10-31 23:20:25 | 1 | 1,017 | Jarrad |
79,146,409 | 567,749 | Can I call seek on a subprocess stdout pipe and expect it to work in Windows 11? | <p><strong>If I use <code>p = subprocess.Popen(..., stdout=subprocess.PIPE)</code>, can I call seek on <code>p.stdout</code> and expect it to work in Windows 11?</strong></p>
<p>From this link (2011), it seems that the expected answer is no, as "you cannot seek on a pipe." That link also shows an IOError occu... | <python><windows><subprocess> | 2024-10-31 21:34:46 | 1 | 2,189 | devtk |
79,146,281 | 5,104,259 | Python Class to run the equation but can't understand one of def () | <p>I'm self-learning python and it teaches concept of "Class" from <a href="https://python-programming.quantecon.org/python_oop.html" rel="nofollow noreferrer">https://python-programming.quantecon.org/python_oop.html</a></p>
<p>The below is full codes.
I can understand that</p>
<ol>
<li>def h() is the one cal... | <python><class><methods> | 2024-10-31 20:45:12 | 2 | 421 | rocknRrr |
79,146,263 | 2,962,555 | kafka.errors.NoBrokersAvailable: NoBrokersAvailable for a service in container try to create topic at "kafka:9092" | <p>I have multiple services in Docker, including service A (consumer) and Lafka. Service A is the consumer. Below is the docker-compose.yaml</p>
<pre class="lang-yaml prettyprint-override"><code>version: '3.8'
services:
service-a:
container_name: service-a
build:
context: .
dockerfile: Dockerfile... | <python><apache-kafka><docker-compose><bitnami-kafka> | 2024-10-31 20:39:13 | 0 | 1,729 | Laodao |
79,146,216 | 16,611,809 | How to keep the lines of Popen.communicate together? | <p>I want to write the <code>STDOUT</code> of a <code>subprocess.Popen.communicate</code> to a <code>pd.DataFrame</code>. I took some SO threads and combined them to this code:</p>
<pre><code>import subprocess
import io
import pandas as pd
strings = ['Hello\tWorld!', 'This\tis', 'a\tTest!']
string = '\n'.join(string... | <python><subprocess> | 2024-10-31 20:08:34 | 1 | 627 | gernophil |
79,146,033 | 386,861 | How to troubleshoot altair charts that draw blank | <p>I'm trying to plot a facet plot of client ids with timeseries of year (x axis) and total_vchrs (y)</p>
<pre><code> client_id year total_vchrs
0 1564931 2021 4.00
1 2013493 2021 0.00
2 1587580 2021 1.00
3 2259014 2021 0.00
4 2293939 2021 0.00
...
</code></pre>
<p>The data looks simple... | <python><altair> | 2024-10-31 19:00:58 | 1 | 7,882 | elksie5000 |
79,145,990 | 18,851,224 | How to Add For Loop Inside SafeArea in Flet? | <p>How to add for loop inside SafeArea in Flet? I want to add for loop inside SafeArea.</p>
<pre><code>import flet as ft
def main(page: ft.Page):
page.add(
ft.SafeArea(
)
)
for i in range(50):
page.controls.append(ft.Text(f"Line {i}"))
page.scroll = "alwa... | <python><android><flet> | 2024-10-31 18:47:52 | 1 | 469 | Jorpy |
79,145,746 | 4,317,857 | Huggingface transformers eval dataset size and GPU out of memory | <p>I have a trained <code>BertForSequenceClassification</code> model from huggingface <code>transformers</code> library, and I need to run a lot of forward passes on different data using it. I am trying to optimize batch size, which lead to strange behaviour with GPU out of memory, so that I suspect I am doing somethin... | <python><gpu><huggingface-transformers><torch> | 2024-10-31 17:22:03 | 0 | 332 | Nikolay Markov |
79,145,695 | 843,458 | xlwings python fails to read excel data | <p>I am trying this code because it can read the data with an open excel workbook.</p>
<pre><code>import xlwings as xw
xlsfile = r'C:\Users\matth\OneDrive\Dokumente\20241023-1904097928-umsatz.xlsx'
workbook = xw.Book(xlsfile)
ws = workbook.sheets[4]
tbl = ws.api.ListObjects(1) # or .ListObjects(1)
rng = ws.range(tbl.r... | <python><excel><memory><xlwings> | 2024-10-31 17:08:12 | 1 | 3,516 | Matthias Pospiech |
79,145,558 | 2,645,548 | Python redis client timeout does not work | <p>If redis connection is fine and a request is running for a long time, timeout works correctly.
But if redis server unavailable, timeout does not work.</p>
<p>This code raises exception after 5 seconds, instead 0.007</p>
<pre class="lang-py prettyprint-override"><code>from redis import Redis
r = Redis('redis', 6379,... | <python><python-3.x><redis> | 2024-10-31 16:29:10 | 0 | 611 | jonsbox |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.