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 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,828,089 | 812,102 | Setting DynamicMap as stream source | <p>In the following MWE, clicking on a point of the scatter plot should show its index in the "debug" textbox. It does when the layout is <code>scatter * dmap</code>, it doesn’t when the layout is simply <code>dmap</code>. Indeed, <code>scatter</code> being the source of the <code>Selection1D</code> stream,... | <python><panel><holoviews><holoviz-panel> | 2024-01-16 18:49:13 | 1 | 7,852 | Skippy le Grand Gourou |
77,827,982 | 11,357,623 | Python generate documentation using pydoc | <p>I have nested folder structure library and the question is about generating documentation from the source-code files.</p>
<h1>Folder Structure</h1>
<pre><code> mylib
├── foo
├── __init__.py
│ ├── Foo.py
├── bar
│ ├── __init__py
│ ├── Bar.py
├── baz
│ ├── qux
... | <python><pydoc> | 2024-01-16 18:31:28 | 0 | 2,180 | AppDeveloper |
77,827,945 | 13,930,389 | Get maximum and minimum theoretical output from xgboost classifier | <p>Assume I have a trained XGBClassifier object (the sklearn interface). How could I determine what is the highest possible output the model could provide, in terms of the output from model.predict_proba(input)[:,1]? That is, the probability of the class 1 in a binary classification problem.</p>
<p>Of course, I know th... | <python><xgboost> | 2024-01-16 18:23:58 | 1 | 1,781 | eduardokapp |
77,827,800 | 14,566,295 | Failing to apply negative lookahead to select column using regex | <p>I have the below Pandas dataframe:</p>
<pre><code>import pandas as pd
dat1 = pd.DataFrame({'col1' : ['A', 'B', 'A', 'C'], 'col2_y' : ['Z', 'Z', 'X', 'Y']})
dat1.filter(regex = "(?!_y)")
</code></pre>
<p>I want to select the columns which do NOT contain <code>"_y"</code>. However the above code is... | <python><python-3.x><pandas><regex><python-re> | 2024-01-16 17:58:59 | 1 | 1,679 | Brian Smith |
77,827,769 | 991,077 | Applying conditional rate limiting decorator for async class method | <p>I am using <code>ccxt</code> library for downloading OHLC data from various crypto exchanges. This is done internally using REST requests. These exchanges have different request rate limits, so I have to apply rate limiting to my methods. For rate limiting I use the library <code>limiter</code>. Here is what I have ... | <python><python-asyncio><python-decorators><rate-limiting><ccxt> | 2024-01-16 17:53:44 | 1 | 734 | shda |
77,827,719 | 8,231,100 | Python Memory Leak - Scikit-learn + Numpy | <p>Can't seem to fix my memory leak, I managed to replicate it easily. I seems to happen when i use sklearn GaussianMixture multiple times, while varying the the number of training pixels I give it.</p>
<p>This code <strong>does not</strong> leak:</p>
<pre><code>import os, psutil
from sklearn import mixture
import nump... | <python><numpy><scikit-learn><memory-management><memory-leaks> | 2024-01-16 17:44:53 | 0 | 365 | Adrien Nivaggioli |
77,827,689 | 1,911,036 | OpenCV python slow performance in Win10 | <p>I have a simple code that works much slower in Win10, and fast as hell in Linux.
The code returns the sum of all pixel intensity for all frames in video file.
Unfortunately, I must run it in Win10, so I'd like to know the reason for such a slowdown.
I have tried different CPUs, but that's not the case.</p>
<p>In Win... | <python><linux><opencv><user-interface> | 2024-01-16 17:39:35 | 0 | 333 | Viktor |
77,827,677 | 12,603,110 | Sympy how to symbolically change of variables for derivatives? | <p>Given</p>
<pre><code>x = x_c * chi
t = t_c * tau
</code></pre>
<p>expressing dx/dt in chi, tau is: x_c/t_c * dchi / dtau<br />
<a href="https://www.wikiwand.com/en/Nondimensionalization#Conventions" rel="nofollow noreferrer">https://www.wikiwand.com/en/Nondimensionalization#Conventions</a></p>
<p>How to evaluate the... | <python><sympy><derivative> | 2024-01-16 17:38:08 | 0 | 812 | Yorai Levi |
77,827,499 | 5,506,167 | Why python uses predictable hashes for numbers? | <p>The <a href="https://docs.python.org/3/reference/datamodel.html#object.__hash__" rel="nofollow noreferrer">Python doc</a> says:</p>
<blockquote>
<p>By default, the <code>__hash__()</code> values of <strong>str and bytes</strong> objects are “salted” with an unpredictable random value. Although they remain constant w... | <python><security><hash> | 2024-01-16 17:04:35 | 1 | 1,962 | Saleh |
77,827,315 | 4,340,985 | How to use seaborn.clustermap with large (20 000 entries) data sets? | <p>I'm working a lot with <a href="https://seaborn.pydata.org/generated/seaborn.clustermap.html#seaborn-clustermap" rel="nofollow noreferrer"><code>sns.clustermap</code></a> and I'm quite enjoying it as an easy tool to get an overview over a large amount of data (time series data in my case, a few hundred entries mostl... | <python><seaborn><cluster-analysis> | 2024-01-16 16:31:40 | 2 | 2,668 | JC_CL |
77,827,305 | 2,289,030 | How to prevent attribute re-access until all attributes have been accessed once (Python metaclass)? | <p>I have a list of attributes, say <code>["foo", "bar", "baz"]</code>, and I want to write a metaclass which ensures the following properties:</p>
<ul>
<li>They can all be accessed once, in any order</li>
<li>They cannot be accessed again until all have been accessed once</li>
</ul>
<p>Fo... | <python><metaclass> | 2024-01-16 16:30:22 | 2 | 968 | ijustlovemath |
77,827,172 | 1,980,630 | Setup a conversion rate in pint in python | <p>I have this problem I'd like to solve with python pint.</p>
<ul>
<li>0.29 points / minutes</li>
<li>118 points / (17.35 usd)</li>
<li>How much is 5 minutes in usd ?</li>
</ul>
<p>I have then 2 new abstract units "points" and "usd" and reuse the "time" unit "minute".</p>
<p>I ... | <python><pint> | 2024-01-16 16:09:29 | 1 | 768 | Robert Vanden Eynde |
77,827,144 | 7,051,394 | Use a custom font with pycairo | <p>I'm using Pycairo to draw images with text on it, with a custom font.
This works well as long as that font is installed on the system.</p>
<p>However, I would like to distribute my package with my custom font attached as a data file (ttf or any other type), and to have my code refer to that file rather than assume t... | <python><fonts><cairo><pycairo> | 2024-01-16 16:04:34 | 1 | 16,957 | Right leg |
77,827,003 | 21,440,451 | Is it possible to specify route as an empty string in Azure function for Python? | <p>I try to have a "vanilla path" in my API. I've tried to decorate my function by each of the following.</p>
<pre><code>@app.route(route="")
@app.route(route=None)
@app.route()
@app.route(route="/")
</code></pre>
<p>It's not of interest to modify the route using <code>function.json</co... | <python><azure><azure-functions> | 2024-01-16 15:44:02 | 1 | 492 | danilo |
77,826,967 | 22,466,650 | How to reorganize two pairs of columns and choose the order as well? | <p>My input is a dataframe :</p>
<pre><code>import pandas as pd
import numpy as np
df = pd.DataFrame({'node1': ['_abc-1', 'xyz-1', 'abc-1', '-xyz-2', 'xyz-2', 'abc-2'],
'p1': [1, 10, 3, 1, 2, 6],
'p2': [9, 2, 11, 4, 5, 3],
'node2': ['xyz-1', 'abc-1', '-xyz-1', 'def-2', 'def-2', '-xyz-1']})
# print(df)
# node1... | <python><pandas> | 2024-01-16 15:38:24 | 1 | 1,085 | VERBOSE |
77,826,914 | 385,390 | Register image onto a smaller, partial, image but with some common features | <p>I want to transform images of written text (taken by a mobile phone camera with different 3D rotation, scale etc.) so that they look "orthogonal" (by this I mean as if you read them from a ebook reader). My next step will be to OCR these images and I want them not to be affected by camera rotation.</p>
<p>... | <python><opencv><image-processing><computer-vision><affinetransform> | 2024-01-16 15:29:58 | 1 | 1,181 | bliako |
77,826,628 | 2,891,152 | Compute maximum number of consecutive identical integers in array column | <p>Consider the following:</p>
<pre><code>df = spark.createDataFrame([
[0, [1, 1, 4, 4, 4]],
[1, [3, 2, 2, -4]],
[2, [1, 1, 5, 5]],
[3, [-1, -9, -9, -9, -9]]]
,
['id', 'array_col']
)
df.show()
'''
+---+--------------------+
| id| array_col|
+---+--------------------+
| 0| [1, 1, ... | <python><sql><pyspark> | 2024-01-16 14:51:26 | 2 | 456 | L.B. |
77,826,532 | 7,626,061 | Fastest method to read from stdin in python, for competitive programming? | <p>A few days ago I stumbled with a problem in competitive programming which has never been solved in Python. It's because that problem has a too big input and Python seems to be very slow in reading from stdin (standard input). The input consists of a sequence of integers separated by just one character, which will be... | <python> | 2024-01-16 14:37:03 | 1 | 530 | Murilo Perrone |
77,826,406 | 9,779,999 | want to install peft and accelerate compatible with torch 1.9.0+cu111 | <p>i want to install peft and accelerate:
!pip install -q git+https://github.com/huggingface/peft.git
!pip install -q git+https://github.com/huggingface/accelerate.git</p>
<p>But as my torch version is 1.9.0+cu111, the latest accelerate doesn't support my torch version.</p>
<ul>
<li>The latest accelerate 0.27.0.dev0 re... | <python><pytorch><gpu><large-language-model> | 2024-01-16 14:18:24 | 1 | 1,669 | yts61 |
77,826,404 | 707,519 | else block not invoked when there is no exception in wrapped function | <p>In below code, when there is no exception raised from <code>bar</code>, I am expecting the <code>else</code> block of decorator to be called, but this is not happening.</p>
<pre><code>#!/usr/bin/python
from functools import wraps
def handle_exceptions(func):
@wraps(func)
def wrapper(*arg, **kwargs):
... | <python><python-decorators><try-except> | 2024-01-16 14:18:17 | 1 | 2,348 | m.divya.mohan |
77,826,204 | 12,518,487 | Error when trying to remove Lease from file using Azure Python SDK | <p>I'm facing some issues when trying to break a lease on file in Azure Storage Account using the code below.</p>
<pre><code>from azure.identity import DefaultAzureCredential, AzureCliCredential, ChainedTokenCredential, ClientSecretCredential
from azure.storage.blob import BlobServiceClient, BlobClient, BlobLeaseClient... | <python><azure><databricks><azure-storage-account> | 2024-01-16 13:49:14 | 1 | 4,125 | rmesteves |
77,826,191 | 21,185,825 | pyautogui - pass parameters to hotkey? | <p>The keys I want <strong>pyautogui</strong> to press <strong>come from a string</strong>, that is parsed to an array</p>
<p>so instead of doing this:</p>
<pre><code>pyautogui.hotkey('alt','f')
</code></pre>
<p>I tried this:</p>
<pre><code>keys = "alt+f" # comes from config file
sub_keys = keys.split("+... | <python><pyautogui> | 2024-01-16 13:46:41 | 1 | 511 | pf12345678910 |
77,826,156 | 1,815,577 | PyInstaller with Playwright and Firefox | <p>I'm having trouble using PyInstaller to package a script that uses Playwright with the Firefox driver.</p>
<p>This is what the Python looks like (bare minimum):</p>
<pre class="lang-py prettyprint-override"><code>import time
from playwright.sync_api import sync_playwright, TimeoutError
with sync_playwright() as p:
... | <python><firefox><playwright> | 2024-01-16 13:39:45 | 1 | 6,802 | datawookie |
77,826,141 | 22,054,564 | Status is 200 OK but the response is empty in Azure Functions (.NET 6) with Python Executable Application | <p>Python File:</p>
<pre class="lang-py prettyprint-override"><code>num1 = 1.5
num2 = 6.3
sum = num1 + num2
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
</code></pre>
<p>Azure Functions - .NET 6:</p>
<pre><code>using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc... | <python><c#><azure><azure-functions><.net-6.0> | 2024-01-16 13:36:56 | 0 | 837 | VivekAnandChakravarthy |
77,826,003 | 6,402,099 | Custom class that inherits LGBMClassifier doesn't work: KeyError: 'random_state' | <p>I create a random dataset to train a <code>LGBM</code> model:</p>
<pre class="lang-py prettyprint-override"><code>from sklearn.datasets import make_classification
X, y = make_classification()
</code></pre>
<p>Then I train and predict the original LGBM model with no issues:</p>
<pre class="lang-py prettyprint-overri... | <python><scikit-learn><lightgbm> | 2024-01-16 13:16:32 | 2 | 1,775 | emremrah |
77,825,815 | 1,738,879 | `ModuleNotFoundError` with custom Python project layout | <p>I'm trying to setup a python project following a structure that is shown <a href="https://realpython.com/python-application-layouts/#application-with-internal-packages" rel="nofollow noreferrer">here</a>. In my case, I have:</p>
<pre><code>.
└── helloworld/
├── hello/
│ ├── hello.py
│ └── __init__.py... | <python><python-3.x><project-layout> | 2024-01-16 12:41:51 | 2 | 1,925 | PedroA |
77,825,701 | 7,298,014 | Python Efficient conversion of time strings in multiple dimensions to datetime objects | <p>I want to convert the string date values inside a xarray DataArray to datetime index or python datetime object.
For example, lets take the DataArray</p>
<pre><code>import xarray as xr
import pandas as pd
b = np.asarray(['2020-01-01T09:41:54.647000Z', '2020-01-01T09:41:55.487000Z',
'2020-01-01T09:41:56.327000Z... | <python><pandas><datetime><python-xarray> | 2024-01-16 12:18:19 | 1 | 1,652 | Vinod Kumar |
77,825,699 | 3,801,239 | opencv python imutils.grab_contours and sorted methods are not available in java/scala api my scala code implementation does't produce same results | <p>i am new to OpenCV and following this <a href="https://pyimagesearch.com/2015/11/30/detecting-machine-readable-zones-in-passport-images/" rel="nofollow noreferrer">tutorial</a>
here is the Python code</p>
<pre><code> from imutils import paths
import numpy as np
import imutils
import cv2
import os
re... | <python><scala><opencv><computer-vision><imutils> | 2024-01-16 12:17:51 | 0 | 3,525 | sarah w |
77,825,485 | 1,334,609 | pexpect: failed to get the string after the marker | <p>Below is the code I used, I want to use pexpect to get the entire output of a commmand running in a ssh section:</p>
<p>I have tried many ways to get the output of the command, but it always return the string before the marker, i can't get the string after the marker, I need to get the entire output of the command. ... | <python><pexpect> | 2024-01-16 11:39:16 | 0 | 441 | user1334609 |
77,825,283 | 5,834,711 | How to use multiprocessing in geo pandas and intersection procedures by dividing the database in parts? | <p>I use the following code in a MAC OS with 8 cores. But when the procedure is running I see that Python uses only one core. How I could divide the land use database in e.g. 6 parts and run intersections in each core separately? And then combine the results?</p>
<pre><code>import os
import geopandas as gpd
from pathli... | <python><multiprocessing><geopandas> | 2024-01-16 11:02:44 | 2 | 345 | Nat |
77,825,266 | 4,540,866 | Streamlit state management does not work for text input field | <p>The goal is to build a Streamlit app where data is rendered based on the selected group. The user can type the group or use the "next group" button. I have 2 approaches but they both have issues.</p>
<h1>Approach 1</h1>
<pre class="lang-py prettyprint-override"><code>import streamlit as st
groups = [1,2,3... | <python><streamlit> | 2024-01-16 11:00:20 | 1 | 480 | Vlad Gheorghe |
77,825,112 | 4,035,257 | Filtering data based on boolean columns in python | <p>I have the following pandas dataframe and I would like a function that returns the ID's data with at least 1 True value in <code>bool_1</code>, 2 True values in <code>bool_2</code> and 3 True values in <code>bool_3</code> column, using the <code>groupby</code> function.</p>
<pre><code>index ID bool_1 bool_2 bool... | <python><pandas><group-by><filtering> | 2024-01-16 10:37:37 | 3 | 362 | Telis |
77,824,906 | 532,054 | Apple Store Server Notification: Python OpenSSL certificate loading fails in "header too long" | <p>On my django server, I'm trying to decode the JWT content sent by the Apple Store Server Notification using Apple's package <code>app-store-server-library-python</code>.</p>
<p>Under the <a href="https://github.com/apple/app-store-server-library-python" rel="nofollow noreferrer">official documentation</a>, when star... | <python><django><cryptography><decoding> | 2024-01-16 10:05:21 | 2 | 1,771 | lorenzo |
77,824,830 | 17,914,734 | How to colour the outer ring (like a doughnut plot) in a radar plot according to column values | <p>I have data in this form :</p>
<pre><code>data = {'Letter': ['A', 'B', 'C', 'D', 'E'],
'Type': ['Apples', 'Apples', 'Oranges', 'Oranges', 'Bananas'],
'Value': [1, 2, 0, 5, 6]}
df = pd.DataFrame(data)
</code></pre>
<p>I want to combine a doughnut plot and a radar plot, where the outer ring will be ... | <python><pandas><matplotlib> | 2024-01-16 09:55:02 | 1 | 309 | zorals |
77,824,635 | 5,008,968 | How to install PyQt4 in 2024 on Ubuntu (to run an old project)? | <p>In 2016/2017, when PyQt4 was still supported, I <a href="https://github.com/Hamza5/TALN-Quran/" rel="nofollow noreferrer">made a project</a> based on <strong>Python 3</strong> (not sure about the exact version, maybe 3.4), <strong>PyQt4</strong>, <strong>Numpy</strong>, and <strong>Matplotlib</strong> (Unfortunately... | <python><python-3.x><pyqt><pyqt4><python-3.4> | 2024-01-16 09:21:18 | 1 | 706 | Hamza Abbad |
77,824,610 | 2,339,525 | Python webscraper not scraping the latest information | <p>Work requires us to be up to date on developments in regards to customs regulations. Instead of manually going to websites I attempted to create a simple webscraper that goes to defined websites, gets the latest items there and writes them to an excel file.</p>
<pre><code>import requests
import pandas as pd
import r... | <python><web-scraping><beautifulsoup><python-requests> | 2024-01-16 09:15:38 | 1 | 820 | Marco Geertsma |
77,824,468 | 7,489,397 | How to write a python test for environment variable that is loaded on import | <p>I want to test how system behaves while changing initial environmenet variable.</p>
<p>the_file.py:</p>
<pre class="lang-py prettyprint-override"><code>import os
from fastapi import APIRouter
PREFIX = os.getenv("SERVICE_PREFIX") or "/default"
router = APIRouter(prefix=PREFIX)
</code></pre>
<p>... | <python><pytest><python-unittest> | 2024-01-16 08:50:49 | 1 | 979 | The Hog |
77,824,427 | 1,582,790 | python class variable not updated when passed to new Process | <p>Why doesn't a new Process get the updated class attr value (in Windows btw). (It's the same if the attr was just a str). I'm guessing the 3rd case worked because assignment gave it a <em>instance</em> attr.</p>
<p><a href="https://stackoverflow.com/a/7525883/1582790">https://stackoverflow.com/a/7525883/1582790</a> T... | <python><process><multiprocessing><static-members><class-variables> | 2024-01-16 08:39:50 | 0 | 1,324 | TurtleTread |
77,824,316 | 8,176,763 | display dropdown options in fastapi without using enum type | <p>I am trying to display options in fastapi auto generated documentation page, I can do for enum types as the documentation suggests here <a href="https://fastapi.tiangolo.com/tutorial/path-params/#create-an-enum-class" rel="nofollow noreferrer">https://fastapi.tiangolo.com/tutorial/path-params/#create-an-enum-class</... | <python><fastapi><pydantic> | 2024-01-16 08:20:26 | 1 | 2,459 | moth |
77,824,299 | 9,506,773 | 404 error when doing workload anlysis using locust on OpenAI API (GPT.35) | <p>I am trying to do some workload analysis on OpenAI GPT-3.5-TURBO using locust.</p>
<pre class="lang-py prettyprint-override"><code>from locust import HttpUser, between, task
class OpenAIUser(HttpUser):
wait_time = between(1, 2) # wait between 1 and 2 seconds
host = "https://api.openai.com/"
... | <python><openai-api><locust> | 2024-01-16 08:15:24 | 1 | 3,629 | Mike B |
77,824,281 | 2,989,330 | "SSL certificate verify failed: self-signed certificate in certificate chain" when pip install | <p>I'm behind a company proxy with a self-signed certificate and I want to install <code>tensorstore</code> via <code>pip</code>. <code>pip</code> apparently downloads and runs a Python script <code>bazelisk.py</code> that in turn uses <code>urllib</code> to get more stuff from the Internet. However, this fails with a ... | <python><ssl><pip><self-signed> | 2024-01-16 08:11:57 | 2 | 3,203 | Green 绿色 |
77,824,174 | 7,396,306 | Using numpy random and pandas sample to make a random choice from a DF, not random distribution of choices after 100k runs | <p>I have made a small script for my D&D group that, when a spell is cast, chooses whether or not another random spell gets cast, the ordinal spell gets cast, or nothing happens (with a 50%, 25%, 25% ratio, respectively).</p>
<p>In order to do this, I made a <code>pd.DataFrame</code> of every possible spell in the ... | <python><pandas><numpy><random> | 2024-01-16 07:50:40 | 1 | 859 | DrakeMurdoch |
77,823,919 | 3,050,341 | Manim adding simple label updaters in loop | <p>I have two lists of <code>MObjects</code>: elements and labels.
I need to add an updater for every label to stay inside corresponding element.</p>
<p>So this is what I do:</p>
<pre class="lang-py prettyprint-override"><code>self.elements: list[Circle] = []
self.labels: list[Tex] = []
for i in range(5):
angle = ... | <python><manim> | 2024-01-16 06:55:25 | 1 | 3,111 | CMTV |
77,823,803 | 594,763 | how can I force specific mime types for python's http.server? | <p>I have a bunch of files without extensions, so http.server is serving them all as <code>application/octet-stream</code> and this is causing problems...</p>
<p>Rather than giving them extensions, I would like a way to define a dictionary that would be filename -> mimetype. And then have GET requests to http.serve... | <python><http.server> | 2024-01-16 06:29:06 | 1 | 9,814 | patrick |
77,823,712 | 23,002,898 | In Django how to compare two texts and print a message about correctness or error? | <p>I'm new to Django. In Django i would like to compare two texts, between frontend and backend, and receive a message if they are the same or different. In reality these two texts are two short HTML codes. The page can reload easily, I'm only interested in the logic and code behind comparing the two texts (and not the... | <python><html><python-3.x><django><django-views> | 2024-01-16 06:01:22 | 1 | 307 | Nodigap |
77,823,499 | 107,294 | How to get tox to use a Python interpreter on a specifc path | <p>I'm using tox version 4.12.0, and have <code>env_list = py{3.8,3.9}-pytest5</code>. This successfully finds and uses the OS-supplied Python 3.9 to run those tests, but skips testing with Python 3.8 because it can't find an interpreter. (This is correct behaviour so far: I have no Python 3.8 interpreter in my path an... | <python><tox> | 2024-01-16 04:38:35 | 1 | 27,842 | cjs |
77,823,233 | 1,492,229 | How to filter a dataframe based on another dataframes index | <p>I am building a ML Model</p>
<p>There is 2 datasets <code>X_test</code> and <code>y_test</code></p>
<p>Here how they look like</p>
<pre><code>X_test
Out[19]:
AJ3158003 SY0942007 WW3873005 ... LZ014003 QP4868006 RepID
9072 5 5 5 ... 0 0 292715
2296 1... | <python><dataframe> | 2024-01-16 02:48:12 | 0 | 8,150 | asmgx |
77,823,220 | 9,306,620 | Python: search for a list of substrings in a list of list of strings | <p>I'm following the post <a href="https://stackoverflow.com/questions/9316970/search-a-list-of-list-of-strings-for-a-list-of-strings-in-python-efficiently">Search a list of list of strings for a list of strings in python efficiently</a> and trying to search for a list of substrings in a list of list of strings. The ab... | <python><search> | 2024-01-16 02:42:30 | 2 | 1,041 | SoftwareDveloper |
77,823,105 | 7,663,420 | I am classifying each word in a sentence (Named Entity Recognition) but I receive ...an unexpected keyword argument 'grouped_entities' | <pre><code>sentence = 'American Airlines was the first airline to fly every A380 flight perfectly when President George Bush was in Office. The Woodlands Texas is a great place to be.'
ner = pipeline('text-classification', model='dbmdz/bert-large-cased-finetuned-conll03-english', grouped_entities=True)
ners = ner(sente... | <python><nlp><google-cloud-colab-enterprise> | 2024-01-16 01:47:34 | 1 | 303 | Nathaniel Hibbler |
77,823,058 | 3,719,459 | How create a 2-row table header with docutils | <p>I wrote an extension for Sphinx to read code coverage files and present them as a table in a Sphinx generated HTML documentation.</p>
<p><a href="https://i.sstatic.net/5VNdj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5VNdj.png" alt="enter image description here" /></a></p>
<p>Currently the table ... | <python><html-table><code-coverage><python-sphinx><docutils> | 2024-01-16 01:26:32 | 2 | 16,480 | Paebbels |
77,822,962 | 866,082 | How to manage datasets in MLflow? | <p>Consider the following code snippet taken from MLflow <a href="https://mlflow.org/docs/latest/python_api/mlflow.data.html#mlflow-data" rel="nofollow noreferrer">documentation page</a>:</p>
<pre class="lang-py prettyprint-override"><code>import mlflow.data
import pandas as pd
from mlflow.data.pandas_dataset import Pa... | <python><machine-learning><dataset><mlflow> | 2024-01-16 00:40:36 | 1 | 17,161 | Mehran |
77,822,824 | 181,105 | How to extend TSP to MTSP using Pulp | <p>We've studied TSP and now we're tasked to extend it for multiple salespersons.
Below code using PULP with my added logic which unfortunately does not work. It does not correctly identify the correct tours.</p>
<p>Eg. using below cost matrix:</p>
<pre><code>cost_matrix = [[ 0, 1, 3, 4],
[ 1, 0, 2, 3 ],
[ 3... | <python><pulp><traveling-salesman> | 2024-01-15 23:38:09 | 1 | 413 | Sys |
77,822,809 | 9,782,274 | pydantic: How to parse & validate a model from a string with the model attributes as names (not as python dict) | <p>I'm able to export records as a csv from my fastapi/sqlmodel/sqladmin backend. The sqladmin (backend panel) only allows limited configuration of the export format and I end up with the following export data for my many-to-many relationship called <strong>"assessed_in"</strong>:</p>
<pre><code>"[Period... | <python><fastapi><pydantic><sqlmodel> | 2024-01-15 23:30:33 | 0 | 397 | Simon |
77,822,594 | 3,358,488 | Python relative import not working even though root package name is being used | <p>I've read quite a bit about relative import's tricky aspects (especially <a href="https://stackoverflow.com/questions/14132789/relative-imports-for-the-trilli%D0%BEnth-time/14132912#14132912">this question</a>). However, the following example is still not working.</p>
<p>I have the following project (<a href="https:... | <python><relative-import> | 2024-01-15 22:16:59 | 2 | 5,872 | user118967 |
77,822,577 | 336,489 | Azure Function using v2 programming model for debugging | <p>I have inherited the following code in Azure Functions and I want to ensure if this correct and find out the correct way to call this utilizing Python Azure Functions v2 programming model.</p>
<pre><code>import os
import gnupg
import azure.functions as func
gpg = gnupg.GPG(gnupghome='/tmp')
class PGPDecryption:
de... | <python><azure><encryption><azure-functions><pgp> | 2024-01-15 22:12:35 | 1 | 5,130 | GilliVilla |
77,822,487 | 14,954,262 | Python go from a list of tuple to a list of integer without quotes | <p>I have this code :</p>
<pre><code>selected_listbox_select_criteria_column = [('0', 'firstName'),('1', 'lastName'),('2', 'phone')]
column_to_check_for_criteria = []
column_to_check_for_criteria(', '.join(elems[0] for elems in selected_listbox_select_criteria_column))
</code></pre>
<p>It gives me this result :</p>
<... | <python><list><integer><quotes> | 2024-01-15 21:46:07 | 4 | 399 | Nico44044 |
77,822,378 | 4,267,726 | Get buffer of line without joining itself in shapely | <p>I have a LineString which crosses itself (<code>LineString(...)</code>)
<a href="https://i.sstatic.net/dkk8z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dkk8z.png" alt="enter image description here" /></a></p>
<p>and make a Buffer out of it (<code>LineString().buffer(2, cap_style=BufferCapStyle.fl... | <python><shapely> | 2024-01-15 21:15:31 | 0 | 385 | harrow |
77,822,340 | 3,358,488 | Unittest discovery not working as expected | <p>I have the following project (<a href="https://github.com/rodrigodesalvobraz/UnittestDiscovery" rel="nofollow noreferrer">available on GitHub</a>):</p>
<p><a href="https://i.sstatic.net/MZYGE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MZYGE.png" alt="enter image description here" /></a></p>
<p>He... | <python><unit-testing> | 2024-01-15 21:06:27 | 1 | 5,872 | user118967 |
77,822,303 | 625,396 | For Python numpy.unique(ar, return_index=False) - indexes of unique are returned in the natural order ALWAYS? | <p>In Python numpy:
indexes returned by np.unique(a, return_index=True) - will ALWAYS come in natural order ?
I.e. we get the FIRST occurrence of element as first index ? Or the order can be arbitrary ?</p>
<p>In most examples I tried - the order is natural, but just want to confirm it is ALWAYS the case ?</p>
<p>Examp... | <python><numpy> | 2024-01-15 20:58:01 | 1 | 974 | Alexander Chervov |
77,822,220 | 15,148,870 | Python - remove commas and leave decimal points from string as number | <p>As of title, I need to remove commas from string number and leave decimal point, but the problem is input can be with <code>.</code> or <code>,</code>. This input will be saved for Django model's <code>DecimalField</code></p>
<p>For example:</p>
<h5>Input:</h5>
<p>"250,000,50"<br />
"250,000"<br ... | <python><python-3.x><django><regex> | 2024-01-15 20:35:23 | 1 | 328 | Saidamir |
77,822,202 | 900,394 | How to add a dense layer on top of SentenceTransformer? | <p>In this tutorial (<a href="https://huggingface.co/blog/how-to-train-sentence-transformers" rel="nofollow noreferrer">Train and Fine-Tune Sentence Transformers Models</a>) they go through creating a SentenceTransformer by combining a word embedding module with a pooling layer:</p>
<pre><code>from sentence_transformer... | <python><nlp><huggingface-transformers><sentence-transformers> | 2024-01-15 20:29:40 | 1 | 5,382 | Alaa M. |
77,822,172 | 6,419,736 | CRC with bit-wise operations in Dart | <p>I am having trouble with performing a CRC-64 ECMA calculation in Dart. While I am getting <em>a</em> result, it is not correct, as evidenced by a Python script that performs the same CRC calculation.</p>
<p>Here's the Python code:</p>
<pre><code>def crc64ecma(data):
"""Calculate the CRC64-ECMA val... | <python><flutter><dart><crc> | 2024-01-15 20:22:47 | 2 | 748 | Raphael Sauer |
77,822,135 | 726,730 | ffmpeg - store desired output to python variable | <p>If i run: <code>ffmpeg -list_devices true -f dshow -i dummy</code> i get:</p>
<pre><code>ffmpeg version 2023-01-30-git-2d202985b7-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-stat... | <python><ffmpeg><process> | 2024-01-15 20:09:02 | 2 | 2,427 | Chris P |
77,822,063 | 16,907,012 | Python subprocess read output line by line | <p>I'm trying to run a python script (<code>test.py</code>) from <code>main.py</code> using <code>asyncio.subprocess</code> and basically, it works fine if <code>test.py</code> doesn't have any interactivity i.e. if there's no user interaction.</p>
<p>When my script contains <code>input(prompt)</code> with some prompt,... | <python><input><subprocess><python-asyncio> | 2024-01-15 19:52:55 | 0 | 354 | princesanjivy |
77,822,021 | 11,618,586 | Calculating slope in degrees from a fitted line | <p>I have fitted a line using Scipy's <code>lineregress</code> on some data resulting in the following plot:</p>
<p><a href="https://i.sstatic.net/hl2nd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hl2nd.png" alt="Plot" /></a></p>
<p>I'm trying to convert the slope to degrees and used the following me... | <python><python-3.x><numpy><scipy> | 2024-01-15 19:44:50 | 0 | 1,264 | thentangler |
77,821,944 | 993,812 | Is there an easy way to remove nodes while keeping descendants? | <p>I've got a graph with some nodes I'd like to remove based on criteria. Is there an easy way to remove the node, but keep the descendants in tact?</p>
<p>Super simple, but say I've got this graph:
1->2->3->4->5->6</p>
<p>If 2 and 4 meet criteria for removal, how can I be left with something like the fo... | <python><networkx> | 2024-01-15 19:25:55 | 2 | 555 | John |
77,821,822 | 15,452,898 | Display the row index number given conditions | <p>I am currently trying to practice with some data manipulation procedures and have faced with the problem of how to make subset based on special condition.</p>
<p>Let's assume that the dataframe looks like this:</p>
<pre><code>Name ID ContractDate LoanSum DurationOfDelay
A ID1 2023-01-01 10 10 ... | <python><pyspark><subset><data-manipulation><row-number> | 2024-01-15 18:55:44 | 1 | 333 | lenpyspanacb |
77,821,670 | 1,725,974 | Neural networks - unable to understand the behaviour of the output layer | <p>I'd like to know why this works (look for the comment "<em># This is the output layer and this is what I am talking about</em>"):</p>
<pre><code>model = Sequential() # Not talking about this
model.add(Dense(32, activation='relu', input_dim = X_train.shape[1])) # Not talking about this
model.add(Dense(16, a... | <python><keras><deep-learning><neural-network> | 2024-01-15 18:20:56 | 1 | 1,539 | Anonymous Person |
77,821,667 | 4,828,720 | Querying postgrest with httpx | <p>Consider the first "Operator Modifiers" example from <a href="https://postgrest.org/en/stable/references/api/tables_views.html#operator-modifiers" rel="nofollow noreferrer">https://postgrest.org/en/stable/references/api/tables_views.html#operator-modifiers</a>:</p>
<pre><code>curl "http://localhost:30... | <python><urlencode><httpx><postgrest> | 2024-01-15 18:20:45 | 1 | 1,190 | bugmenot123 |
77,821,648 | 9,518,886 | Managing ALLOWED_HOSTS in Django for Kubernetes health check | <p>I have a Django application running on Kubernetes, using an API for health checks. The issue I'm facing is that every time the IP associated with Django in Kubernetes changes, I have to manually update ALLOWED_HOSTS.</p>
<p><strong>django code:</strong></p>
<pre><code>class HealthViewSet(ViewSet):
@action(method... | <python><django><kubernetes><devops> | 2024-01-15 18:16:59 | 2 | 537 | Navid Sadeghi |
77,821,581 | 5,418,710 | python typing: detach function signature type declaration from function definition | <p>I want to ensure a couple of functions implement the same interface via type checking.
How'd I do this? Would I use additional tooling for this? <br/>
For completeness: I'm using mypy as a type checker.</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override"><code>binaryFunction = Callable[[float, float], floa... | <python><typing> | 2024-01-15 18:01:32 | 1 | 707 | chichak |
77,821,394 | 4,219,600 | Pandas Creating a single list from a column containing a list of objects | <p>In some data I import into Pandas I have the following;</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>Data</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>"[{'id':102, 'name': 'A'}, {'id':103, 'name': 'B'}, {'id':104, 'name': 'C'}]"</td>
</tr>
</tbody>
</table>
</... | <python><pandas> | 2024-01-15 17:23:31 | 3 | 1,295 | James Cooke |
77,821,296 | 214,296 | Is Python's `print()` function blocking or non-blocking? | <p>I'm trying to speed up the processing time of a script, which in certain configurations may have a lot of output dumped to the console (file=stdout) via <code>print()</code>. Is Python's <code>print()</code> function blocking or non-blocking? I've not able able to find an adequate answer for this in the documentat... | <python><blocking><nonblocking> | 2024-01-15 17:01:40 | 2 | 14,392 | Jim Fell |
77,821,126 | 11,857,974 | How to push data to azure devops using python | <p>I am trying to push data to azure devops using python.<br />
Here is how the paths to the original data (local) look like</p>
<pre><code>original_paths = [
"c:/user/dir1/filename1.txt",
"c:/user/dir2/filename1.py",
"c:/user/dir2/filenamex.json"
]
</code></pre... | <python><git><rest><azure-devops> | 2024-01-15 16:31:15 | 1 | 707 | Kyv |
77,821,100 | 1,536,343 | psycopg2 "%s" variable with " LIKE 'fake_%' " triggers "IndexError: tuple index out of range" | <p>I run the following query in Django using its postgres connection (pyscopg2 lib):</p>
<pre><code>SELECT a.trade_date, a.ticker, a.company_name, a.cusip, a.shares_held, a.nominal,
a.weighting, b.weighting "previous_weighting", ABS(a.weighting - b.weighting) "weighting_change"
FROM t_ark_h... | <python><psycopg2><django-4.0> | 2024-01-15 16:27:05 | 1 | 582 | Je Je |
77,820,817 | 1,422,096 | How to create a Z-value matrix for a given meshgrid, and x, y, z columns? | <p>Let's say we would like to do a heatmap from three 1D arrays <code>x</code>, <code>y</code>, <code>z</code>. The answer from <a href="https://stackoverflow.com/questions/33942700/plotting-a-heat-map-from-three-lists-x-y-intensity">Plotting a heat map from three lists: X, Y, Intensity</a> works, but the <code>Z = np.... | <python><numpy><heatmap><meshgrid> | 2024-01-15 15:37:56 | 1 | 47,388 | Basj |
77,820,589 | 3,124,150 | Type parameter list cannot be empty for TypeVarTuple | <p>I have the following type parametrized signal:</p>
<pre class="lang-py prettyprint-override"><code>from __future__ import annotations
from typing_extensions import Callable, TypeVarTuple, Generic, Unpack, List, TypeVar
VarArgs = TypeVarTuple('VarArgs')
class Signal(Generic[Unpack[VarArgs]]):
def __init__(se... | <python><python-typing><type-variables> | 2024-01-15 14:48:45 | 4 | 947 | EmmanuelMess |
77,820,525 | 1,422,096 | Plot a heatmap from X, Y, Z coordinates | <p>I have 3 lists for X, Y, Z coordinates. How to plot a color heatmap from these 3 lists? Here it should be easily possible because <code>(x, y)</code> cover a rectangle [100, 120[ x [5, 15[.</p>
<p>First attempt : I can do a matrix <code>np.array(...)</code> from the <code>x, y, z</code> values but then, the x-axis, ... | <python><numpy><matplotlib><heatmap> | 2024-01-15 14:37:09 | 0 | 47,388 | Basj |
77,820,437 | 3,501,128 | Test that a function imported into different namespaces is never called | <p>Suppose I have</p>
<p>foo.py</p>
<pre><code>def my_func():
print('hello world!')
</code></pre>
<p>bar.py</p>
<pre><code>from foo import my_func
</code></pre>
<p>I want to write tests to ensure that <code>my_func</code> is never called. I have this:</p>
<pre><code>from unittest import mock
import foo
import bar... | <python><testing><mocking> | 2024-01-15 14:22:37 | 1 | 4,279 | RuthC |
77,820,382 | 3,801,865 | OpenTelemetry collector hanging in local Lambda container | <p>I have an AWS Lambda function which runs from a container image. I am trying to get the <a href="https://aws-otel.github.io/docs/getting-started/lambda/lambda-python" rel="nofollow noreferrer">AWS Distro for OpenTelemetry Lambda Support For Python</a> managed layer to run within my container, so that I can automatic... | <python><docker><aws-lambda><open-telemetry> | 2024-01-15 14:13:05 | 0 | 1,022 | Josh Clark |
77,820,218 | 9,563,537 | Pydantic V2 patching model fields | <h1>Problem</h1>
<p>I'm attempting to patch one or more fields of a pydantic model (v2+) in a unit test.</p>
<h3>Why?</h3>
<p>I want to mock some enum field, with a simpler/smaller enum to reduce the test assertion noise. For example, if I have;</p>
<pre class="lang-py prettyprint-override"><code>from pydantic import B... | <python><pydantic> | 2024-01-15 13:44:39 | 2 | 1,831 | Josmoor98 |
77,820,213 | 10,425,150 | pip installed Pyinstaller in global site-packages instead of venv | <p>I've created virtual environment using following command:</p>
<pre><code>py -m venv pygui
</code></pre>
<p>Then I've activated it in CMD prompt:</p>
<pre><code>cd pygui/Scripts
activate.bat
</code></pre>
<p>However when I've tried to install new libraries with pip I don't see it in the list.</p>
<pre><code>pip insta... | <python><pip><virtualenv><pyinstaller> | 2024-01-15 13:43:26 | 1 | 1,051 | Gооd_Mаn |
77,820,136 | 2,919,585 | pandas.to_datetime is off by one hour | <p>I have some data recorded with timestamps using <code>time.time()</code>. I want to evaluate the data using <code>pandas</code> and convert the timestamps to datetime objects for better handling. However, when I try, all my timing data is off by one hour. This example reproduces the issue on my machine:</p>
<pre cla... | <python><pandas><datetime><timestamp> | 2024-01-15 13:30:49 | 2 | 571 | schtandard |
77,820,120 | 7,631,505 | Numpy filter data based on multiple conditions | <p>Here's my question: I'm trying to filter an image based on the values of two coordinates. I can do this easily with a for loop:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, 101)
y = np.linspace(-1, 1, 51)
X, Y = np.meshgrid(x, y)
Z = np.exp(X**2 + Y**2)
newZ = np.zeros... | <python><numpy><indexing> | 2024-01-15 13:28:32 | 2 | 316 | mmonti |
77,820,083 | 13,803,549 | How to get the average of a specific value in Django queryset | <p>I have two models 'Teams' and 'Members'.</p>
<p>One of the fields in Members is 'favorite_team' and a field in Teams is 'favorite_avg'</p>
<p>I am trying to get an average of the favorite_team field by entering in a value.</p>
<p>I am trying to find a better/faster way to do this:</p>
<pre><code> all_members = Me... | <python><django><django-queryset><aggregate-functions> | 2024-01-15 13:23:23 | 1 | 526 | Ryan Thomas |
77,819,867 | 595,189 | What is the recommeded way of updating when using `pyproject.toml' and `setuptools` | <p>I am/was operating under the assumpion that <code>pyproject.toml</code> is supposed to be a unified metadata file, replacing others (<code>setup.*</code>, <code>requirements.txt</code>...), which worked for the most part for me.</p>
<p>However, I have not found a way to update all depended on packages like <code>pip... | <python><pip><setuptools><pyproject.toml> | 2024-01-15 12:43:40 | 0 | 2,578 | TeaOverflow |
77,819,808 | 2,439,278 | Bump2version + pre-commit hook in python code | <p>I'm using bump2version python module to increment my python codebase version automatically. When the pre-commit hook runs after the commit, the version.sh goes into indefinite loop and version keeps on incrementing in <strong>init</strong>.py. Did I miss anything</p>
<p><strong>.bumpversion.cfg</strong></p>
<pre><co... | <python><git><pre-commit><pre-commit.com><bump2version> | 2024-01-15 12:31:34 | 1 | 1,264 | user2439278 |
77,819,804 | 18,894,965 | Django Rest Framework best way to delete an object | <p>So I"M Trying to make this delete method in my drf project. i setuped the <code>@api_view(['DELETE'])</code> to the views function and setuped a form method to delete the object. but it didn't worked well. so i have to make the @api_view to post method and set the form method to post to delete the object. is th... | <python><django><rest><django-rest-framework> | 2024-01-15 12:30:51 | 1 | 503 | devMe |
77,819,663 | 15,341,457 | Tkinter - Creating scrollable frame | <p>I'm trying to create a scrollable frame with customtkinter following this <a href="https://www.youtube.com/watch?v=gd6tiT0vCII" rel="nofollow noreferrer">guide</a>. The result I'm trying to obtain is a series of frames packed one over the other just like in the linked guide. What I get is just the red canvas which c... | <python><tkinter><canvas><scroll><frame> | 2024-01-15 12:06:22 | 1 | 332 | Rodolfo |
77,819,377 | 14,282,714 | AttributeError: module 'streamlit' has no attribute 'chat_input' | <p>I'm trying to run a simple Streamlit app in my conda env. When I'm running the following <code>app.py</code> file:</p>
<pre><code># Streamlit app
import streamlit as st
#
prompt = st.chat_input("Say something")
if prompt:
st.write(f"User has sent the following prompt: {prompt}")
</code></pr... | <python><python-3.x><pip><attributeerror><streamlit> | 2024-01-15 11:12:48 | 2 | 42,724 | Quinten |
77,819,362 | 1,574,551 | while loop exit after receive error in a try except | <p>I would like to execute the Python code, but in the event of a timeout error, I want the code to automatically retry after a 60-second delay and continue. However, if another error occurs, such as a permission issue, the code should exit with the corresponding error message. The current code I have below doesn't exi... | <python><while-loop><except> | 2024-01-15 11:10:08 | 2 | 1,332 | melik |
77,819,273 | 18,125,194 | Word2Vec to calculate similarity of movies to high preforming movies | <p>I have a dataset with user ratings for movies and movie descriptions like this</p>
<pre><code>import pandas as pd
df =pd.DataFrame ({
'description': [
'Two imprisoned men bond over a number of years',
'A family heads to an isolated hotel for the winter',
'In a future where technology con... | <python><nlp><word2vec> | 2024-01-15 10:54:24 | 1 | 395 | Rebecca James |
77,819,136 | 15,917,305 | Clone Repo into Local Repo and Install Package via Pip via Local Repo | <p>I am a Python and Github novice. However, I'd like to run some code available on Github. My understanding is that I need to:</p>
<p>"First, clone this repo, cd into the local repo, and install via pip from your local repo"</p>
<p>Can someone provide the perquisite and requisite steps for executing:</p>
<ul... | <python><github> | 2024-01-15 10:30:36 | 1 | 339 | EB3112 |
77,819,004 | 633,001 | Python import failed due to missing symbol | <p>I have an external library with a header file and a .so library. I wanted to wrap this via PyBind11 to access the C code from Python. I can build the module just fine, but when I want to import it, I get:</p>
<pre><code>/home/user/dev/external/Python/PyBind_Module/external_python.cpython-310-x86_64-linux-gnu.so: und... | <python><shared-libraries><pybind11> | 2024-01-15 10:05:33 | 1 | 3,519 | SinisterMJ |
77,818,975 | 13,955,154 | Periodogram to find the season of a time series | <p>I have a time series that is detecting a toggle system which has a repetitive pattern of length k, where (k-1) consecutive values are 0 and one is equal to 1. I want to use periodogram to find the length k of this system. How can I do so?</p>
<p>Currently I have this code:</p>
<pre><code>import numpy as np
import ma... | <python><numpy><scipy><time-series><pattern-recognition> | 2024-01-15 10:00:54 | 1 | 720 | Lorenzo Cutrupi |
77,818,960 | 9,658,149 | Langchain, error raised by bedrock service Malformed input request: #: extraneous key [functions] | <p>I have this code that just creates tags for each document. I have done it with ChatOpenAI(), and it works perfectly, but when I change to BedrockChat(), I get the error. This is the code.</p>
<pre><code>from langchain_community.chat_models import BedrockChat,
from langchain.chains import create_tagging_chain_pydanti... | <python><pydantic><langchain><amazon-bedrock> | 2024-01-15 09:56:55 | 0 | 2,097 | Eric Bellet |
77,818,890 | 1,240,075 | Python ModuleNotFoundError when running tests | <p>I have a Python program that runs correctly as expected, but for some reason I am not able to execute the tests.</p>
<p>In the folder hierarchy, <em>tests</em> is a sibling folder of <em>src</em> and the error I got when executing tests is:</p>
<pre><code>ModuleNotFoundError: No module named 'sub'
</code></pre>
<p>H... | <python><unit-testing><testing><pytest><python-unittest> | 2024-01-15 09:45:06 | 1 | 1,611 | user840718 |
77,818,860 | 13,944,524 | Why ScopeSecurity object is empty when used in path operation function in FastAPI? | <p>Here is a simple code to reproduce:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Annotated, Any
from fastapi import FastAPI, Security
from fastapi.security import SecurityScopes
app = FastAPI()
def dependency_one(scope: SecurityScopes):
print("dependency function is running.&quo... | <python><fastapi> | 2024-01-15 09:39:36 | 0 | 17,004 | S.B |
77,818,764 | 3,727,079 | How can I select all dataframe entries between two times, when the time is a series? | <p>Here's some data:</p>
<pre><code>my_dataframe = pd.DataFrame({'time': ["2024-1-1 09:00:00", "2024-1-1 15:00:00", "2024-1-1 21:00:00", "2024-1-2 09:00:00", "2024-1-2 15:00:00", "2024-1-2 21:00:00"],
'assists': [5, 7, 7, 9, 12, 9],
... | <python><pandas><dataframe><datetime> | 2024-01-15 09:24:31 | 2 | 399 | Allure |
77,818,705 | 10,003,538 | Django admin with Nullable ForeignKey in Model but why required in admin page? | <p>I am using Django and Python to create a custom admin interface for a model named ContentProgress. The ContentProgress model has a nullable ForeignKey field named custom_user_content.</p>
<p>However, when I try to save or edit a ContentProgress instance in the Django admin without providing a value for custom_user_c... | <python><django> | 2024-01-15 09:14:06 | 1 | 1,225 | Chau Loi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.