QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,457,199 | 3,981,290 | How to sort Pandas dataframe by column using the key argument | <p>Assume a Pandas data frame (for the sake of simplicity, let's say with three columns). The columns are titled <code>A</code>, <code>B</code> and <code>d</code>.</p>
<pre><code>$ import pandas as pd
$ df = pd.DataFrame([[1, 2, "a"], [1, "b", 3], ["c", 4, 6]], columns=['A', 'B', 'd'])
$ d... | <python><pandas><sorting><key> | 2024-05-09 22:17:44 | 2 | 1,793 | Michael Gruenstaeudl |
78,457,178 | 15,045,363 | How to get clear sky irradiance with horizon in PVLib? | <p><strong>Is there a way to take into account the horizon in PVLib ?</strong></p>
<p>I have PV systems in the mountains, so with high neigbouring montains affecting the horizon. I have simulated the clearsky irradiance with PVLib, PVGis with and without horizon (see next figure). We see that the difference is signific... | <python><pvlib> | 2024-05-09 22:11:20 | 1 | 865 | Maxime Charrière |
78,457,128 | 19,048,408 | How do I configure Python "ruff" to sensibly format Polars? | <p>How do I configure Ruff to sensibly auto-format Python code for the Polars library?</p>
<p>With the default settings, it likes to left-align <code>.select</code>/<code>.with_columns</code> calls with many arguments. The following is how ruff/black both format it (which is difficult to read):</p>
<pre class="lang-py ... | <python><python-polars><ruff> | 2024-05-09 21:54:10 | 0 | 468 | HumpbackWhale194 |
78,457,093 | 2,893,712 | Pandas Map Multiple Columns With A Filter | <p>I have a dataframe like so (simplified for this example)</p>
<pre><code> Site LocationName Resource#
01 Test Name 5
01 Testing 6
02 California 10
02 Texas 11
...
</code></pre>
<p>Each site has their own mapping for <... | <python><pandas><dictionary><pandas-settingwithcopy-warning> | 2024-05-09 21:41:01 | 2 | 8,806 | Bijan |
78,456,984 | 552,247 | socat to simulate noisy serial line | <p>due to educational purposes I have some scenarios to deal with.<br>
The main one is to simulate a noisy serial line using socat (I currently have version 1.7.4)</p>
<p>I'll elaborate:<br>
I have software that has to do with protocols over serial. I need to test its reliability and performance against errors and comm... | <python><pty><socat> | 2024-05-09 21:06:23 | 1 | 1,598 | mastupristi |
78,456,944 | 10,470,517 | Flask App running within Docker for File Upload | <p>I wrote the following flask application which will collect a file selected and then upload it to a database running in sql lite. If i run the app locally, it works fine with the table created in the database and all the data uploaded. However if I run the app using docker, I get a 200 on file upload but do not see t... | <python><docker><sqlite><flask><makefile> | 2024-05-09 20:54:55 | 1 | 419 | caliGeek |
78,456,849 | 1,100,107 | Recursive R function and its Python translation behave differently | <p>Here is a recursive R function involving a matrix <code>S</code> from the parent environment:</p>
<pre class="lang-r prettyprint-override"><code>f <- function(m, k, n) {
if(n == 0) {
return(100)
}
if(m == 1) {
return(0)
}
if(!is.na(S[m, n])) {
return(S[m, n])
}
s <- f(m-1, 1, n)
i &... | <python><r><recursion> | 2024-05-09 20:26:16 | 5 | 85,219 | Stéphane Laurent |
78,456,828 | 13,392,257 | Selenium emulate site you came from | <p>When I am opening the url via link <a href="https://kinoxor.pro/650-mir-druzhba-zhvachka-2024-05-06-19-54.html" rel="nofollow noreferrer">https://kinoxor.pro/650-mir-druzhba-zhvachka-2024-05-06-19-54.html</a> -- I have an error - <code>Internal Server Error</code></p>
<p><a href="https://i.sstatic.net/5175p7IH.png" ... | <python><parsing><selenium-webdriver><web-scraping> | 2024-05-09 20:19:32 | 1 | 1,708 | mascai |
78,456,761 | 1,015,703 | Example of meson-python Cython package with src layout | <p>I am having trouble finding a minimal example of a Cython project that uses meson-python for packaging and is set up using the "src layout" (as described <a href="https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/" rel="nofollow noreferrer">here</a>).</p>
<p>I have seen examples ... | <python><cython><python-packaging><meson-build> | 2024-05-09 20:02:20 | 1 | 1,625 | David H |
78,456,707 | 11,516,350 | Flask SQL, alembic and SQlite: how to avoid delete object when is referenced (Foreign Key) | <p>Given 2 tables: transactions and categories.</p>
<p>Transactions contains a FK category_id with the ID of assigned category.</p>
<p>I want to not allow delete categories referenced by transactions. I mean: if there is one transaction with category_id 3, for example, I want to get an error from DB if delete the categ... | <python><sqlite><sqlalchemy><relational-database><alembic> | 2024-05-09 19:49:11 | 0 | 1,347 | UrbanoJVR |
78,456,670 | 5,563,616 | How to convert hierarchical TCL string value containing dictionaries into an equivalent Python hierarchical value? | <p>I have hierarchical TCL values represented as strings like this: <code>a {x y v w} b {i j k m}</code>.</p>
<p>The above value contains 3 dictionary objects, which can be queried using TCL expressions.</p>
<p>I need to convert a value like this to a corresponding Python hierarchical value. For the above string the Py... | <python><tcl> | 2024-05-09 19:42:24 | 2 | 1,682 | Jennifer M. |
78,456,651 | 4,418,481 | plotly-resampler with plotly offline figure | <p>I created a simple PyQt app that basically reads CSV files and shows their data in a plot. I decided to display the figures using Plotly offline so I displayed them in a PyQt widget called QWebEngine by providing an HTML of the figure:</p>
<pre><code>traces = self.prepare_traces()
layout = go.Layout(xaxis=dict(titl... | <python><plotly><plotly-resampler> | 2024-05-09 19:36:44 | 0 | 1,859 | Ben |
78,456,371 | 10,818,030 | Error: the command pytest could not be found within PATH | <p>I am trying to run a suite using pytest with this command:</p>
<p><code>pytest -n8 --dc=us best_practice/desktop_web/</code></p>
<p>However, when I try to execute the run, I get the error:</p>
<p><code>Error: the command pytest (from best-practice-desktop-us) could not be found within PATH.</code></p>
<p>I verified ... | <python><path><pytest> | 2024-05-09 18:37:03 | 0 | 657 | Casey Cling |
78,456,247 | 4,159,461 | How start python-telegram-bot in a Thread | <p>I need to run the telegram bot in a separete thread to have the main thread free, but I have bad times tring this.</p>
<p>Follow the piece of code that I have used to test</p>
<p>bot_thread.py</p>
<pre><code>
import logging
import asyncio
from telegram import Update
from telegram.ext import Applicati... | <python><multithreading><telegram-bot> | 2024-05-09 18:11:10 | 0 | 571 | DevBush |
78,456,203 | 11,233,365 | Pip install failing on pip >22.2.2 when installing packages from PyPi via proxy, but not from PyPi directly | <p><strong>UPDATE</strong>
After further study, I found that I have grossly misunderstood the problem I'm encountering, and have re-written the question to reflect the correct, up-to-date details.</p>
<p>================</p>
<p>I am trying to install a Python package on a local machine that does not have direct access ... | <python><pip> | 2024-05-09 17:59:54 | 0 | 301 | TheEponymousProgrammer |
78,456,176 | 10,500,957 | Sharing Class Variables in Python | <p>After looking through many posts of class variables and instance variables I am not understanding how to share variables among classes.</p>
<pre><code>#!/usr/bin/python3
from PyQt5.QtWidgets import (QApplication)
import sys
class One():
def __init__(self, myTextString, parent=None):
self.mytext = myTextS... | <python><class><variables><instance> | 2024-05-09 17:53:55 | 1 | 322 | John |
78,456,105 | 15,277,591 | How to scrape HTML with Python? | <p>I'm working on a Python script to scrape data from this page: <a href="https://www.immobiliare.it/search-list/?criterio=rilevanza&__lang=it&idContratto=1&idCategoria=1&raggio=300&centro=45.185878%2C9.156321&pag=1#1466423673" rel="nofollow noreferrer">https://www.immobiliare.it/search-list/?cr... | <python><web-scraping><beautifulsoup><python-requests> | 2024-05-09 17:37:29 | 1 | 342 | CastoldiG |
78,456,079 | 234,146 | why does numpy complain about matplotlib install errors | <p>I'm testing a python 3.7-32 installation using pip to install numpy. During the clean install of python in an empty directory using</p>
<pre><code>pip -install numpy-1.21.6-cp37-cp37m-win32.whl
</code></pre>
<p>I get the following errors:</p>
<pre><code>ERROR: matplotlib 3.5.3 requires packaging>=20.0, which is ... | <python><numpy><matplotlib> | 2024-05-09 17:30:25 | 0 | 1,358 | Max Yaffe |
78,455,901 | 2,707,955 | How to find the mathematical function from list of plots | <p>I would like to find the mathematical function that could approximately fit all of the following points :</p>
<p><a href="https://i.sstatic.net/40AWOyLj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/40AWOyLj.png" alt="plots" /></a></p>
<pre><code>x = [560, 387, 280, 231, 196, 168, 148, 136, 124, 112... | <python><numpy> | 2024-05-09 16:50:51 | 2 | 365 | Aurélien |
78,455,739 | 12,288,028 | Selecting extreme temperature values from pandas dataframe column where selection process includes several complicating conditions | <p>Have weather data set that includes daily high temperature in Celsius in a pandas dataframe that is as simple as the date and daily high temperature (rounded to the tenth value). Here is a sample data set:</p>
<pre><code>data_dict = {
'dates': ['2023-07-01', '2023-07-02', '2023-07-03', '2023-07-04', '2023-07-05'... | <python><pandas><dataframe><conditional-statements> | 2024-05-09 16:15:59 | 1 | 486 | MC Hammerabi |
78,455,734 | 160,245 | python lxml.html.parse not reading url - or how to get request.get into lxml.html.dom? | <p>The same code below works for many webpages, but for a few like the one below, it gives error:</p>
<blockquote>
<p>Error: Error reading file
'http://akademos-garden.com/homeschooling-tips-work-home-parents':
failed to load HTTP resource</p>
</blockquote>
<p>Python to reproduce:</p>
<pre><code>from lxml.html import p... | <python><python-3.x><lxml.html> | 2024-05-09 16:15:21 | 1 | 18,467 | NealWalters |
78,455,685 | 2,817,520 | Uploaded files are lost after automatic redirect to trailing '/' | <p>From the <a href="https://flask.palletsprojects.com/en/3.0.x/quickstart/#unique-urls-redirection-behavior" rel="nofollow noreferrer">flask documentation</a> a link when used without trailing slash redirects to it with the slash.</p>
<p>In my case with the url ending in <code>/uploads/</code>, the following code prin... | <python><flask><file-upload><response.redirect> | 2024-05-09 16:06:33 | 1 | 860 | Dante |
78,455,648 | 395,857 | How can I find all exact occurrences of a string, or close matches of it, in a longer string in Python? | <p>Goal:</p>
<ul>
<li>I'd like to find all exact occurrences of a string, or close matches of it, in a longer string in Python.</li>
<li>I'd also like to know the location of these occurrences in the longer string.</li>
<li>To define what a close match is, I'd like to set a threshold, e.g. number of edits if using the ... | <python><string-matching><fuzzy-search> | 2024-05-09 15:59:35 | 2 | 84,585 | Franck Dernoncourt |
78,455,598 | 13,313,873 | numpy ignores "casting" argument | <p>Numpy version is 1.26.4</p>
<pre><code>>>> np.isnan('nan', casting='no')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to t... | <python><numpy> | 2024-05-09 15:50:36 | 0 | 955 | noob overflow |
78,455,345 | 11,197,957 | Segmentation faults and memory leaks while calling GMP C functions from Python | <p>Work was quiet today, and so the team was directed to do some "self-development". I decided to have some fun calling <strong>C</strong> functions from <strong>Python</strong>. I had already had a good time using Rust to speed up Python, but I kept hitting a brick wall whenever I wanted to work with integer... | <python><c><gmp> | 2024-05-09 15:04:02 | 1 | 734 | Tom Hosker |
78,455,314 | 3,385,948 | How to make Dash Ag-Grid column wider? | <p>I'm making a table in Python Dash Ag-Grid and I can't seem to make a column wider. I've got lots of extra space to the right, and I thought <code>columnSize=auto-size</code> or <code>columnSize=sizeToFit</code> would make the table fill the entire space.</p>
<p></p>
<p>Here's the column for <code>columnDefs</code>:<... | <python><ag-grid><plotly-dash> | 2024-05-09 14:58:15 | 1 | 5,708 | Sean McCarthy |
78,455,290 | 12,810,409 | Summing numpy array with an empty array | <p>I need to sum a normal numpy array with an empty array</p>
<pre><code>x = np.ones([2,3])
x + np.array([]).reshape(2,-1)
</code></pre>
<p>Output:</p>
<pre><code>ValueError: operands could not be broadcast together with shapes (2,3) (2,0)
</code></pre>
<p>Reshaping them to other dimensions does not work, e.g. <code>x... | <python><numpy><pytorch> | 2024-05-09 14:54:08 | 1 | 378 | Toon Tran |
78,455,273 | 4,737,944 | In Python unittest, how can I access the instance on which a mock method was called? | <p>I have a Python class structure similar to the following example:</p>
<pre class="lang-python prettyprint-override"><code>
class Foo:
def start(self):
# do something
class FooBar(Foo):
def __init__(self, param):
self.param = param
def run(self):
# do something else
class ProductionClass:
... | <python><python-unittest> | 2024-05-09 14:51:15 | 1 | 433 | ronin667 |
78,455,268 | 6,693,247 | Python and pip misconfiguration leads to package installation errors | <p>I'm facing an issue with Python and pip where packages are not being installed under the correct version of Python. I am using Python 3.9.6:</p>
<pre><code>python3 -V
Python 3.9.6
</code></pre>
<p>The pip version</p>
<pre><code>pip3 --version
pip 21.2.4 from /Library/Developer/CommandLineTools/Library/Frameworks/Pyt... | <python><python-3.x><pip> | 2024-05-09 14:50:04 | 2 | 400 | dand1 |
78,455,226 | 12,881,307 | robocorp-windows find window from executable with spaces in path | <p>I want to build an RPA to automate some tasks in different windows computers. I've been looking for frameworks or libraries to do so in Python and <a href="https://robocorp.com/docs/python/robocorp/robocorp-windows/api" rel="nofollow noreferrer">robocorp-windows</a> seems more robust than other options (I've seen RP... | <python><python-3.x> | 2024-05-09 14:43:35 | 1 | 316 | Pollastre |
78,455,102 | 395,857 | Why doesn't fuzzywuzzy's process.extractBests give a 100% score when the tested string 100% contains the query string? | <p>I'm testing <code>fuzzywuzzy</code>'s <code>process.extractBests()</code> as follows:</p>
<pre><code>from fuzzywuzzy import process
# Define the query string
query = "Apple"
# Define the list of choices
choices = ["Apple", "Apple Inc.", "Apple Computer", "Apple Records&... | <python><nlp><string-matching><fuzzywuzzy> | 2024-05-09 14:24:36 | 1 | 84,585 | Franck Dernoncourt |
78,455,055 | 8,547,516 | SQLAlchemy case-sensitive Unicode Column | <p>The title does more or less say everything. I want to create a data model with SQLAlchemy and it should contain fields with values that contain unicode and should be considered case-sensitive.</p>
<p>Until know my type is <code>sqlalchemy.Unicode(255)</code> but e.g. in mariadb this results in <code>utf8mb4_general_... | <python><sqlalchemy> | 2024-05-09 14:15:59 | 0 | 1,250 | gerum |
78,455,045 | 7,433,420 | Django Choices model field with choices of classes | <p>The following code was working in python 3.10 but not in 3.11 due to a change in the <code>enum</code> module.</p>
<p>Now the app won't launch with the following error message :</p>
<pre><code> File "/home/runner/work/e/e/certification/models.py", line 3, in <module>
from .certifications.models ... | <python><django><django-models><enums> | 2024-05-09 14:14:35 | 1 | 908 | WitoldW |
78,454,950 | 5,183,434 | Find the number of layers in an *ome.tif file using tifffile package | <p>Here are the standards for a pyramidal ome-tif file: <a href="https://docs.openmicroscopy.org/ome-model/5.6.3/ome-tiff/" rel="nofollow noreferrer">https://docs.openmicroscopy.org/ome-model/5.6.3/ome-tiff/</a></p>
<p>These files are supported by the tifffile package in python: <a href="https://github.com/cgohlke/tiff... | <python><tiff> | 2024-05-09 13:59:03 | 0 | 742 | Jeff |
78,454,844 | 5,072,692 | Using Python read Refcursors returned from function in Postgres | <p>I have a function that returns a set of refcursors:</p>
<pre><code>CREATE function func_name(func_date date) returns SETOF refcursor
language plpgsql
as
$$
DECLARE
ref1 refcursor := 'data_1';
ref2 refcursor := 'data_2';
BEGIN
OPEN ref1 FOR
SELECT * FROM users;
RETURN NEXT ref1;
OPEN re... | <python><postgresql><psycopg2> | 2024-05-09 13:39:49 | 0 | 955 | Adarsh Ravi |
78,454,803 | 13,757,692 | Pyplot background with color gradient, filling the whole figure | <p>I want to add a background to my Pyplot figure, so that it looks approximately like shown below:</p>
<p><a href="https://i.sstatic.net/mGQKBmDsm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mGQKBmDsm.png" alt="enter image description here" /></a></p>
<p>As far as I can tell, adding a color gradient... | <python><matplotlib><gradient> | 2024-05-09 13:32:50 | 1 | 466 | Alex V. |
78,454,631 | 9,583,035 | How create a tiff image from dataframe with a grid python | <p>I have a dataframe with a grid of 3 columns</p>
<p>utm N utm E Value</p>
<p>How can i create a tiff image using this grid ?</p>
<p>Data:</p>
<pre><code> E N value
0 754104.853089 7.105749e+06 -0.001245
1 755104.853089 7.105749e+06 -0.001168
2 756104.853089 7.10574... | <python><tiff> | 2024-05-09 13:04:50 | 0 | 404 | Vitor Bento |
78,454,457 | 855,475 | Pandas read_json Future Warning: The behavior of 'to_datetime' with 'unit' when parsing strings is deprecated | <p>I am updating pandas version from 1.3.5 to 2.2.2 on an old project. I am not very familiar with pandas, and I am stuck with a Future Warning:</p>
<p>FutureWarning:</p>
<p>The behavior of 'to_datetime' with 'unit' when parsing strings is deprecated. In a future version, strings will be parsed as datetime strings, mat... | <python><pandas> | 2024-05-09 12:30:59 | 1 | 6,478 | Martin Taleski |
78,454,417 | 6,049,429 | poetry show outdated from source | <p>I've two packages:</p>
<ol>
<li>package1</li>
<li>package2</li>
</ol>
<p>I'm installing it from my source:</p>
<pre><code>[[tool.poetry.source]]
name = "mysource"
url = "https://example.com/mysource/simple/"
priority = "explicit"
</code></pre>
<p>pyproject.toml</p>
<pre><code>[tool.poet... | <python><python-3.x><python-poetry> | 2024-05-09 12:23:00 | 0 | 984 | Cool Breeze |
78,454,411 | 1,135,541 | On Windws, Windows Subsystem for Linux (WSL) and every time I install Python, I get ModuleNotFoundError: No module named '_tkinter' | <p>On Ubuntu 24.04, Here is the Error I get:</p>
<pre><code> [I] /home/sporty~> pyenv install 3.12.2
Downloading Python-3.12.2.tar.xz...
-> https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz
Installing Python-3.12.2...
python-build: use readline from homebrew
python-build: use ncurses from homebrew
... | <python><python-3.x><tkinter><windows-subsystem-for-linux><tk-toolkit> | 2024-05-09 12:21:31 | 0 | 1,911 | user1135541 |
78,454,336 | 6,455,667 | Python member variables of different data types not getting updated in different thread with same priority | <p>Consider this sample code:</p>
<pre><code>class Test:
def __init__(self) -> None:
self.bool = False
self.string = ""
thread = Thread(target = self.target)
thread.start()
def target(self):
while True:
if self.bool:
print("B... | <python><multithreading><class><asynchronous><member> | 2024-05-09 12:07:49 | 1 | 452 | Anchith Acharya |
78,454,286 | 2,731,575 | Is there a way to use fuzzy selection to narrow the choices in a wx.ComboBox (wxWidgets) | <p>I want to populate a wx.ComboBox with a large number of items but rather than having to scroll through them all, I'd like to type a string into the ComboBox and narrow the items in the ComboBox using fuzzy search (I'm using '<a href="https://github.com/seatgeek/thefuzz" rel="nofollow noreferrer">thefuzz</a>').</p>
<... | <python><combobox><wxpython><wxwidgets><fuzzywuzzy> | 2024-05-09 11:57:15 | 0 | 371 | wef |
78,454,167 | 893,254 | Pandas read_excel (or other) - does `skiprows` occur before `headers`? | <p>This is a question about the order in which two operations occur when the Pandas <code>read_excel</code> function is called. (Although this would also apply to other <code>read_X</code> type functions such as <code>read_csv</code>.)</p>
<p>The <code>read_excel</code> function takes two arguments of interest</p>
<ul>... | <python><pandas> | 2024-05-09 11:35:21 | 2 | 18,579 | user2138149 |
78,454,139 | 3,918,419 | How to properly scale thumbnails in my custom list widget? | <p><strong>Problem:</strong> I am trying to achieve a thumbnail viewer where each item (i.e. thumbnail and its page number label) are of fixed size. I am trying to scale the images so that they maintain aspect ratio inside these items. However, most images appear somewhat cropped in both dimensions.</p>
<p><a href="htt... | <python><pyqt><pyqt5><custom-widgets> | 2024-05-09 11:29:41 | 2 | 654 | MrVocabulary |
78,454,039 | 11,198,558 | What is the Django logic flow to show pdf inside HTML template after click the given link | <p>I'm using Django to create a website to public my post, all of my post is pdf.</p>
<p>As usual, I defined my view and view logic, it returns a context dictionary</p>
<pre><code>views.py
class PageView(TemplateView):
def get_context_data(self):
context = super().get_context_data(**kwargs)
highli... | <python><django> | 2024-05-09 11:13:12 | 1 | 981 | ShanN |
78,453,755 | 7,435,104 | Problem with python finding Qt platform plugin on NixOS (Sway) | <p>I have recently moved over to NixOS and I am having an issue with a python project I am starting.
I have decided to move forward using Conda to handle my python environment based on the <a href="https://wiki.nixos.org/wiki/Python#Using_conda" rel="nofollow noreferrer">NixOS wiki</a>. I am running NixOS with Sway (wa... | <python><matplotlib><nixos><wayland> | 2024-05-09 10:22:14 | 1 | 401 | tlmoore |
78,453,589 | 3,727,079 | How can I check if the last row of a dataframe has timestamp between two times? | <p>Here's a one-row dataframe:</p>
<pre><code>import pandas as pd
import datetime
df = pd.DataFrame(columns = ['time', 'score'])
df.at[0, 'time'] = '2022-06-11 07:34:54.168327+00:00'
df.at[0, 'score'] = 2793.7
df['time'] = pd.to_datetime(df['time'])
</code></pre>
<p>I want to check if the last row of this dataframe is... | <python><pandas><dataframe><datetime> | 2024-05-09 09:49:31 | 1 | 399 | Allure |
78,453,559 | 5,378,816 | Can exception. __traceback__ be None for an exception caught in try-except? | <p>Submitting this code (BTW, it prints <code>None</code>):</p>
<pre><code>try:
1/0
except Exception as err:
print(err.__traceback__.tb_next)
</code></pre>
<p>to mypy produces an error:</p>
<pre><code># error: Item "None" of "TracebackType | None" has no attribute "tb_next" [union... | <python> | 2024-05-09 09:43:06 | 1 | 17,998 | VPfB |
78,453,496 | 11,233,365 | Get Azure Pipelines to install test environment from pyproject.toml instead of requirements_dev.txt | <p>As mentioned in the title, I'm hoping to get Azure Pipelines to be able to install its test environment from <code>pyproject.toml</code> instead of a separate <code>requirements_dev.txt</code> file, as it would help with reducing the number of dependencies lists that I'd have to maintain.</p>
<p>From looking in the ... | <python><azure-pipelines><github-actions> | 2024-05-09 09:30:32 | 1 | 301 | TheEponymousProgrammer |
78,453,483 | 6,221,742 | Text-2-Sql using Llama3 locally | <p>I'm attempting to utilize the template provided in the Langchain repository for text-to-SQL retrieval using <a href="https://huggingface.co/QuantFactory/Meta-Llama-3-8B-GGUF" rel="nofollow noreferrer">Llama3</a>. Here's the link to the template: <a href="https://github.com/langchain-ai/langchain/tree/master/template... | <python><postgresql><langchain><large-language-model> | 2024-05-09 09:27:57 | 0 | 339 | AndCh |
78,453,464 | 1,928,054 | tox cannot find module | <p>I am trying to run tox on a module.</p>
<p>Consider the following python package:</p>
<pre><code>foo
├── tox.ini
├── setup.cfg
│ tests
│ └── test_bar.py
└── src
├── data
│ └── data.csv
├── __init__.py
└── bar.py
</code></pre>
<p>Where <code>bar.py</code> has:</p>
<pre><code>import importlib.res... | <python><tox><pyscaffold> | 2024-05-09 09:25:12 | 0 | 503 | BdB |
78,453,450 | 7,640,923 | Identifying and retrieving particular sequences of characters from within text fields containing Basic Data desc | <p>I have a list named MAT_DESC that contains material descriptions in a free-text format. Here are some sample values from the MAT_DESC column:</p>
<pre><code>QWERTYUI PN-DR, Coarse, TR, 1-1/2 in, 50/Carton, 200 ea/Case, Dispenser Pack
2841 PC GREY AS/AF (20/CASE)
CI-1A, up to 35 kV, Compact/Solid, Stranded, 10/Case... | <python><python-3.x><regex> | 2024-05-09 09:21:12 | 1 | 315 | rohi |
78,453,435 | 2,164,904 | matching numpy conditions row and column without iteration | <p>Given a dataframe <code>condition</code> defined as:</p>
<pre><code>0 [3, 4]
1 [2]
</code></pre>
<p>I want another dataframe's 0th row, column 3 and 4 and 1th row, column 2 to be set to 0</p>
<p>For example given another dataframe <code>df2</code>:</p>
<pre><code> 1 2 3 4
0 0... | <python><pandas> | 2024-05-09 09:18:15 | 4 | 1,385 | John Tan |
78,453,194 | 5,567,893 | How to match the index of tensors and values in the list using pytorch? | <p>I'd like to match the index of tensors from the list.
I'm trying to do link prediction using Pytorch.
In this process, I need to convert the index to the name by mapping it to the dictionary.
To do this, I set the dictionary and masking to the tensor, but it returned unexpected indices.</p>
<pre class="lang-py prett... | <python><pytorch> | 2024-05-09 08:27:49 | 1 | 466 | Ssong |
78,453,172 | 713,200 | How to search for a attribute substring for a xpath when the attribute is not known? | <p>I have a xpath like</p>
<pre><code>//*[name()='svg' and contains(@data-type,'CHASSIS')]
</code></pre>
<p>This will lead to below html</p>
<pre><code><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-synta... | <python><selenium-webdriver><xpath> | 2024-05-09 08:23:21 | 0 | 950 | mac |
78,452,885 | 3,712,352 | Multiply a pyspark column with array for each row | <p>I have a pyspark DataFrame with two columns. One is a float and another one is an array.
I know that the length of the array in each row is the same length as the the number of rows.
I want to create a new column in the DataFrame that for each row the result will be the dot product of the array and the column.</p>
<... | <python><pyspark> | 2024-05-09 07:15:47 | 2 | 1,838 | AndreyF |
78,452,871 | 984,621 | Scrapy won't download images in the *.MPO format - PIL.UnidentifiedImageError: cannot identify image file | <p>When Scrapy spiders tries to download an image that is in the <strong>.mpo</strong> format, it results in this error:</p>
<pre><code>PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7ff1297bbec0>
</code></pre>
<p>How do I make Scrapy/Pillow to process images with the <strong>.mpo... | <python><scrapy><python-imaging-library> | 2024-05-09 07:12:57 | 0 | 48,763 | user984621 |
78,452,863 | 13,942,929 | Cython : How can we properly call add, sub, mul & divide operator? | <p>In .pxd file, I wrote</p>
<pre><code> _Point operator+(const _Point other) const
_Point operator -(const _Point other) const
bool operator==(const _Point other) const
</code></pre>
<p>In .pyx file, I wrote</p>
<pre><code>def __eq__(self, Point other):
cdef _Point* selfptr = self.c_point.get()
cdef... | <python><c++><cython><operator-keyword><cythonize> | 2024-05-09 07:12:03 | 1 | 3,779 | Punreach Rany |
78,452,816 | 4,806,592 | Why do I get TypeError: iteration over a 0-d array even though I am passing 1-d array? | <p>I have a dataframe (<code>new_df</code>) with below data:</p>
<pre><code>Unnamed: 0 Words embedding
0 0 Elephant [-0.017855134320424067, -0.008739002273680945,...
1 1 Lion [-0.001514446088710819, -0.010011047775235734,...
2 2... | <python><python-3.x><pandas><dataframe><numpy> | 2024-05-09 07:02:54 | 1 | 519 | Karan |
78,452,797 | 7,959,614 | Create bimodal distribution from two uniform distribution using Numpy | <p>I am trying to reproduce the <code>bimodalSample</code> function of this <a href="https://blog.cyrusroshan.com/post/transforming-distributions" rel="nofollow noreferrer">blog</a> in Python.</p>
<p>My attempt:</p>
<pre><code>import numpy as np
def bimodal_pdf(distance: float, weight: float) -> np.ndarray:
... | <python><numpy> | 2024-05-09 06:59:08 | 1 | 406 | HJA24 |
78,452,640 | 3,179,698 | In jupyter notebook, how to use venv to manage package? | <p>I am starting to use venv to manage my packages.</p>
<p>Here I could use terminal to do it, but I want to do it in jupyter notebook, so that I could do the installation during my software dev work smoothly.</p>
<p>However, when I created and activated my virtual env, it seems jupyter didn't confirm me in the virtual... | <python><jupyter-notebook><python-venv> | 2024-05-09 06:25:11 | 1 | 1,504 | cloudscomputes |
78,452,624 | 1,609,428 | how to use loc with a pipe in Pandas? | <p>Consider the following example</p>
<pre><code>import numpy as np
import pandas as pd
data = {
'Group': ['A', 'B', 'C', 'D']*3, # Repeating groups to fill the DataFrame
'Timestamp': pd.date_range(start='2023-01-01', periods=12, freq='M'), # Monthly frequency
'Numeric': np.random.rand(12) * 100, # Rand... | <python><pandas> | 2024-05-09 06:21:29 | 2 | 19,485 | ℕʘʘḆḽḘ |
78,452,601 | 1,744,357 | Add SHA1 to signxml python | <p>I am using the library <a href="https://xml-security.github.io/signxml" rel="nofollow noreferrer">signxml</a> to sign XML signatures for SAML authentication. One of our implementer partners requires that we send the signature in SHA1. The base configuration of XMLSigner does not support SHA1 because it has been depr... | <python><xml><saml><sha1> | 2024-05-09 06:16:11 | 1 | 571 | rocket_boomerang_19 |
78,452,494 | 4,115,031 | How do I debug a remote gunicorn Python web app using Jetbrains Gateway? | <h2>Background</h2>
<p>I'm working as a programmer for a company that has a complicated setup of repos, so what they've done is set up an EC2 instance with all of the necessary repos and config, and I ssh into it to work on their Python (Flask) backend code. I've been using Jetbrains Gateway as my IDE (it runs an IDE i... | <python><pycharm><jetbrains-ide><ngrok><tunneling> | 2024-05-09 05:45:10 | 1 | 12,570 | Nathan Wailes |
78,452,469 | 1,876,345 | How to override the base resolver in pyyaml | <p>I have found several comments and a similar <a href="https://stackoverflow.com/a/42284826/1876345">question</a> on how to override the resolver.
<a href="https://github.com/yaml/pyyaml/issues/376#issuecomment-576821252" rel="nofollow noreferrer">https://github.com/yaml/pyyaml/issues/376#issuecomment-576821252</a></p... | <python><python-3.x><yaml><pyyaml> | 2024-05-09 05:35:14 | 2 | 974 | Diego |
78,452,384 | 3,099,733 | Why doesn't Annotated[str, T] work while Annotated[T, str] works well? | <p>I have a project where user need to use <code>Annotated[str, MyType()]</code> a lot. In order to simplify it, I try to create a generic type</p>
<pre class="lang-py prettyprint-override"><code>T = TypeVar('T')
CustomUrl = Annotated[str, T]
</code></pre>
<p>But I get this error when I try to use it this way:</p>
<pre... | <python><python-typing> | 2024-05-09 05:07:17 | 1 | 1,959 | link89 |
78,452,284 | 240,443 | KeyboardInterrupt in asyncio.TaskGroup | <p>The docs on <a href="https://docs.python.org/3/library/asyncio-task.html#task-groups" rel="noreferrer">Task Groups</a> say:</p>
<blockquote>
<p>Two base exceptions are treated specially: If any task fails with <code>KeyboardInterrupt</code> or <code>SystemExit</code>, the task group still cancels the remaining tasks... | <python><python-3.x><exception><python-asyncio><keyboardinterrupt> | 2024-05-09 04:31:54 | 2 | 199,494 | Amadan |
78,452,069 | 3,453,768 | deepcopy fails with object that contains objects that contain sets that point to each other with __hash__ | <p>This MWE builds a <code>Network</code> class and a <code>Node</code> class. A <code>Node</code> has attributes called <code>predecessors</code> and <code>successors</code>, each of which is a set that will contain other <code>Node</code>s. Functions in the two classes manage the structure of the network.</p>
<pre cl... | <python><hash><set><deep-copy> | 2024-05-09 03:09:00 | 0 | 2,397 | LarrySnyder610 |
78,451,928 | 19,048,408 | How do I configure Python "black" to sensibly format Polars? | <p>How do I configure Black to sensibly auto-format Python code for the Polars library?</p>
<p>With the default settings, it likes to left-align <code>.select</code>/<code>.with_columns</code> calls with many arguments. I want the following code to not get mangled. Is there a standard configuration?</p>
<pre class="lan... | <python><python-polars><python-black> | 2024-05-09 02:20:08 | 0 | 468 | HumpbackWhale194 |
78,451,861 | 2,457,160 | Create new column based on multiple columns and some conditions | <p>I have a data frame with 2-level indexed columns (sample data below):</p>
<pre><code> metric grp Avg P95
mean ci_low ci_up mean ci_low ci_up
0 a CONTROL 8.202862 8.100596 8.306985 17.1... | <python><pandas> | 2024-05-09 01:54:27 | 1 | 3,378 | SixSigma |
78,451,714 | 10,789,207 | Logging to Queue during multiprocessing fails | <p><strong>TL;DR: Why is there no handler listed for the logger at the (inside run) print statement in the console view?</strong></p>
<p>Looking for explanation of why this logging scheme is not working properly.</p>
<p>I'm following the recipe (pretty closely) for logging multiple processes to the same log file found... | <python><logging><python-multiprocessing> | 2024-05-09 00:43:23 | 1 | 11,992 | AirSquid |
78,451,428 | 1,516,389 | Python Accelerate package thrown error when using Trainer from Transformers | <p>I'm trying out this Hugging Face <a href="https://huggingface.co/learn/nlp-course/en/chapter3/3?fw=pt" rel="nofollow noreferrer">tutorial</a></p>
<p>I'm trying to use a trainer to train my mode. The code errors out at this point:</p>
<pre><code>from datasets import load_dataset
from transformers import AutoTokenizer... | <python><huggingface-transformers> | 2024-05-08 22:31:42 | 1 | 636 | raka |
78,451,346 | 268,581 | Testing against local package before pushing update to PyPI | <p>Let's say I have a package <code>abc</code> that I've published to PyPI.</p>
<p>I have other local projects that use <code>abc</code>. Of course, I'd like to be able to update <code>abc</code> locally and test against this version before pushing out to PyPI.</p>
<p>Here's one approach I'm using:</p>
<ul>
<li>Make su... | <python><pypi><python-packaging> | 2024-05-08 22:05:28 | 0 | 9,709 | dharmatech |
78,451,318 | 26,416 | How to make Tk widgets flow from left to right and then top to bottom? | <p>I have to display dozens of radio buttons (grouped by three) in a frame and would like them to flow like text: from left to right and when the line is full, create a second line below.<br />
How would you do this?</p>
<p>EDIT: after some nice comments I got this:</p>
<pre class="lang-py prettyprint-override"><code>i... | <python><user-interface><tkinter> | 2024-05-08 21:58:01 | 1 | 1,604 | Gra |
78,451,312 | 14,250,641 | Reorder a stacked barplot in altair | <p>So I am making an interactive plot (which is why I'm using altair) and I want to reorder the stacks within each bar to match the legend. I've tried reodering the df, I've tried using the 'sort' parameter, but nothing works. Any suggestions would be extremely helpful!</p>
<pre><code>color_scale = alt.Scale(
domai... | <python><pandas><dataframe><plot><altair> | 2024-05-08 21:56:13 | 1 | 514 | youtube |
78,451,289 | 20,898,396 | Match type: Irrefutable pattern is allowed only for the last case statement | <p>I was trying to use the syntax <code>match</code> with a generic, but it wasn't working so I tried <code>match type()</code>.</p>
<pre class="lang-py prettyprint-override"><code>from typing import Generic, TypeVar
from pydantic import BaseModel
class LetterList(BaseModel):
letter: str
class NumberList(BaseMode... | <python> | 2024-05-08 21:47:31 | 0 | 927 | BPDev |
78,451,219 | 22,407,544 | 'The request signature we calculated does not match the signature you provided' in DigitalOcean Spaces | <p>My django app saves user-uploaded files to my s3 bucket in DigitalOcean Spaces(using django-storages[s3], which is based on amazon-s3) and the path to the file is saved in my database. However when I click the url in located in the database it leads me to a page with this error:
<code>The request signature we calcul... | <python><django><amazon-s3><digital-ocean> | 2024-05-08 21:26:48 | 1 | 359 | tthheemmaannii |
78,451,100 | 16,717,009 | What is the type hint for a descriptor? | <p>This is a new question related to <a href="https://stackoverflow.com/questions/78450557">How can I pass a namedtuple attribute to a method without using a string?</a> .
How would I type hint the <code>column</code> parameter in method <code>attempt_access</code>. It can be either an <code>int</code> or the attribute... | <python><python-typing> | 2024-05-08 20:52:07 | 1 | 343 | MikeP |
78,451,024 | 2,662,302 | Python Polars issue with lazy evaluation | <p>I have two dictionaries with keys string and values polars expresions.</p>
<ul>
<li>factor_query_dict</li>
<li>currency_factor_query_dict</li>
</ul>
<p>And I'm doing this:</p>
<pre class="lang-py prettyprint-override"><code>factor_holdings = holdings.lazy().with_columns(
[
pl.coalesce(
... | <python><python-polars> | 2024-05-08 20:29:57 | 0 | 505 | rlartiga |
78,450,904 | 10,319,707 | Do either Python or AWS Glue provide an alternative to .NET's SqlBulkCopy? | <p>I am porting an old SSIS package to AWS Glue. The package runs daily. In several steps in this package, I take data from one table on one Microsoft SQL Server and copy all of it to an empty table of identical schema on another Microsoft SQL Server. I wish to replicate these steps in AWS Glue. This would be rather e... | <python><sql-server><aws-glue><bulkinsert><sqlbulkcopy> | 2024-05-08 19:57:47 | 0 | 1,746 | J. Mini |
78,450,756 | 6,569,899 | How to optimize a bulk query to redis in django - hiredis | <p>I am porting a rest/graphql api from a Java project to Django in Python. We are using redis in both. We have one endpoint that is rather large (returns several MB). In this endpoint we construct a key and if that key exists in redis we return that data and skip past the other logic in the endpoint. I have deployed t... | <python><django><redis><hiredis><django-redis> | 2024-05-08 19:19:10 | 0 | 2,431 | afriedman111 |
78,450,623 | 9,659,840 | how to check if df column contains a map key and if contains, put the corresponding value in a new column in pyspark? | <p>"I have a DataFrame with records stored in a particular column. I want to compare each record in that column against a predefined map. If a record contains any of the keys in the map, I want to populate a new column with the corresponding value associated with that key in the map."</p>
| <python><pyspark><databricks> | 2024-05-08 18:45:38 | 0 | 469 | UC57 |
78,450,597 | 10,634,126 | Creating a new DataFrame column from application of function to multiple columns in groupby | <p>I have a DataFrame of population counts by combination of categorical demographic features and date, with some missing values (consistent across all combos) per date constituting gaps in the data.</p>
<p>I am attempting to:</p>
<ol>
<li>group by all demographic features</li>
<li>apply a function to each time series ... | <python><pandas><dataframe><group-by> | 2024-05-08 18:40:47 | 1 | 909 | OJT |
78,450,595 | 1,788,656 | quiver wind arrows are too lengthy for scale=1 and does not match the key arrow | <p>All,</p>
<p>The argument scale=1 of the matplotlib quiver (wind plot) function produces lengthy arrows extending beyond the figure limits. On the other hand, using scale=None seems to yield a logical arrow length. Any insights on this?</p>
<p>Beside <code>print(ax_left.scale)</code>, which must print None, yields 12... | <python><matplotlib><ipython> | 2024-05-08 18:38:37 | 1 | 725 | Kernel |
78,450,557 | 16,717,009 | How can I pass a namedtuple attribute to a method without using a string? | <p>I'm trying to create a class to represent a list of named tuples and I'm having trouble with accessing elements by name. Here's an example:</p>
<pre><code>from typing import NamedTuple
class Record(NamedTuple):
id: int
name: str
age: int
class NamedTupleList:
def __init__(self, data):
se... | <python> | 2024-05-08 18:30:51 | 1 | 343 | MikeP |
78,450,541 | 10,485,253 | How do I get table data from a label object in sqlalchemy? | <p>Lets say I have the following simplified example:</p>
<pre class="lang-py prettyprint-override"><code>from sqlalchemy.orm import DeclarativeBase, Mapped
class TableA(DeclarativeBase):
col_name = Mapped[str | None]
parent_id = Mapped[int]
class TableB(DeclarativeBase):
col_name = Mapped[str | None]
... | <python><sqlalchemy> | 2024-05-08 18:28:09 | 1 | 887 | TreeWater |
78,450,533 | 5,596,534 | Multiple conditions for filters on partitioned columns with pandas read_parquet | <p>If I have a partitioned data and I was to filter using the <code>filters</code> argument in <code>pd.read_parquet</code> how can I accomplish that? For example:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
data = {
"ID": [1, 2, 3],
"Value": ["A", &qu... | <python><pandas><parquet> | 2024-05-08 18:26:21 | 1 | 4,426 | boshek |
78,450,478 | 2,475,195 | Pandas rolling sum within a group | <p>I am trying to calculate a rolling sum or any other statistic (e.g. mean), within each group. Below I am giving an example where the window is 2 and the statistic is sum.</p>
<pre><code>df = pd.DataFrame.from_dict({'class': ['a', 'b', 'b', 'c', 'c', 'c', 'b', 'a', 'b'],
'val': [1, 2, 3, 4, 5,... | <python><pandas><dataframe><group-by><rolling-computation> | 2024-05-08 18:09:28 | 1 | 4,355 | Baron Yugovich |
78,450,469 | 4,862,402 | Rendering jinja templated parameters before rendering sql query | <p>I have a DAG with multiple SQL tasks (and .sql files) referencing the same template variable called <code>refdate</code> (each file may reference this variable multiple times within the query code). Let's assume the sql file looks like this:</p>
<pre><code>select '{{params.refdate}}';
</code></pre>
<p>Now I want to ... | <python><sql><airflow><jinja2> | 2024-05-08 18:07:29 | 0 | 1,161 | Victor Mayrink |
78,450,274 | 7,307,824 | Multiple requests in Python with `asyncio` | <p>I'm trying to make a number of requests at the same time.</p>
<p>I'm new to <code>async</code> and <code>await</code> in Python (I've used it in Js).</p>
<p>I found an example and used this:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
import aiohttp
async def get_item( session: aiohttp.Client... | <python><python-asyncio> | 2024-05-08 17:25:43 | 2 | 568 | Ewan |
78,450,001 | 774,575 | How to build a MultiIndex DataFrame from a dict of data and a dict of index levels | <p>I'm struggling with the creation of this <code>DataFrame</code></p>
<pre><code> A B
x y
a 1 2 1
2 6 3
c 2 7 2
</code></pre>
<p>from these two dictionaries which seem sufficient:</p>
<pre><code>data = {'A': [2,6,7],
'B': [1,3,2]}
index = {'x': ['a', 'a', 'c'],
'y': [1, 2, 2]}
</co... | <python><pandas><multi-index> | 2024-05-08 16:33:26 | 1 | 7,768 | mins |
78,449,946 | 741,850 | Prevent asyncpg from processing output from postgres? (return raw data) | <p>I am trying to return raw data, as in string / bytes, from a postgresql query executed with asyncpg, without asyncpg parsing the output data into a Record/dict. In my case I use a cursor, but I think the question is general.</p>
<p>Why?</p>
<p>I am returning pre-processed json data, ready for an endpoint. I do not w... | <python><postgresql><asyncpg> | 2024-05-08 16:24:59 | 1 | 12,944 | Automatico |
78,449,726 | 10,200,497 | How can I increase each group by N percent than the previous group? | <p>First of all I'm not sure if it is the correct title. Feel free to suggest a better one.</p>
<p>This is my DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [100, 100, 102, 102, 106, 106, 106, 107, 107, 107]
}
)
</code></pre>
<p>And this is the expected output. I want to create ... | <python><pandas><dataframe> | 2024-05-08 15:47:54 | 1 | 2,679 | AmirX |
78,449,599 | 15,370,142 | pandas date column to unix timestamp accounting for timezone and varying datetime formats | <p>I have multiple data frames with a datetime column as a string. Datetime formats vary across columns in the dataframe or across dataframes. I want to get a unix timestamp that gets interpreted by an ArcGIS application into the local timezone.</p>
<p>For example, one such dataframe is the following:</p>
<pre class="l... | <python><pandas><datetime><timezone><unix-timestamp> | 2024-05-08 15:24:28 | 2 | 412 | Ted M. |
78,449,590 | 3,123,109 | "... && coverage report" not working after switching to pytest-django | <p>I was using <code>unittest</code> in Django to write tests and running the tests with this command:</p>
<pre><code>coverage run --omit='src/manage.py,src/config/*,*/.venv/*,*/*__init__.py,*/tests.py,*/admin.py' src/manage.py test src && coverage report
</code></pre>
<p>It'd run the tests then display the <co... | <python><django><pytest><coverage.py><pytest-django> | 2024-05-08 15:24:09 | 1 | 9,304 | cheslijones |
78,449,573 | 1,451,649 | In Bokeh, how can I update the color of lines when updating a multiline data source? | <p>I want to update a multi_line in a bokeh figure. As part of the updates, I need to adjust colors.</p>
<p>First, I make a simple figure:</p>
<pre><code>from bokeh.plotting import figure, show
p = figure()
# create a dummy multiline so that we can update it later with new data
p.multi_line(xs=[[0,1]], ys=[[0,1]], nam... | <python><bokeh> | 2024-05-08 15:20:32 | 1 | 3,741 | jpobst |
78,449,517 | 6,694,814 | Python ValueError: I/O operation on closed file for loop range | <p>I have the following code:</p>
<pre><code>def openFile():
filepath = filedialog.askopenfilename(
title="Please select a file",
filetypes = (('Excel files', '*.xlsx'),
('Excel macro ... | <python><tkinter><openpyxl> | 2024-05-08 15:10:26 | 1 | 1,556 | Geographos |
78,449,510 | 9,466,142 | Docker containers not able to communicate with each other on the same machine | <p>I have a docker compose file running 2 different services and i have launched a third container which is acting as a database for the first two containers.
Third container is a vector db and when i am trying to communicate via the new instantiated docker container i am getting the below error:</p>
<pre><code>File &q... | <python><docker><docker-compose><dockerfile><large-language-model> | 2024-05-08 15:08:54 | 0 | 573 | Rahul Anand |
78,449,498 | 6,638,232 | How to use the result of a previous if statement to a next if? | <p>I would like to use a while loop in Python for the following if statements. I dont know how to implement this correctly in python.</p>
<pre><code> if t == 0:
za = ds.isel(time=t)
abc = get_grids_inside_rad(127.2, 15.7)
print(abc)
if t == 1:
za = ds.isel(time=t)
ghi = ge... | <python> | 2024-05-08 15:07:01 | 2 | 423 | Lyndz |
78,449,471 | 8,205,554 | How to most efficiently delete a tuple from a list of tuples based on the first element of the tuple in Python? | <p>I have a data structure as follows,</p>
<pre class="lang-py prettyprint-override"><code>data = {
'0_0': [('0_0', 0), ('0_1', 1), ('0_2', 2)],
'0_1': [('0_0', 1), ('0_1', 0), ('0_2', 1)],
'0_2': [('0_0', 2), ('0_1', 1), ('0_2', 0)],
}
</code></pre>
<p>Each key of the dictionary is unique. The values corre... | <python> | 2024-05-08 15:00:45 | 7 | 2,633 | E. Zeytinci |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.