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,183,198 | 13,944,524 | What is the benefit of using import X as X? | <p>I know what <code>as</code> keyword does in import statement, we use it to give an object <em>a different</em> name in the module's namespace. It can be its simplified name(like <code>np</code> for numpy) or completely different name that avoids clashes with other names present in the module.</p>
<p>But, I've seen m... | <python><python-import> | 2024-03-18 21:54:13 | 0 | 17,004 | S.B |
78,183,138 | 4,999,991 | Visual Studio Code Not Recognizing findent Installation for Modern Fortran Extension Despite Correct Python Interpreter and PATH Configuration | <p>I am working with the <a href="https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran" rel="nofollow noreferrer">Modern Fortran extension</a> in Visual Studio Code on Windows and keep encountering a persistent issue. Despite having correctly installed <code>findent</code>, <code>fortran-lan... | <python><visual-studio-code><pip><environment-variables><fortran> | 2024-03-18 21:38:21 | 1 | 14,347 | Foad S. Farimani |
78,183,125 | 1,174,102 | Scrolling causes click (on_touch_up) event on widgets in Kivy RecycleView | <p>Why does scrolling call <code>on_touch_up()</code> in widgets in this Kivy RecycleView?</p>
<p>I created a custom <a href="https://kivy.org/doc/stable/api-kivy.uix.settings.html#kivy.uix.settings.SettingItem" rel="nofollow noreferrer">SettingItem</a> for use in Kivy's <a href="https://kivy.org/doc/stable/api-kivy.ui... | <python><android-recyclerview><scroll><kivy><click> | 2024-03-18 21:36:56 | 1 | 2,923 | Michael Altfield |
78,183,052 | 1,028,270 | How do I set environment variables in a pytest fixture with the MonkeyPatch context manager? | <p>I'm not using classes or test cases I'm just using pytest functions (want to keep it that way).</p>
<p>This does not work:</p>
<pre><code>@pytest.fixture(scope="function")
def set_env():
with MonkeyPatch.context() as mp:
mp.setenv("VAR_ONE", "123")
mp.setenv("VA... | <python><pytest> | 2024-03-18 21:15:38 | 1 | 32,280 | red888 |
78,183,024 | 11,670,196 | How to solve RuntimeError: Couldn't find appropriate backend to handle uri dataset/data/0.wav and format None | <p>The Problem is if I try to run <code>metadata = torchaudio.info(path)</code> I get the error message <code>RuntimeError: Couldn't find appropriate backend to handle uri dataset/data/0.wav and format None.</code> And if I run <code>print(str(torchaudio.list_audio_backends()))</code> it returns an empty list</p>
<p>I ... | <python><pytorch><sox><libsox> | 2024-03-18 21:09:29 | 1 | 383 | Tobias |
78,183,014 | 3,124,181 | Can I use Azure DocumentAnalysisClient with no credentials? | <p>I am trying to use azure's document analysis client but I don't use credentials for my form recognizer. I can make a simple request call to it and it works fine, like so:</p>
<pre><code>import requests
my_endpoint = "http://form_recognizer...?api-version=2022-08-31"
data = "some data"
params = &q... | <python><azure-form-recognizer> | 2024-03-18 21:06:20 | 1 | 903 | user3124181 |
78,182,894 | 6,769,082 | get the name of the group inside pandas groupby transform | <p>Here is what I am trying to do. I have the following DataFrame in pandas:</p>
<pre><code>import numpy as np
import pandas as pd
n_cols = 3
n_samples = 4
df = pd.DataFrame(np.arange(n_samples * n_cols).reshape(n_samples, n_cols), columns=list('ABC'))
print(df)
</code></pre>
<p>output:</p>
<pre><code> A B C
0 ... | <python><pandas><dataframe><group-by> | 2024-03-18 20:37:08 | 2 | 481 | Chachni |
78,182,856 | 6,115,999 | How do I add to a particular column in an association table in Flask? | <p>I have a table called SetList which are setlists that a user may have. I want users to put songs in the setlist. It's a many to many relationship so here is my SetList class:</p>
<pre><code>class SetList(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key = True)
name = db. Column(db.String(75), n... | <python><flask><flask-sqlalchemy> | 2024-03-18 20:29:39 | 0 | 877 | filifunk |
78,182,788 | 547,231 | How to generate jacobian of a tensor-valued function using torch.autograd? | <p>Computing the jacobian of a function f : R^d -> R^d is not too hard:</p>
<pre><code>def jacobian(y, x):
k, d = x.shape
jacobian = list()
for i in range(d):
v = torch.zeros_like(y)
v[:, i] = 1.
dy_dx = torch.autograd.grad(y, x, grad_outputs = v, retain_graph = True, create_... | <python><pytorch><autograd><automatic-differentiation> | 2024-03-18 20:11:24 | 1 | 18,343 | 0xbadf00d |
78,182,726 | 2,188,011 | Saving yolo Model Result as String | <p>I have a model, <code>best.pt</code>, that I'd like to run. It takes an image as input. It classifies an object in this image, a fruit.</p>
<pre><code>from PIL import Image
from ultralytics import YOLO
# Load the pre-trained model
model = YOLO('best.pt')
# Load the input image
input_image = Image.open('fruit.jpeg')... | <python><yolo><ultralytics> | 2024-03-18 19:55:45 | 1 | 1,293 | Fares K. A. |
78,182,723 | 6,197,439 | Does _memimporter still exist in py2exe? | <p>I have only recently started with py2exe, and I would like to use py2exe with MINGW64 Python3 programs (and corresponding libraries). However, the first example I tried failed to build.</p>
<p>After that, I found the <a href="https://www.py2exe.org/index.cgi/TroubleshootingImportErrors" rel="nofollow noreferrer">htt... | <python><python-3.x><py2exe><mingw-w64> | 2024-03-18 19:55:29 | 1 | 5,938 | sdbbs |
78,182,561 | 921,527 | Minimum cases of n choose k with respect of n choose q | <p>I have a list</p>
<pre><code>people = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7']
allComb4 = list(itertools.combinations(people,4)) # n choose k
#[('P1', 'P2', 'P3', 'P4'), ('P1', 'P2', 'P3', 'P5'), ('P1', 'P2', 'P3', 'P6'), ('P1', 'P2', 'P3', 'P7'), ('P1', 'P2', 'P4', 'P5'), ('P1', 'P2', 'P4', 'P6'), ('P1', 'P2', '... | <python><python-itertools><combinatorics><set-cover> | 2024-03-18 19:16:04 | 2 | 509 | Ciprian |
78,182,306 | 14,923,149 | Extracting NCBI RefSeq and Submitted GenBank assembly accession numbers using Selenium and BeautifulSoup | <p><a href="https://stackoverflow.com/questions/78178650/title-difficulty-extracting-genbank-accession-number-using-species-and-strain-n/78179474#78179474">Title: Difficulty Extracting GenBank Accession Number Using Species and Strain Name, using webscraping (Using BeautifulSoup or Selenium)</a> Following this post, I'... | <python><selenium-webdriver><beautifulsoup><biopython> | 2024-03-18 18:21:42 | 1 | 504 | Umar |
78,182,041 | 400,691 | How to create a context manager which is NOT a decorator? | <p>I have a function which looks something like this:</p>
<pre class="lang-py prettyprint-override"><code>import contextlib
@contextlib.contextmanager
def special_context(...):
...
yield
...
</code></pre>
<p>It is appropriate for this to be used as a context manager, like this:</p>
<pre class="lang-py pret... | <python><python-decorators> | 2024-03-18 17:34:18 | 3 | 9,184 | meshy |
78,181,866 | 2,188,011 | Simple Torch Model Test: ModuleNotFoundError: No module named 'ultralytics.yolo' | <p>I have a model, <code>best.pt</code>, that I'd like to run. It takes an image as input, and outputs a string.</p>
<p>I have <code>ultralytics</code>, <code>torch</code> and <code>torchvision</code> installed.</p>
<p>My code is simple:</p>
<pre><code>import torch
from PIL import Image
# Load the pre-trained model
mo... | <python><pytorch><yolov5><ultralytics> | 2024-03-18 17:04:49 | 1 | 1,293 | Fares K. A. |
78,181,822 | 11,235,680 | Return Parent Child json serialized object with SQLAlchemy - lazy loading issue | <p>I'm trying to use a generic query to select a parent class with all its children classes.</p>
<p>The query looks like this:</p>
<pre><code>def get_data(session: Session, table, data_filter):
try:
data = session.query(table).filter_by(**data_filter).first()
return data
except SQLAlchemyError as e:
raise e... | <python><sqlalchemy><fastapi> | 2024-03-18 16:57:47 | 1 | 316 | Bouji |
78,181,726 | 13,176,726 | Django Admin "Export selected" button not showing in Django Admin | <p>I'm trying to enable the "Export selected" button in the Django admin for users to download data as an Excel sheet. I'm using django-import-export but the button isn't appearing.</p>
<p><em><strong>Here's what I've done:</strong></em>
Installed django-import-export (pip install django-import-export).</p>
<... | <python><django><django-import-export> | 2024-03-18 16:42:01 | 1 | 982 | A_K |
78,181,708 | 181,783 | Coverage of process spawned by pytest | <p>I am trying to get coverage on a Python process spawned by pytest. Here are the steps I took:</p>
<ol>
<li>Create a sitecustomize.py module in my local site packages directory</li>
</ol>
<pre class="lang-py prettyprint-override"><code>#/home/Olumide/.local/lib/python3.10/site-packages/sitecustomize.py
import coverag... | <python><pytest><coverage.py> | 2024-03-18 16:38:58 | 1 | 5,905 | Olumide |
78,181,604 | 11,628,437 | How to subtract pandas columns for specific groups in a multi-index dataframe? | <p>I'd like to subtract the average row of every group with it's corresponding sub_column. This implies I need to difference the <code>Dribbling_Speed_Team_Blue</code> with <code>Dribbling_Speed</code> corresponding to <code>Best Player Statistics</code>
Therefore, the final row (<code>Difference</code>) will have the ... | <python><pandas> | 2024-03-18 16:21:45 | 1 | 1,851 | desert_ranger |
78,181,518 | 6,151,828 | Does scikit-learn train_test_split copy data? | <p>Does the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html" rel="nofollow noreferrer"><code>train_test_split</code></a> method of scikit-learn duplicate the data? In other words, if I work with a large dataset, <code>X, y</code>, does it mean that after performi... | <python><machine-learning><scikit-learn><training-data> | 2024-03-18 16:08:22 | 0 | 803 | Roger V. |
78,181,494 | 6,195,489 | Pandas read_csv works but pyarrow doesnt | <p>I have a csv file, which is tab separated. The following code:</p>
<pre><code>import numpy as np
import sys
import pyarrow.csv as pa_csv
import pandas as pd
df = pd.read_csv(sys.argv[1],sep='\t',header=0,dtype='object')
parse_options = pa_csv.ParseOptions(delimiter='\t')
data = pa_csv.read_csv(sys.argv[1], parse_op... | <python><pandas><csv><pyarrow> | 2024-03-18 16:05:12 | 0 | 849 | abinitio |
78,181,458 | 10,908,375 | How do I get the rolling proportion between multiple columns? | <p>For every row, I want to have a proportion of the total values (sales). For instance, for some row, we would take the total of the 2 past values of two columns, and compute the proportion of each column.</p>
<p>Let's say we have the following dataset:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({
'fact... | <python><pandas> | 2024-03-18 16:00:01 | 2 | 36,924 | Nicolas Gervais |
78,181,389 | 8,684,461 | getting tickers from interactive brokers using post requests | <p>Hi All for some reason interactive brokers don't make it easily accessible to get tickers from their site. I currently get them via their exchange pages using a normal request query. However, this is becoming a bit less reliable. I am trying to implement a imitation of their product search <a href="https://www.inter... | <python><web-scraping><post><python-requests> | 2024-03-18 15:50:07 | 1 | 789 | JPWilson |
78,181,354 | 4,784,914 | Define relationship through double belongs-to-many in SQLAlchemy | <p>I have three tables: <code>Item</code>, <code>Shelve</code> and <code>Cabinet</code>.</p>
<p>A <code>Cabinet</code> has-many <code>Shelve</code>s and a <code>Shelve</code> has-many <code>Item</code>s:</p>
<pre><code>Item
id: int
shelve_id: int
Shelve
id: int
cabinet_id: int
Cabinet:
id: id
</co... | <python><sqlalchemy> | 2024-03-18 15:43:52 | 1 | 1,123 | Roberto |
78,181,346 | 5,618,856 | FastAPI in docker - module not found error from main | <p>I have a (locally) working fastAPI-app. Now I intend to bring it to docker. I followed the instruction as <a href="https://fastapi.tiangolo.com/deployment/docker/" rel="nofollow noreferrer">in the docs</a>. When starting up the container it stops. The log tells</p>
<pre><code> File "/code/./app/main.py", ... | <python><docker><fastapi> | 2024-03-18 15:42:47 | 1 | 603 | Fred |
78,181,094 | 172,131 | Change record title in a StackedInline in Django | <p>I am trying to either change or remove the title for each record in an inline, but have not been able to find a way to do it in the docs or by override get_formset. Specifically, I want to change or remove the title highlighted in the attached image. Any ideas how to do it please? Preferably without overriding CSS e... | <python><django><django-forms> | 2024-03-18 15:01:36 | 1 | 20,218 | RunLoop |
78,180,968 | 7,456,923 | Can I force array numpy to keep its uint32 type? | <p>I would like to reproduce C behavior in Python, presumably using numpy, but I'm running into this issue :</p>
<pre><code>>>> import numpy
>>> a = numpy.uint32(4294967295)
>>> type(a)
<class 'numpy.uint32'>
>>> a += 1
>>> a
4294967296
>>> type(a)
<class '... | <python><numpy><uint32> | 2024-03-18 14:37:02 | 1 | 6,220 | gdelab |
78,180,950 | 7,456,923 | Does numpy exactly reproduce all C behaviors on usual operations? | <p>I'm designing an algorithm in python and know I'll want to translate it to C later.</p>
<p>However, mathematical operations in Python might not yield the same result as in C, for instance <code>4294967295 + 1 = 0</code> in C for unsigned integers, but not with plain Python integers operations. Therefore, I should no... | <python><c><numpy> | 2024-03-18 14:33:34 | 1 | 6,220 | gdelab |
78,180,814 | 5,344,240 | Decorating an instance method of a class with a decorating function | <p>I am using Python 3.10. Consider this toy example of a cache that caches the very first call to an instance method and then returns the cached value on subsequent calls:</p>
<pre><code>import functools
def cache(func):
@functools.wraps(func) # for __name__
def wrapper(*args, **kwargs):
if not wrapp... | <python><python-decorators> | 2024-03-18 14:10:48 | 2 | 455 | Andras Vanyolos |
78,180,808 | 7,352,883 | How to collect performance trace via CDP commands through Selenium Python? | <p>I want to collect Chrome Profiler trace dump via Selenium - Python similar to <a href="https://zchandikaz.medium.com/start-chrome-profile-recording-from-selenium-java-a2fee0351396" rel="nofollow noreferrer">this approach in JAVA</a></p>
<p>Appropriate <a href="https://chromedevtools.github.io/devtools-protocol/tot/T... | <python><selenium-webdriver> | 2024-03-18 14:10:30 | 1 | 1,449 | Shivam Mishra |
78,180,770 | 5,725,780 | What's the function object alternative to 1D linear interpolation with SciPy/NumPy? | <p>I'm looking for a way to create a "functor" for linear interpolation of time,value pairs using SciPy (or NumPy) but according to the <a href="https://docs.scipy.org/doc/scipy/tutorial/interpolate.html" rel="nofollow noreferrer">SciPy tutorial</a> there is none! (Kind of the opposite of <a href="https://sta... | <python><numpy><scipy><linear-interpolation> | 2024-03-18 14:04:08 | 2 | 721 | pipe |
78,180,518 | 1,422,096 | Grammar for combinations of Numpy arrays | <p>For a specific application, I do a GUI to manipulate some data (internally: numpy 1D arrays), and plot them.</p>
<p>The end-user can choose in the UI to plot various series <code>a</code>, <code>b</code>, <code>c</code>.</p>
<p>Now I also need to allow a <strong>"custom combination" of <code>a</code>, <cod... | <python><numpy><eval><grammar> | 2024-03-18 13:21:24 | 1 | 47,388 | Basj |
78,180,508 | 19,499,853 | Transform Postgres recursive query to Python Pandas Dataframe | <p>I've got recursion, which is written in Postgresql database.</p>
<pre><code>with recursive relations_recurs(
pos_id, boss_pos_id, level_num, link_type, link_type_array, pos_id_array
) as (
select l.pos_id,
l.boss_pos_id,
1 as level_num,
... | <python><pandas><postgresql><algorithm><recursion> | 2024-03-18 13:20:11 | 0 | 309 | Gerzzog |
78,180,479 | 10,722,752 | How to view histograms juxtaposed using matplotlib | <p>I am trying to visualize how the distributions differ based on the flag column:</p>
<p>Sample Data:</p>
<pre><code>np.random.seed(0)
df = pd.DataFrame({'col1' : np.random.uniform(size = 100),
'col2' : np.random.uniform(size = 100),
'col3' : np.random.uniform(size = 100),
... | <python><pandas><matplotlib> | 2024-03-18 13:16:07 | 1 | 11,560 | Karthik S |
78,180,462 | 165,753 | How to share downloaded huggingface models among users? | <p>I'd like several users to share downloaded models, such that when any of the users downloads a model, e.g. using</p>
<pre><code>tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
</code></pre>
<p>the other users would be able to use it as well for inference... | <python><huggingface-transformers><nfs><huggingface-hub> | 2024-03-18 13:12:25 | 1 | 7,729 | dimid |
78,180,325 | 7,480,820 | Can you use a function's return type as a type elsewhere? | <p>I have a callback that takes the result of another function as input. Is there a way to directly reference that function's return type? Currently I have the return type defined as a type alias that I can use in both places but that doesn't seem ideal. Does something like C++'s <a href="https://en.cppreference.com/w/... | <python><python-typing> | 2024-03-18 12:49:24 | 1 | 1,282 | Philip Nelson |
78,180,153 | 10,574,250 | VS Code - An Invalid Python interpreter is selected, please try changing it to enable features such as IntelliSense, linting, and debugging | <p>I am trying to select my python interpreter in VS Code using a venv that I have created. I have tried everything but it doesn't work.</p>
<p>My folder structure looks like this:</p>
<pre class="lang-none prettyprint-override"><code>- practice
- venv
- Scripts
- python.exe
- all other associated venv files.
... | <python><visual-studio-code> | 2024-03-18 12:18:27 | 0 | 1,555 | geds133 |
78,180,139 | 4,578,454 | django custom datetime format not working with form fields | <p>I'm working on a Django project where I wanted to add a date format for local usage. As per the documentation, I have updated the settings to use local date time format : <a href="https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-DATETIME_INPUT_FORMATS" rel="nofollow noreferrer">Link</a></p>
<p>Setting... | <python><django><datetime> | 2024-03-18 12:16:54 | 0 | 4,667 | silverFoxA |
78,180,128 | 6,943,622 | Build Palindrome from two strings | <p>I want to write a python function that does this efficiently:</p>
<p>The function will take two strings, 'a' and 'b', and attempt to find the longest palindromic string
that can be formed such that it is a concatenation of a non-empty substring of 'a' and a non-empty
substring of 'b'. If there are multiple valid ans... | <python><algorithm><palindrome> | 2024-03-18 12:16:01 | 1 | 339 | Duck Dodgers |
78,179,966 | 14,989,571 | Remove background of image using sobel edge detection | <p>I have a bunch of images representing coins, some of which have a noisy background (e.g. letters or different background color). I'm trying to remove the background of each coin image to leave only the coin itself but I cannot get the <code>cv2.findContours</code> function from OpenCV to only detect the main contour... | <python><opencv><computer-vision><semantic-segmentation> | 2024-03-18 11:47:23 | 1 | 2,489 | Shunya |
78,179,864 | 3,468,067 | Is there a shorter way to tell Mypy that a given optional chaining is fine? | <p>I am working on Python code where the domain logic makes it natural to have a class with an optional field of a second class, which itself has an optional field of a third class. Boiling it down to a minimum working example, this is what I mean:</p>
<pre><code>class C:
def __init__(self, number: int) -> None:... | <python><mypy><python-typing><optional-chaining> | 2024-03-18 11:28:39 | 0 | 383 | Erlend Magnus Viggen |
78,179,759 | 1,766,088 | Read .accdb database in Python app running on Docker container (Alpine) | <p>I am trying and failing to read a local .accdb file in my Python 3.11 app, which is running in an <code>python:3.11-alpine</code> container.</p>
<p>My Dockerfile executes without errors:</p>
<pre class="lang-dockerfile prettyprint-override"><code>FROM python:3.11-alpine
EXPOSE 5001
ENV PYTHONDONTWRITEBYTECODE=1
ENV... | <python><docker><ms-access><alpine-linux><mdbtools> | 2024-03-18 11:09:03 | 2 | 675 | asdf |
78,179,714 | 3,973,269 | Extract photos from a photo album using Python | <p>I have a physical photo album, for which each page might contain one or more photos glued on it.</p>
<p>I took a picture of each individual page, containing multiple photos.
Now, I placed all the pictures that I took into a single folder, and I would like to iterate over it with Python to extract all photos that wer... | <python><opencv><contour><canny-operator> | 2024-03-18 11:02:23 | 1 | 569 | Mart |
78,179,471 | 22,418,446 | mdates locators show non-existent time intervals in my graph | <p>I'm trying to build streamlit dashboard for stock marketting. My stock datas is between 9am to 16pm. I'm using locators for x-axis ticks. However, the chart shows the data for non-existent time intervals like in graph there is big gap between tciks and draw linear between 16pm to 9am. I want to remove this gap and m... | <python><pandas><matplotlib><streamlit> | 2024-03-18 10:24:45 | 2 | 1,160 | msamedozmen |
78,179,350 | 1,613,983 | How do I generate ngroups from a comparison function? | <p>Suppose I have a function that compares rows in a dataframe:</p>
<pre><code>def comp(lhs: pandas.Series, rhs: pandas.Series) -> bool:
if lhs.id == rhs.id:
return True
if abs(lhs.val1 - rhs.val1) < 1e-8:
if abs(lhs.val2 - rhs.val2) < 1e-8:
return True
return False
</code></pre>
<p>Now I... | <python><pandas> | 2024-03-18 10:01:29 | 2 | 23,470 | quant |
78,179,269 | 6,435,921 | Why Pycharm's struggles with Scipy functions that can return multiple outputs? | <p>Scipy is one of the most used scientific packages in Python. Most of its functions have a common interface: they either return only a value (which can be <code>float/np.ndarray</code>) or a <code>tuple</code>, where the second term is <code>boolean</code> or a <code>dict</code>. Something like this:</p>
<pre><code>v... | <python><scipy><pycharm> | 2024-03-18 09:47:19 | 1 | 3,601 | Euler_Salter |
78,178,650 | 14,923,149 | Difficulty Extracting GenBank Accession Number Using Species and Strain Name, using webscraping (Using BeautifulSoup or Selenium) | <p>I need to extract specific information from a webpage using BeautifulSoup and / or Selenium. I'm trying to extract information related to a particular organism from a webpage, but I'm encountering difficulties.</p>
<p>I tried this</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.by import... | <python><selenium-webdriver><beautifulsoup><biopython> | 2024-03-18 07:45:21 | 0 | 504 | Umar |
78,178,479 | 424,957 | how to load page by python selenium? | <p>I can view page by any browser, I can only view blank when I open that by Selenium, I found there is javaScript as below, I guess that I need to run this code, what can I do next?</p>
<pre><code><body>
<script>
!function(){
var e=document.createElement(“iframe”);
funct... | <javascript><python><selenium-webdriver> | 2024-03-18 07:09:48 | 1 | 2,509 | mikezang |
78,178,330 | 2,862,945 | Updating multiple plots in Jupyter notebook when a slider value changes | <p>I want to update multiple <code>imshow</code> plots in a jupyter notebook when an <code>IntSlider</code> value changes. What is wrong with by code?</p>
<p>Those are the versions I am using</p>
<pre><code>import ipywidgets as widgets
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
print( 'versio... | <python><matplotlib><jupyter-notebook><jupyter-lab> | 2024-03-18 06:29:20 | 2 | 2,029 | Alf |
78,177,927 | 336,489 | Azure Functions in Python and GnuPG invocation | <p>I have an Azure Function in Python and I am trying to use the python-gnupg wrapper to invoke a GnuPG binary while doing local development.</p>
<p>This is the code I am trying out inside of the Azure Function with a HTTP Trigger.</p>
<pre><code>import gnupg
import tempfile
import subprocess
import azure.functions as... | <python><azure><azure-functions><gnupg><python-gnupgp> | 2024-03-18 04:25:12 | 1 | 5,130 | GilliVilla |
78,177,866 | 5,794,617 | How to get number of cores from inside a pod | <p>Kubernetes allows <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits" rel="nofollow noreferrer">to set CPU & memory limits for a pod</a>. Is there a way to get CPU request/limits from inside a POD without using <code>kubectl</code>?</p>
| <python><kubernetes><cgroups> | 2024-03-18 03:53:04 | 1 | 2,453 | Artavazd Balayan |
78,177,751 | 6,587,318 | Is there any way to have re.sub report out on every replacement it makes? | <p>TL;DR: How to get <code>re.sub</code> to print out what substitutions it makes, including when using groups?</p>
<p>Kind of like having a verbose option, is it possible to have <code>re.sub</code> print out a message every time it makes a replacement? This would be very helpful for testing how multiple lines of <cod... | <python><regex><python-re> | 2024-03-18 02:59:40 | 2 | 326 | Zachary |
78,177,697 | 1,174,102 | How to access Kivy Properties from within its "self" on __init__() | <p>How can I access a <a href="https://kivy.org/doc/stable/api-kivy.properties.html" rel="nofollow noreferrer">Kivy Property</a> within a widget's own <code>__init__()</code> function?</p>
<p>I wrote a custom <a href="https://kivy.org/doc/stable/api-kivy.uix.widget.html" rel="nofollow noreferrer">widget in Kivy</a>. I ... | <python><android-recyclerview><kivy> | 2024-03-18 02:32:51 | 1 | 2,923 | Michael Altfield |
78,177,620 | 661,424 | Scrolling a tk.Text with the yview_scroll method results in a glitch sometimes | <p>I have a <code>tk.Text</code> widget inside a frame, that is inside a <code>Notebook</code>. Inside the tk.Text I embed another tk.Frame that has a tk.Frame header and a tk.Text content. The problem is that when I try to scroll the main tk.Text, from bottom to top, a pure black background box appears as I scroll up,... | <python><tkinter> | 2024-03-18 01:54:30 | 0 | 4,073 | madprops |
78,177,595 | 2,504,762 | nox not able to to find python 3.7 interpreter | <p>I am trying to contribute to open source repo. And I realize that my test is failing on python 3.7 interpreter, it passing in 3.8, 3.9 and 3.10. I am trying to run this locally so I could fix it.</p>
<p>However, when I am trying to run it. it shows me following error.</p>
<pre><code>❯ nox -R -s unit-3.7 -- -k test_... | <python><python-3.x><unit-testing><nox> | 2024-03-18 01:44:33 | 0 | 13,075 | Gaurang Shah |
78,177,570 | 11,628,437 | How to `pd.concat` nested dictionaries? | <p>I am trying concatenate multiple DataFrames using <code>pd.concat</code>. Basically I am trying to follow the instructions from <a href="https://stackoverflow.com/questions/78175233/can-i-create-a-nested-column-pandas-dataframe-using-a-nested-dictionary?noredirect=1#comment137819708_78175233">this</a> post for a fou... | <python><pandas> | 2024-03-18 01:32:27 | 1 | 1,851 | desert_ranger |
78,177,372 | 268,847 | Allow a Python typer option to appear anywhere on the command line | <p>Consider the following typer-based Python program:</p>
<pre class="lang-python prettyprint-override"><code>#!/usr/bin/env python
import typer
app = typer.Typer()
from typing_extensions import Annotated
VERBOSE = False
books_app = typer.Typer()
app.add_typer(books_app, name="books")
authors_app = typer.T... | <python><typer> | 2024-03-17 23:50:49 | 0 | 7,795 | rlandster |
78,177,175 | 10,755,782 | Difficulty Finding Input Field Using Selenium XPath in Python | <p>I'm currently learning Selenium automation and I'm trying to automate a simple task:</p>
<ol>
<li>navigating to a webpage, (<a href="https://sri-gpt.github.io" rel="nofollow noreferrer">https://sri-gpt.github.io</a>)</li>
<li>locating an input field,</li>
<li>entering text into it, and submitting the form.</li>
</ol... | <python><google-chrome><selenium-webdriver><selenium-chromedriver> | 2024-03-17 22:30:13 | 2 | 660 | brownser |
78,177,066 | 814,354 | Jupyterlab "Too many open files" cause by duplicate loads of libraries | <p>I repeatedly get jupyter lab sessions that start to hang while spamming tracebacks to the terminal that end with:</p>
<pre><code> zmq.error.ZMQError: Too many open files
</code></pre>
<p>An example complete traceback is:</p>
<pre><code>[E 2024-03-17 17:40:36.843 ServerApp] Uncaught exception GET /api/kernels/059a... | <python><jupyter><jupyter-lab> | 2024-03-17 21:46:42 | 0 | 19,445 | keflavich |
78,177,061 | 6,031,223 | Error on Hybrid Search using Azure AI Search | <p>I've been getting the following error using python sdk and front end although I believe I have my schema set up "Searchable" correctly. Please advice, thank you.</p>
<blockquote>
<p>"The 'search' parameter requires at least 1 searchable text field in the index.\r\nParameter name: searchFields"</p... | <python><azure><azure-cognitive-search><azure-python-sdk><azure-ai-search> | 2024-03-17 21:44:38 | 1 | 333 | ROAR.L |
78,176,968 | 11,628,437 | How can I add the values for same groups until the second last index level of a nested Pandas dataframe | <p>I've created a minimal example of a nested pandas dataframe from a nested dictionary based on the instructions given in this <a href="https://stackoverflow.com/questions/78175233/can-i-create-a-nested-column-pandas-dataframe-using-a-nested-dictionary/78175296#78175296">post</a>.</p>
<pre><code>nested_dict = { 'Full_... | <python><pandas> | 2024-03-17 21:13:45 | 1 | 1,851 | desert_ranger |
78,176,948 | 2,195,440 | How to resolve types in Python code with Tree-sitter? | <p>I'm using Tree-sitter to parse Python code and extract ASTs, and trying to manually traverse ASTs to infer types based on assignments and function definitions.</p>
<p>But I'm struggling with accurately resolving types (variables, functions, classes) due to Python's dynamic typing. Specifically, challenges arise with... | <python><treesitter><type-resolution> | 2024-03-17 21:06:35 | 0 | 3,657 | Exploring |
78,176,906 | 640,205 | Why is there a file handle after opening and closing an xlsx file workbook with openpyxl with read_only=True? | <p>Can I get your help troubleshooting a file handle issue with the Python package openpyxl version 3.0.7? If the load_workbook 'read_only' parameter is set to False, this does not occur. It only occurs when set to True. If you call these load_workbook and close functions multiple times (of the same file), this will... | <python><openpyxl> | 2024-03-17 20:49:04 | 1 | 19,120 | JustBeingHelpful |
78,176,717 | 2,340,002 | How to bind functions returning references with pybind11? | <p>When binding C++ with <code>pybind11</code>, I ran into an issue regarding a couple of class members that return (const or non-const) references; considering the following snippet:</p>
<pre><code>struct Data {
double value1;
double value2;
};
class Element {
public:
Element() = default;
Element(Dat... | <python><c++><reference><pybind11> | 2024-03-17 19:55:58 | 1 | 1,767 | joaocandre |
78,176,587 | 884,463 | Python's file.truncate() unexpectedly does not truncate | <p>I have this very simple Python program:</p>
<pre><code>def print_file(filename):
with open(filename,'r') as read_file:
print(read_file.read())
def create_random_file(filename,count):
with open(filename,'w+', encoding='utf-8') as writefile:
for row_num in range(count):
writefi... | <python> | 2024-03-17 19:15:14 | 2 | 15,375 | David Tonhofer |
78,176,517 | 386,861 | Overlaid boundary and point Altair plots are not aligning | <p>I've got a layer map plot in Altair of London that I was struggling to flip - <a href="https://stackoverflow.com/questions/78175314/solving-upside-plot-and-projection-problems-in-geopandas-and-altair">Solving upside plot and projection problems in Geopandas and Altair</a></p>
<p>However, a more troubling problem is ... | <python><altair> | 2024-03-17 18:52:31 | 1 | 7,882 | elksie5000 |
78,176,515 | 3,231,778 | Azure Machine Learning dataset creation hangs forever | <p>I'm trying to create a <code>Dataset</code> from a datastore using Azure ML, however, the execution hangs forever and never finishes.</p>
<p>This is the code I'm running which I've adapted from the Msft documentation:</p>
<pre class="lang-py prettyprint-override"><code>import azureml.core
from azureml.core import Wo... | <python><azure><azure-machine-learning-service><azureml-python-sdk><azuremlsdk> | 2024-03-17 18:52:19 | 1 | 15,302 | Evandro Pomatti |
78,176,271 | 11,628,437 | How does `pandas.concat` work when the input is a dictionary? | <p>I am struggling to understand how <code>pd.concat</code> works when the input is a dictionary.</p>
<p>Let's say we have the following pandas dataframe -</p>
<pre><code># Import pandas library
import pandas as pd
# initialize list of lists
data = [['tom', 10], ['nick', 15], ['juli', 14]]
# Create the pandas DataFra... | <python><pandas> | 2024-03-17 17:37:18 | 1 | 1,851 | desert_ranger |
78,176,092 | 17,800,932 | Wrapping and integrating an existing Python `socket`-based class with `asyncio` | <p>I have a use-case where there are a lot of TCP/IP clients being bundled up into a single Python process. The current desire is to use <code>asyncio</code> to provide concurrency for the program. For all <em>new</em> TCP/IP clients, <a href="https://docs.python.org/3/library/asyncio-stream.html" rel="nofollow norefer... | <python><tcp><python-asyncio><python-sockets> | 2024-03-17 16:44:26 | 1 | 908 | bmitc |
78,175,724 | 1,537,003 | ChromaDB: How to check if collection exists? | <p>I want to create a script that recreates a chromadb collection - delete previous version and creates a new from scratch.</p>
<pre><code>client.delete_collection(name=COLLECTION_NAME)
collection = client.create_collection(
name=COLLECTION_NAME,
embedding_function=embedding_func,
metadata={"hnsw:space... | <python><chromadb> | 2024-03-17 14:58:58 | 4 | 2,059 | Michal |
78,175,707 | 3,577,054 | How to find a particular exception inside the traceback using pytest | <p>Having a <code>test_raises</code> test like this, which checks that <code>ValueError</code> was raised using <a href="https://docs.pytest.org/en/4.6.x/reference.html#pytest-raises" rel="nofollow noreferrer"><code>pytest.raises</code></a>:</p>
<pre class="lang-py prettyprint-override"><code>import pytest
def foo():... | <python><pytest> | 2024-03-17 14:53:16 | 1 | 15,051 | Peque |
78,175,561 | 14,364,775 | How to process data in chunks(Pandas)? | <p>I have a function:</p>
<pre><code>def extract_named_entities(note):
"""
Extract the named entities identified in a given note.
"""
doc = nlp(note)
return [ent.text for ent in doc.ents]
df['named_entities'] = df['NOTE'].apply(extract_named_entities)
e_df = df.explod... | <python><python-3.x><pandas> | 2024-03-17 14:12:08 | 1 | 1,018 | Rikky Bhai |
78,175,528 | 2,338,792 | Getting ImportError When running EXE created by pyInstaller | <p>I'm using numpy in a python code, it runs successfully when running it as python. But when converting it to executable using pyInstaller, I get the following error:</p>
<pre><code>Traceback (most recent call last):
File "numpy\core\__init__.py", line 24, in <module>
File "PyInstaller\loader\... | <python><numpy><pyinstaller> | 2024-03-17 13:59:50 | 0 | 2,354 | DavidS |
78,175,445 | 17,889,328 | change pydantic 'extra=' behaviour per call | <p>i want to define a pydantic BaseModel with extra='forbid', and then in specific places validate objects i know will have extras, while still disallowing them if not specified - is this possible?</p>
<p>if not what's most concise or generally recommended approach? intermediate class? classmethod on the model? typeada... | <python><pydantic> | 2024-03-17 13:34:03 | 1 | 704 | prosody |
78,175,314 | 386,861 | Solving upside plot and projection problems in Geopandas and Altair | <p>I'm trying to plot a multi-layered map of London using some data from the ONS.</p>
<pre><code>import geopandas as gpd
from shapely import wkt
# Convert the 'geometry' column to shapely geometry objects
london_wards_shp['geometry'] = london_wards_shp['geometry'].apply(wkt.loads)
london_wards_gpd = gpd.GeoDataFrame(l... | <python><geopandas><altair> | 2024-03-17 12:53:14 | 2 | 7,882 | elksie5000 |
78,175,287 | 8,964,393 | How to train a linear regression for each pandas dataframe row and generate the slope | <p>I have created the following pandas dataframe:</p>
<pre><code>import numpy as np
import pandas as pd
ds = {'col1' : [11,22,33,24,15,6,7,68,79,10,161,12,113,147,115]}
df = pd.DataFrame(data=ds)
predFeature = []
for i in range(len(df)):
predFeature.append(0)
predFeature[i] = predFeature[i-1]+1
df['pred... | <python><pandas><dataframe><linear-regression><coefficients> | 2024-03-17 12:45:19 | 1 | 1,762 | Giampaolo Levorato |
78,175,235 | 710,734 | Get the sorted elements using pre-computed sort only | <p>Looking for the following algorithm.</p>
<p>Given for example the following unordered list:</p>
<pre><code>main_list = np.array([100,200,400,1000,800,900,700,600,500,300])
</code></pre>
<p>and given the query list elements <code>q = np.array([2,5,7,9])</code>, that correspond to the list <code>np.array([400, 900, 60... | <python><algorithm><numpy><sorting> | 2024-03-17 12:29:15 | 2 | 3,124 | Miguel |
78,175,233 | 11,628,437 | Can I create a nested column pandas dataframe using a nested dictionary? | <p>I am trying to think out of the box here, and my idea might be really bad. Feel free to point out better alternatives. I want to create a nested column pandas dataframe, both for visualization and analysis purposes. The output should look like this -</p>
<pre><code> Marks
Physics | Biology
Theo|P... | <python><pandas> | 2024-03-17 12:29:00 | 1 | 1,851 | desert_ranger |
78,175,064 | 20,830,264 | Error on getting the xref of an image with PyMuPDF using page.get_text("dict")["blocks"] | <p>With the following Python function I'm trying to extract text and images from a pdf document. Also, I want to put a label like <code>f"<<<image_{image_counter}>>>"</code> in the extracted text at the exact location of the corresponding image.
This is the Python function I have:</p>
<pre c... | <python><pdf><pymupdf> | 2024-03-17 11:36:39 | 1 | 315 | Gregory |
78,174,891 | 4,262,057 | How do I generate embeddings for dicts (not text) for Vertex AI Search? | <p>I am trying to generate and store vector embeddings in my GCS bucket such that they can be accessed by Vector AI Search to find the most similar items.</p>
<p>Following <a href="https://cloud.google.com/vertex-ai/docs/vector-search/overview" rel="nofollow noreferrer">this official tutorial</a>, they mention that the... | <python><google-cloud-platform><google-cloud-vertex-ai><vector-search><google-generativeai> | 2024-03-17 10:41:22 | 1 | 7,054 | WJA |
78,174,526 | 1,753,273 | Assertion Failure in SWI-Prolog When Using pyswip to Consult a Prolog File | <p>I'm working on a project where I use pyswip to integrate SWI-Prolog with Python. As someone new to Prolog programming, I've encountered an assertion failure when attempting to consult a Prolog file using pyswip. The error occurs specifically at the prolog.consult("/mnt/data/Dynamic_aci_assignment_PS2.pl") ... | <python><list><prolog><swi-prolog> | 2024-03-17 08:25:20 | 1 | 594 | agaonsindhe |
78,174,454 | 5,102,848 | How to implement continuous scroll using Selenium + Python | <p>Using Selenium in Python, I would like to load the entirety of a JS generated list from this webpage: <a href="https://partechpartners.com/companies" rel="nofollow noreferrer">https://partechpartners.com/companies</a>. There is a 'LOAD MORE' button at the bottom.</p>
<p>The code I've written to press the button (it ... | <python><selenium-webdriver> | 2024-03-17 07:57:27 | 1 | 410 | tktk234 |
78,174,202 | 130,208 | in python code, Is this a proper place to use dependency injection -- if so, how | <p>The code setup is as follows:</p>
<ul>
<li>Module ui_theme.py defines a theme and variant selector.</li>
<li>variant_selector has an on_change event handler.</li>
<li>Module cards_page.py imports ui_theme.py
and has a handler on_variant_change.</li>
</ul>
<p>Now, what I want to achieve that when ui_theme.on_change e... | <python><dependency-injection><callback><eventhandler> | 2024-03-17 05:52:49 | 1 | 2,065 | Kabira K |
78,174,069 | 1,736,389 | How to expand macros with python and libclang | <p>Say I have the following C code.</p>
<pre class="lang-c prettyprint-override"><code>#define A 0x1800
#define MACRO_FUNC(in) (A | (in))
#define B 6
#define MY_MACRO MACRO_FUNC(B)
</code></pre>
<p>How would I use <code>libclang</code> python bindings to expand <code>MY_MACRO</code> to <code>(0x1800 | (6))</code> or... | <python><c><libclang> | 2024-03-17 04:29:59 | 0 | 741 | Sam P |
78,174,062 | 1,606,657 | How to use a generic class type in combination with a function return type? | <p>Why is this type hint not working?</p>
<pre><code>from typing import Generic, TypeVar
from dataclasses import dataclass
V = TypeVar('V', int, str)
@dataclass
class Test(Generic[V]):
a: V
class Base(Generic[V]):
def test(self) -> Test[V]:
t = '1'
return Test[V](t)
b = Base[str]()
b... | <python><mypy><python-typing> | 2024-03-17 04:26:32 | 1 | 6,352 | wasp256 |
78,174,010 | 829,782 | What is the most efficient method to get the last modification time of every file in a git revision? | <p>I want to programmatically list the name and last modification time of every file in a certain revision.
Running <code>git log</code> for every file, <a href="https://serverfault.com/questions/401437/how-to-retrieve-the-last-modification-date-of-all-files-in-a-git-repository">as suggested here</a> is very slow.
Is t... | <python><git><time> | 2024-03-17 03:55:29 | 3 | 386 | maarten |
78,173,977 | 12,139,738 | How Can I Apply Custom Corner Radius to an Image Inside a CTkFrame Using customtkinter in Python? | <p>I'm currently working on a Python project using <code>customtkinter</code>, and I'm facing an issue with applying a custom corner radius to an image inside a <code>CTkFrame</code>. Here's a minimal example of my code:</p>
<pre class="lang-py prettyprint-override"><code>import customtkinter
from PIL import Image
ima... | <python><tkinter><customtkinter> | 2024-03-17 03:29:15 | 2 | 391 | DYD |
78,173,925 | 525,865 | BeautifulSoup-scraper runs well and robust some times - but otherwhile it fails :: probably some more exception-handling needed here? | <p>For some reason this clutch.co scraper is working propperly if i run it on one site</p>
<ol>
<li><strong>a.</strong> <a href="https://clutch.co/us/web-developers" rel="nofollow noreferrer">https://clutch.co/us/web-developers</a> - the us-category: it works awesome</li>
<li><strong>b.</strong> <a href="https://clutch... | <python><pandas><dataframe><beautifulsoup><request> | 2024-03-17 02:35:40 | 2 | 1,223 | zero |
78,173,697 | 11,793,491 | Replace values with assign in pandas | <p>I have this data frame:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({'Address': ['234 JALAN ST KULAR LUMPUR MALAYSIA',
'123 BUILDING STREET SINGAPORE',
'67 CANNING VALE, HONG KONG',
np.nan]})
df
... | <python><pandas> | 2024-03-17 00:04:00 | 2 | 2,304 | Alexis |
78,173,436 | 727,238 | Inspecting Python operation: how to get all decorators literally? | <p>I'm inspecting code in runtime. I want to get all decorators a function/method is decorated with. For example, if it is <code>@classmethod</code> I want to get just the string: <strong>"@classmethod"</strong>, if it is something like <code>@path(MyClass.myop)</code> I want to get the string <strong>"@... | <python><decorator> | 2024-03-16 22:04:48 | 1 | 2,071 | ardabro |
78,173,316 | 2,386,605 | Scholarly package does return cropped output | <p>I try to fetch some papers via scholarly, which works nicely. However, when I run</p>
<pre><code>from scholarly import scholarly
from pprint import pprint
search_query = scholarly.search_pubs(query='Perception of physical stability and center of mass of 3D objects', year_low=2010)
pprint(next(search_query))
</code>... | <python><python-3.x><google-scholar> | 2024-03-16 21:07:47 | 0 | 879 | tobias |
78,173,209 | 547,231 | How to save an `exr` from a pytorch tensor in Python? | <p>Previously, there was a function <code>torchvision.utils.save_float_image</code> with which it was possible to store an <code>.exr</code> file from a pytorch tensor. This function is gone in the current relase (0.17). Now, there is only the function <code>torchvision.utils.save_image</code> (<a href="https://pytorch... | <python><python-3.x><pytorch> | 2024-03-16 20:26:42 | 1 | 18,343 | 0xbadf00d |
78,173,203 | 547,231 | Increment a float pointer in Python | <p>I have a <code>float</code> pointer <code>p</code> from a C++ library which I want to increment in a Python module. When I try to write <code>p + distance</code>, I'm receiving the error that the operator <code>+</code> would be undefined for <code>LP_c_float</code>.</p>
<p>A possible solution is to use <code>advanc... | <python><python-3.x><ctypes> | 2024-03-16 20:23:30 | 1 | 18,343 | 0xbadf00d |
78,173,150 | 2,382,141 | AttributeError: module 'keras.src.backend' has no attribute 'Variable' with Dropout layer | <p>I'm trying to re-use a neural network for sound classification but keras give an error:
AttributeError: module 'keras.src.backend' has no attribute 'Variable'.
May it be a compatibility problem?
I'm using keras v3.0.5.
This is my code:</p>
<pre><code>import numpy as np
from keras.models import Sequential
from keras.... | <python><tensorflow><keras><neural-network> | 2024-03-16 20:00:18 | 1 | 348 | Giuseppe Ricci |
78,173,000 | 11,748,924 | Numpythonic way to perform vector substraction where the operands has different shape each other (a,n) - (b,n) | <p>I have two matrix operand like these:</p>
<pre><code>a = np.array([[1,2], [3,4], [5,6], [7,8]])
b = np.array([[9,10], [11,12], [13,14]])
</code></pre>
<p>If we debug <code>a</code> and <code>b</code>, they will look like these:</p>
<pre><code>[[1 2]
[3 4]
[5 6]
[7 8]]
(4, 2)
int32
[[ 9 10]
[11 12]
[13 14]]
(3,... | <python><numpy><multidimensional-array><tensor> | 2024-03-16 19:06:22 | 2 | 1,252 | Muhammad Ikhwan Perwira |
78,172,715 | 7,846,884 | how to generate linear X Y data to regression practice in Python | <p>Que: how can i get linear relation between each features/independent variables (X) and target (Y). Both X and Y must be real-values.</p>
<p>But my plot shows only 1/10 features is linearly associated with my target.</p>
<p>Pls see code to generate data with true coefficients to test linear regression with SGD
i foun... | <python><numpy><linear-regression> | 2024-03-16 17:27:24 | 1 | 473 | sahuno |
78,172,548 | 1,916,588 | Mock only one attribute of all instances of a class | <p>I have these 3 modules:</p>
<pre class="lang-py prettyprint-override"><code># config.py
class Config:
def __init__(self):
self.some_attribute = "some value" # <-- I want to mock this attribute
self.another_attribute = 123
</code></pre>
<pre class="lang-py prettyprint-override"><code... | <python><unit-testing><mocking> | 2024-03-16 16:38:09 | 1 | 12,676 | Kurt Bourbaki |
78,172,478 | 4,639,580 | How to obtain data from two tables and that two table join using Foreign-key in the Django rest framework | <p>I am quite new to Django. I'm writing and app using Vue3 in the frontend and Django5 in the backend. I've implemented login already, but I want the user returning to contain the role, that happens to be in another table, and I just get the id.</p>
<p>My Django models:</p>
<pre class="lang-py prettyprint-override"><c... | <python><django><django-rest-framework> | 2024-03-16 16:14:31 | 1 | 619 | Dairelys García Rivas |
78,172,031 | 339,144 | How to obtain an exception with a `__traceback__` attribute that contains the stack outside a `try` | <p>It seems that in Python (3.10) an exception that is raised inside a <code>try</code> contains a traceback that does not extend to the calling location of the <code>try</code>.
This is somewhat surprising to me, and more importantly, not what I want.</p>
<p>Here's a short program that illustrates the problem:</p>
<pr... | <python><python-3.x> | 2024-03-16 13:55:47 | 2 | 2,577 | Klaas van Schelven |
78,171,843 | 525,865 | OpenStreetMap: concatenate a request into a loop that iterates over each 3166 country code, parse response into DF with Python | <p>i am currently working on a combined request that runs on the API-end of Overpass-Turbo: the aim is to concatenate a request like the following;</p>
<pre><code>[out:csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website&qu... | <python><pandas><dataframe><request><openstreetmap> | 2024-03-16 12:55:58 | 1 | 1,223 | zero |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.