QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 β |
|---|---|---|---|---|---|---|---|---|
79,109,524 | 4,913,660 | Dataframe manipulation: "explode rows" on new dataframe with repeated indices | <p>I have two dataframes say <code>df1</code> and <code>df2</code>, for example</p>
<pre><code>import pandas as pd
col_1= ["A", ["B","C"], ["A","C","D"], "D"]
col_id = [1,2,3,4]
col_2 = [1,2,2,3,3,4,4]
d1 = {'ID': [1,2,3,4], 'Labels': col_1}
d2 = {... | <python><pandas><dataframe> | 2024-10-21 09:59:28 | 2 | 414 | user37292 |
79,109,487 | 3,104,974 | How to check whether an sklearn estimator is a scaler? | <p>I'm writing a function that needs to determine whether an object passed to it is an imputer (can check with <code>isinstance(obj, </code><a href="https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/impute/_base.py#L78" rel="nofollow noreferrer"><code>_BaseImputer</code></a><code>)</code>), a scaler, or so... | <python><scikit-learn><isinstance> | 2024-10-21 09:47:10 | 1 | 6,315 | ascripter |
79,109,458 | 536,262 | playwright python how can I catch exception and just gracefully quit | <p>I'm unable to exit a playwright loop cleanly on <code>KeyboardInterrupt/Exception</code>. It is called by <code>subprocess()</code> in our CICD and always fails due to this garble when the system sends <ctrl+c> after running for its slotted time:</p>
<p>(simplified example with google)</p>
<pre class="lang-py ... | <python><playwright><playwright-python> | 2024-10-21 09:36:34 | 1 | 3,731 | MortenB |
79,109,423 | 6,445,248 | ROS2 launch error when installing my package | <p>I tested both foxy and humble on Ubuntu 20.04, 22.04 and got the same error.</p>
<p>When I build my package and type the source command, <code>source /home/ws/ros2_ws/install/setup.bash</code>, I get the following error.</p>
<h2>ERROR</h2>
<pre class="lang-none prettyprint-override"><code>$> ros2 launch
Failed to... | <python><ros><ros2> | 2024-10-21 09:27:43 | 1 | 317 | bgyooPtr |
79,109,370 | 12,308,825 | How to get the response.headers along with AsyncIterable content from async httpx.stream to a FastAPI StreamingResponse? | <p>I am trying to use httpx in a FastAPI endpoint to download files from a server and return them as a <code>StreamingResponse</code>.
For some processing, I need to get the header information along with the data. I want to stream the file data so I came up with this attempt, boiled down to a MRE:</p>
<pre class="lang-... | <python><python-3.x><fastapi><httpx> | 2024-10-21 09:14:17 | 1 | 362 | schneebuzz |
79,109,089 | 2,307,441 | Python selenium send_keys not working when call called in function and loop | <p>I Am new to python selenium. I am trying to upload csv files to a webportal. I have created the following function(s)/code to upload the file to portal.</p>
<p>webpage has the following code:</p>
<pre class="lang-html prettyprint-override"><code>
<span class="nobr"> ... | <python><selenium-webdriver> | 2024-10-21 07:59:34 | 1 | 1,075 | Roshan |
79,108,577 | 2,987,744 | Chat Template Error when using HuggingFace and LangGraph | <p>I'm following the <a href="https://langchain-ai.github.io/langgraph/tutorials/introduction/#requirements" rel="nofollow noreferrer"><code>LangGraph</code> and <code>LangChain</code> tutorial</a> on making a chatbot, and got a successful output on the first step. After binding tools and finishing the second step, thi... | <python><huggingface-transformers><huggingface-tokenizers><py-langchain><langgraph> | 2024-10-21 04:41:06 | 0 | 1,543 | T145 |
79,108,443 | 6,703,592 | flatten dictionary with dataframe value to a dataframe | <p>This encoding process will generate a mapping between each categorical value and its corresponding numeric value:</p>
<pre><code>import category_encoders as ce
cols_a = ['group1', 'group2']
dfa = pd.DataFrame([['A1', 'A2', 1], ['B1', 'B2', 4], ['A1', 'C2', 3], ['B1', 'B2', 5]], columns=['group1', 'group2', 'label']... | <python><pandas><dataframe><dictionary><mapping> | 2024-10-21 02:59:08 | 1 | 1,136 | user6703592 |
79,108,381 | 594,900 | DBSCAN clustering geolocations beyond the epsilon value | <p>I am trying to analyse some job latitude and longitude data. The nature of the jobs means they tend to happen at similar (although not identical) latitude/longitude locations</p>
<p>In order to reduce the amount of data points to display and analyse I want to cluster the jobs in similar geographical region together.... | <python><dbscan> | 2024-10-21 02:21:13 | 1 | 3,345 | Alex |
79,108,264 | 7,589,535 | Linked List merge sort implementation attempt with Python runs into an infinite loop | <h2>Context</h2>
<p>I was implementing a LinkedList sort solution with python (over on leetcode.com).
The solution is a bottom up merge sort approach (divide and conquer).
The code below is incomplete, it's missing the implementation of the merge() method, which will take a list of a given size and merge it, given that... | <python><infinite-loop> | 2024-10-20 23:51:21 | 0 | 389 | oussema |
79,108,227 | 5,228,348 | import that works from main module or directly | <p><strong>TL;DR</strong> How do I make an import resolvable regardless of whether a file is run directly or is itself imported by a parent module?</p>
<p>This is not the same as the million questions about importing modules from parent packages. I've had a hard time finding an exactly equivalent question, so if I've m... | <python><package> | 2024-10-20 23:19:58 | 1 | 333 | Luke Sawczak |
79,107,898 | 1,761,907 | Why can't subprocess.Open find this executable (phantomjs) | <p>[update]</p>
<p>I think the error message here is actually misleading. It turns out if I try to run the command phantomjs, I get an error:</p>
<p><code>-bash: /usr/bin/phantomjs: cannot execute: required file not found</code></p>
<p>I think that is a problem with the executable, and not that Popen can't find it.</p>... | <python><selenium-webdriver><raspberry-pi><phantomjs> | 2024-10-20 19:30:34 | 0 | 2,453 | John Kitchin |
79,107,780 | 3,291,077 | Pip adding a path entry that works for python but not jupyter | <p>I have a library, I am installing it for development purposes using the command</p>
<pre><code>$ pip install -e .
</code></pre>
<p>The library structure is this:</p>
<pre><code>.
βββ package-name/
βββ package_name/
β βββ __init__.py
β βββ module1.py
β βββ module2.py
βββ setup.py
βββ req... | <python><jupyter-notebook><pip> | 2024-10-20 18:30:23 | 3 | 4,465 | rgalbo |
79,107,659 | 11,062,613 | How to pass aggregation functions as function argument in Polars? | <p>How can we pass aggregation functions as argument to a custom aggregation function in Polars?
You should be able to pass a single function for all columns or a dictionary if you have different aggregations by column.</p>
<pre><code>import polars as pl
# Sample DataFrame
df = pl.DataFrame({
"category":... | <python><python-polars> | 2024-10-20 17:31:07 | 1 | 423 | Olibarer |
79,107,524 | 398,348 | What is this? 'j1 = %d' % j1. Why isn't 'j1 = %d' , j1 enough? | <p>Perhaps because I am coming to it from Java, it seems strange. In java, <code>print("%d", aNumber)</code> is sufficient to fill the <code>%d</code> with <code>aNumber</code>. Why isn't <code>'j1 = %d' , j1</code> enough?</p>
<p>I am doing the Coursera algorithms course and the test case for the assignment ... | <python> | 2024-10-20 16:29:50 | 0 | 3,795 | likejudo |
79,107,387 | 12,394,386 | Page format changes during RTF to PDF conversion using pypandoc | <p>Iβm using pypandoc to convert an RTF file to a PDF, but Iβm running into an issue where the page structure and formatting are altered during the conversion. It looks like the output PDF is being generated using LaTeX, and this changes the layout compared to the original RTF file.</p>
<p>Hereβs the code Iβm using:</p... | <python><pdf><rtf><pdf-conversion><pypandoc> | 2024-10-20 15:10:59 | 1 | 323 | youta |
79,107,247 | 9,751,001 | How can I stop pymupdf converting 'ff' to a different character such as @ or I? | <p>I'm reading in text from a bunch of PDFs using the following code:</p>
<pre><code>import fitz
import numpy as np
import pandas as pd
# open the document
doc = fitz.open(filename_path)
# get the text from each page in the document
for idx, page in enumerate(doc):
page = doc.load_page(idx)
page_text = page.g... | <python><pdf><text><pymupdf> | 2024-10-20 14:03:49 | 0 | 631 | code_to_joy |
79,107,070 | 5,881,804 | How to use the StringAdapter in pycasbin | <p>pycasbin includes a class <code>StringAdapter</code> in the file <code>adapters/string_adapter.py</code>, however, it doesn't seem to be useable.</p>
<p>Note that it is not an attribute of <code>casbin.persist</code>:</p>
<p><code>dir(casbin.persist)</code></p>
<p><code>['Adapter', 'BatchAdapter', 'FileAdapter', 'Fi... | <python><casbin> | 2024-10-20 12:46:28 | 1 | 732 | Blindfreddy |
79,106,960 | 4,265,498 | Serializing a Complex python Class to JSON | <p>In my project I analyze the questions of a given exam. Let's say each exam has 10 questions.</p>
<p>For each question I compute some stuff and save it, using the constructor method of class <code>QuestionData</code> (defined in file <code>question_data.py</code>). Each <code>QuestionData</code> object has a <code>pa... | <python><json><serialization><orjson> | 2024-10-20 11:45:26 | 1 | 767 | SpΓ€tzle |
79,106,878 | 5,615,873 | How can I position a taichi GUI window on screen? | <p>I have started to work with Python's Taichi package and I couldn't find how to position the GUI window.
A simple example:</p>
<pre><code>import taichi as ti
gui = ti.GUI("Test", (640, 480))
while gui.running:
if gui.get_event(ti.GUI.PRESS):
gui.running = False
# ...
gui.show()
</code></pre>
<p... | <python><taichi> | 2024-10-20 10:55:10 | 1 | 3,537 | Apostolos |
79,106,724 | 2,536,614 | read mifare classic with pyscard using Dell ControlVault 3 contactless | <p>I have Dell Latitude 5430, which has Dell ControlVault 3 contactless smart-card reader with NFC.</p>
<p>Here are its specs:</p>
<p><a href="https://www.dell.com/support/manuals/es-es/latitude-5430-laptop/latitude_5430_ss/contactless-smart-card-reader?guid=guid-38176113-cf9b-4fee-80ec-8766ca14dd9c&lang=en-us" rel... | <python><smartcard><mifare><pcsc><pyscard> | 2024-10-20 09:32:02 | 1 | 1,263 | Mert Mertce |
79,106,707 | 601,311 | LibCST matcher for detecting nested f-string expressions in Python AST | <p>I want to create a transformer that converts all quotes of f-strings from a single quote to triple quotes, but leaves nested f-strings intact.</p>
<p>For example, the next expression left intact.</p>
<pre class="lang-py prettyprint-override"><code>f"""\
Hello {developer_name}
My name is {_get_machine(... | <python><abstract-syntax-tree><libcst> | 2024-10-20 09:17:31 | 1 | 2,759 | Maxim Kirilov |
79,106,691 | 2,545,680 | How to update system installation of python (setuptools) on Ubuntu | <p>I get the following warning from AWS Inspector on the Ubuntu machine:</p>
<blockquote>
<p>CVE-2024-6345 - setuptools, setuptools Finding ID:
arn:aws:inspector2:eu-west-1:355370908234:finding/348da83463e3a933ffccae7dcffeb1cc
A vulnerability in the package_index module of pypa/setuptools
versions up to 69.1.1 allows f... | <python><ubuntu> | 2024-10-20 09:06:19 | 0 | 106,269 | Max Koretskyi |
79,106,642 | 12,466,687 | How to webscrape elements using beautifulsoup properly? | <p>I am not from web scaping or website/html background and new to this field.</p>
<p>Trying out scraping elements from <a href="https://ihgfdelhifair.in/mis/Exhibitors" rel="nofollow noreferrer">this link</a> that contains containers/cards.</p>
<p>I have tried below code and find a little success but not sure how to d... | <python><html><css><beautifulsoup> | 2024-10-20 08:25:35 | 2 | 2,357 | ViSa |
79,106,607 | 8,910,441 | Passing list of objects and dictionary to snowflake from streamlit | <p>I'm developing a Streamlit app to create an AI chatbot using the "complete" function in snowflake. When a user starts the app, I need to pass a sequence of initial messages into the function. Here's an example:</p>
<pre class="lang-sql prettyprint-override"><code>messages = [
{'system': 'act like a databas... | <python><snowflake-cloud-data-platform><streamlit> | 2024-10-20 07:55:17 | 2 | 584 | Julian Eccleshall |
79,106,221 | 3,294,994 | Enum of dataclass works but frozen attrs doesn't | <p>The built-in <code>enum</code> provides a way to create enums of primitive types (IntEnum, StrEnum).</p>
<p>I'd like to create an enum of structured objects.</p>
<p>One way to do that is with <code>dataclass</code>, and it works:</p>
<pre class="lang-py prettyprint-override"><code>from dataclasses import dataclass
f... | <python><python-attrs> | 2024-10-20 01:21:13 | 1 | 846 | obk |
79,106,128 | 1,492,229 | How to filter out a dataframe based on another dataframe | <p>My dataframe loads from a csv file that looks like this</p>
<pre><code>RepID Account Rank
123 Abcd 1
345 Zyxw 2
567 Hijk 3
...
...
837 Kjsj 8
</code></pre>
<p>and I have another csv that has only one column</p>
<pre><code>RepID
345
488
</code></pre>
<p>I load the first cs... | <python><pandas> | 2024-10-19 23:27:12 | 2 | 8,150 | asmgx |
79,106,088 | 5,565,100 | Correct Python DBus Connection Syntax? | <p>I'm having trouble getting dbus to connect:</p>
<pre><code> try:
logging.debug("Attempting to connect to D-Bus.")
self.bus = SessionBus()
self.keepass_service = self.bus.get("org.keepassxc.KeePassXC.MainWindow", "/org/keepassxc/KeePassXC/MainWindow")
#... | <python><python-3.x><dbus> | 2024-10-19 22:40:27 | 1 | 2,371 | Emily |
79,105,984 | 13,634,560 | multi index with .loc on columns | <p>I have a dataframe with multi index as follows</p>
<pre><code>arrays = [
["bar", "bar", "baz", "baz", "foo", "foo", "qux", "qux"],
["one", "two", "one", "two", "one", "two&qu... | <python><pandas><multi-index> | 2024-10-19 21:19:04 | 2 | 341 | plotmaster473 |
79,105,760 | 2,329,968 | Sphinx - How to document a subclass of param.Parameterized | <p>One of <a href="https://param.holoviz.org/user_guide/Simplifying_Codebases.html" rel="nofollow noreferrer"><code>param</code></a>'s main advantage is that of simplifying the codebase.</p>
<p>Let's consider this toy class:</p>
<pre class="lang-py prettyprint-override"><code>import param
class A(param.Parameterized):... | <python><parameters><python-sphinx><holoviz> | 2024-10-19 19:28:08 | 0 | 13,725 | Davide_sd |
79,105,380 | 13,097,194 | Is it possible to have Plotly HTML charts appear within Colab without running the code beforehand? | <p>I recently created a <a href="https://github.com/kburchfiel/pfn/blob/main/Automated_Notebooks/recent_weather_data.ipynb" rel="nofollow noreferrer">Python script</a> that retrieves recent weather reports from the National Weather Service, then creates some simple Plotly visualizations of temperature and precipitation... | <python><html><plotly><google-colaboratory> | 2024-10-19 16:10:08 | 0 | 974 | KBurchfiel |
79,105,264 | 5,800,005 | PyBind11 produces pyd file without any class i defined | <p>I am working on wrapping a C++ class using Pybind11 to make it accessible in Python. My project involves a dynamic library built with Qt6, which contains a class named Package. I am writing a wrapper class called PackageExt, and I am using Pybind11 to bind this wrapper to a Python module. Below is the code I am work... | <python><c++><pybind11> | 2024-10-19 15:13:48 | 1 | 314 | Ahmed Aredah |
79,105,119 | 607,846 | Slice array using boolean values | <p>Given a:</p>
<pre><code>a = numpy.zeros(100, dtype=bool)
a[10:20] = True
a[40:60] = True
</code></pre>
<p>I wish to slice an array b, also of length 100, into two arrays:</p>
<pre><code>b[10:20], b[40:60]
</code></pre>
<p>In other words, I wish to establish the range of indexes in <code>a</code> containing True val... | <python><numpy> | 2024-10-19 14:06:26 | 2 | 13,283 | Baz |
79,104,875 | 8,535,456 | Returning a generator as return value, and the generator becomes empty | <p>I am puzzled by the following snippet:</p>
<pre><code>def iter_test(x):
l = [1,2,3,4,5]
default = (i for i in l)
if x:
return default
else:
for i in default:
yield i
def test_iter():
a = iter_test(True)
b = iter_test(False)
print(a, b)
print('a', list(a))
... | <python><python-3.x><iterator> | 2024-10-19 12:03:20 | 1 | 1,097 | Limina102 |
79,104,540 | 5,109,125 | getting GoogleAuthError while following a langchain tutorial | <p>I am trying to follow an <code>"official"</code> langchain tutorial <a href="https://python.langchain.com/docs/how_to/sql_csv/" rel="nofollow noreferrer">How to do question answering over CSVs</a> using <code>llm model = gemini-1.5-flash</code> but my code is failing anyways. I am writing/running the ... | <python><large-language-model><google-cloud-vertex-ai> | 2024-10-19 08:53:47 | 1 | 597 | punsoca |
79,104,501 | 7,695,845 | How to render numpy docstring nicely in VSCode? | <p>I am working on a Python utilities library for parsing output generated by an external simulation program we use (called MESA, but it's not important for this question).
I plan to use the library mainly for myself, but it's very likely that I will share it with my friends who also use this program to run simulations... | <python><visual-studio-code><docstring><numpydoc> | 2024-10-19 08:32:48 | 0 | 1,420 | Shai Avr |
79,104,338 | 1,161,518 | "-bash: syntax error near unexpected token `('" error while trying to activate project using Conda | <p>I am trying to create a project using Conda.</p>
<pre><code>conda create --name cooking-assistant python=3.11
</code></pre>
<p>The project is created but when I try to activate it, it gives me the above-mentioned error. Also, I cannot find any project-related file in the directory, where I am creating this project.<... | <python><conda> | 2024-10-19 06:34:23 | 0 | 1,152 | WasimSafdar |
79,104,217 | 986,387 | Dunder method other param type | <p>how to add type annotations dunder method params</p>
<pre><code>class Car :
def __init__(self,name:str,horse_power:int,fav:bool) -> None:
self.name = name
self.horse_power = horse_power
self.fav = fav
def __str__(self) -> str:
return f"Car Name {self.name} HorsePo... | <python><python-typing> | 2024-10-19 04:45:48 | 1 | 8,920 | invariant |
79,104,136 | 54,873 | In pandas, how can I get a version of nth() to act as an aggregator? | <p>In Pandas v1.x.x,</p>
<pre><code>df.groupby("col").nth(0)
</code></pre>
<p>returned a dataframe that had "col" as the index col.</p>
<p>Now in pandas v2.x.x it doesn't, and my understanding of why is that nth is now seen as a "filter" and not an "aggregator".</p>
<p>I saw some... | <python><pandas> | 2024-10-19 03:08:32 | 1 | 10,076 | YGA |
79,104,066 | 8,436,767 | Yfinance Python Library returns different result from NASDAQ | <p>I am using yfinance to get information about USOI ticker.</p>
<pre><code>tickerSymbol = 'USOI'
#get data on this ticker
tickerData = yf.Ticker(tickerSymbol)
#get the historical prices for this ticker
db = tickerData.history(period='1d',start = '2020-10-14', end = '2024-10-17')
db['Close'][0:10], db.index[0:10]
</... | <python><yfinance> | 2024-10-19 01:45:10 | 0 | 739 | Valentyn |
79,104,019 | 10,958,326 | How to preserve an informative `__init__` signature when using parameterized Mixins in Python? | <p>In my Python project, I heavily use Mixins as a design pattern, and Iβd like to continue doing so. However, I am facing an issue with the <code>__init__</code> method signatures in the final class. Since I am passing arguments through <code>**kwargs</code>, the resulting signature is not helpful for introspection or... | <python><oop><mixins><signature> | 2024-10-19 00:59:23 | 2 | 390 | algebruh |
79,104,006 | 2,417,578 | How to read stdout from subprocess safely in Python | <p>Two choice quotes from the documentation:</p>
<p>On <a href="https://docs.python.org/3/library/subprocess.html#subprocess.Popen.stdout" rel="nofollow noreferrer">Popen.stdout</a>:</p>
<blockquote>
<p>Warning</p>
<p>Use <code>communicate()</code> rather than <code>.stdin.write</code>, <code>.stdout.read</code> or <co... | <python><subprocess><stdout> | 2024-10-19 00:50:28 | 0 | 4,990 | sh1 |
79,104,005 | 3,486,684 | Using `hist` to bin data while grouping with `over`? | <p>Consider the following example:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame(
[
pl.Series(
"name", ["A", "B", "C", "D"], dtype=pl.Enum(["A", "B", "C", "D"])
... | <python><dataframe><python-polars> | 2024-10-19 00:49:01 | 4 | 4,654 | bzm3r |
79,103,936 | 1,492,229 | merging numpy arrays converts int to decimal | <p>I am need to merge 2 arrays together</p>
<p>so if</p>
<pre><code>a = []
</code></pre>
<p>and</p>
<pre><code>b is array([76522, 82096], dtype=int64)
</code></pre>
<p>the merge will be <code>[76522, 82096]</code></p>
<p>but i am getting this in a form of decimal</p>
<pre><code>array([76522., 82096.])
</code></pre>
<p... | <python><arrays><numpy> | 2024-10-18 23:33:44 | 1 | 8,150 | asmgx |
79,103,932 | 3,510,201 | Type hint a custom dictionary object as TypedDict | <p>Is it possible to get the <code>TypedDict</code> values passed as a generic within a class to enable type hinting?</p>
<p>I have a dictionary where I would like to be able to get the type annotations from the passed generic <code>TypeDict</code> within the <code>__getattr__</code>.</p>
<p>Given this example. I want ... | <python><python-typing> | 2024-10-18 23:27:47 | 1 | 539 | Jerakin |
79,103,866 | 807,797 | Stopping asyncio program using file input | <p>What specific code needs to change in the Python 3.12 example below in order for the program <code>myReader.py</code> to be successfully halted every time the line "Stop, damnit!" gets printed into <code>sourceFile.txt</code> by the program <code>myWriter.py</code>?</p>
<p><strong>THE PROBLEM:</strong></p>... | <python><python-3.x><python-asyncio><python-aiofiles> | 2024-10-18 22:39:20 | 1 | 9,239 | CodeMed |
79,103,833 | 1,492,229 | How to filter dataframe based on array of index | <p>I am using Python</p>
<p>X is a dataframe that has these values</p>
<pre><code>In [29]: X
Out[29]:
RepID
76758 207355
5787 15900
101140 273993
96040 260308
82096 221946
65858 178020
40664 109821
56044 151664
76522 206735
12478 33774
</code></pre>
<p>test_indices is an array that has i... | <python><dataframe> | 2024-10-18 22:21:37 | 1 | 8,150 | asmgx |
79,103,654 | 15,835,974 | Edit the column that is nested into a array that is nested into a struct | <p>How can I edit the <code>I</code> column of my DataFrame by applying my <code>example_loop</code> function on it?</p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.functions import col, udf
from pyspark.sql.types import ArrayType, IntegerType, String... | <python><dataframe><pyspark> | 2024-10-18 20:57:54 | 1 | 597 | jeremie bergeron |
79,103,633 | 6,357,916 | nvcc is not installed despite successfully running conda install command | <p>I followed following steps to setup conda environment with python 3.8, CUDA 11.8 and pytorch 2.4.1:</p>
<pre><code>$ conda create -n py38_torch241_CUDA118 python=3.8
$ conda activate py38_torch241_CUDA118
$ conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
</code></pre>
<p>Python an... | <python><pytorch><anaconda><cuda><conda> | 2024-10-18 20:49:05 | 0 | 3,029 | MsA |
79,103,538 | 11,069,614 | function returning list with one extra length than it should | <p>I have data that looks like this:</p>
<pre><code>data = [[['INS', 'Y', '18', '021', '28', 'A', '', '', 'AC'],
['REF', '0F', '816383217'],
['HD', '021', '', 'EPO', 'Copayment Level -1', 'IND']],
[['INS', 'Y', '18', '024', '07', 'A', '', '', 'TE'],
['REF', '0F', '734419065']],
... | <python> | 2024-10-18 20:14:38 | 2 | 392 | Ben Smith |
79,103,405 | 289,037 | what causes a gcloud functions deploy failure with no error message (OperationError: code=13, message=None) | <p>deploying from a GitHub workflow with this command</p>
<pre><code> gcloud functions deploy "$FUNCTION_NAME" \
--entry-point "entry" \
--region northamerica-northeast1 \
--runtime python39 \
--set-env-vars=SENDGRID_API_KEY="$SEN... | <python><google-cloud-functions> | 2024-10-18 19:13:35 | 1 | 770 | PMorganCA |
79,103,393 | 9,315,690 | How can I detect whether a given Python module was compiled with mypyc? | <p>I have a Python program, and I want to detect whether it was compiled with mypyc or not so I can include this in the version information of the program for debugging purposes. But how can I do this? I tried looking through <a href="https://github.com/python/mypy/blob/c9d4c61d9c80b02279d1fcc9ca8a1974717b5e1c/mypyc/do... | <python><compilation><detection><mypyc> | 2024-10-18 19:07:45 | 2 | 3,887 | Newbyte |
79,103,185 | 4,351,030 | Calculate a mean value for column C for all dates less than the date in row R with Pandas | <p>I have a pandas dataframe with >101K rows from which I am trying to calculate a mean value for the <code>won</code> column based upon date. The logic is that for each row, find the mean value of <code>won</code> for all rows where <code>row['created_on']</code> < current <code>row['created_on']</code>. Please ... | <python><pandas> | 2024-10-18 17:55:21 | 1 | 3,334 | Steven |
79,102,985 | 2,233,500 | Asyncio + Claude raises a "RuntimeError: Event loop is closed" | <p>I have a very simple toy example that uses Claude and asyncio.
It is a loop that runs several times the <code>asyncio.run()</code> function.
Sometimes, a</p>
<blockquote>
<p>RuntimeError: Event loop is closed</p>
</blockquote>
<p>exception is raised during the iterations and I don't understand why.
I guess I'm not u... | <python><python-asyncio><claude> | 2024-10-18 16:53:51 | 2 | 867 | Vincent Garcia |
79,102,797 | 9,945,539 | Varying embedding dim due to changing padding in batch size | <p>I want to train a simple neural network, which has <strong>embedding_dim</strong> as a parameter:</p>
<pre><code>class BoolQNN(nn.Module):
def __init__(self, embedding_dim):
super(BoolQNN, self).__init__()
self.fc1 = nn.Linear(embedding_dim, 64)
self.relu = nn.ReLU()
self.fc2 = nn... | <python><text><nlp><padding><data-preprocessing> | 2024-10-18 15:54:51 | 1 | 392 | samuel gast |
79,102,700 | 11,561,121 | Is my integration test well structured and why is it returning import error | <p>I am learning mock and trying it on a personal project.</p>
<p>This is my project structure:</p>
<pre><code>project/
β
βββ src/
β βββ My_app/
β βββ __init__.py
β βββ application/
β β βββ main_code.py
β β βββ __init__.py
β βββ infrastructure/
β β βββ __init__.py
β β ... | <python><unit-testing><mocking> | 2024-10-18 15:24:20 | 2 | 1,019 | Haha |
79,102,605 | 11,069,614 | How to group a list of lists into a new list based on the beginning character of one of the elements in one of the lists | <p>I have a lists of lists called "lines" that looks like this:</p>
<pre><code>[['INS', 'Y', '18', '024', '07', 'A', '', '', 'TE'],
['REF', '0F', '708066255'],
['REF', '1L', '708066255'],
['DTP', '303', 'D8', '20240901'],
['DTP', '356', 'D8', '20240801'],
['NM1', 'IL', '1', 'FIGUEROA', 'LILIET', '', '', '', '... | <python><list> | 2024-10-18 14:55:52 | 2 | 392 | Ben Smith |
79,102,550 | 2,886,575 | How to elegantly map over deep iterables? | <p>I have an iterable of tuples <code>Iterable[tuple[int, str]]</code>. I would like to <code>map</code> over this, and only edit the second item of each <code>tuple</code>. This, unfortunately, leaves me with a lot of boilerplate for un-packing and re-packing the first element of each tuple:</p>
<pre><code>map(lambd... | <python> | 2024-10-18 14:39:13 | 1 | 5,605 | Him |
79,102,407 | 11,092,636 | Variable is not accessed Pylance | <p>Python 3.12.5:</p>
<pre class="lang-py prettyprint-override"><code>my_list: list[str] = ["MFI BL {num}" for num in range(1, 15)]
</code></pre>
<p>The <code>num</code> variable is clearly accessed but I have a warning that says <code>"num" is not accessed Pylance</code>.</p>
<p>Why do I have this ... | <python><pyright> | 2024-10-18 14:00:31 | 1 | 720 | FluidMechanics Potential Flows |
79,102,294 | 17,556,733 | How to simulate AWS DynamoDB locally in python with moto 5 | <p>I want to make a class representing a dynamodb connection which I can use locally to mimic the behavior of DynamoDB without having to actually contact the AWS service.</p>
<p>I want to use it during development (not just for running tests) and use that class for creating a table which exists during program executio... | <python><amazon-dynamodb><boto3><moto> | 2024-10-18 13:30:06 | 1 | 495 | TheMemeMachine |
79,102,275 | 865,169 | Python logging: where are messages coming from | <p>I have an application using lots of different packages and many of them are logging output. I would like to clean up my application's logs and perhaps disable some of the other packages' output. My problem is that I do not know where many of these log messages are coming from.
Can I configure / turn something on in ... | <python><python-logging> | 2024-10-18 13:24:12 | 1 | 1,372 | Thomas Arildsen |
79,102,186 | 4,194,554 | Constant error while referencing function in package (TypeError: 'module' object is not callable) | <p>I get error while trying to execute pytest UTs for the project.</p>
<pre><code>E TypeError: 'module' object is not callable
</code></pre>
<p>I have the following repository structure:</p>
<pre><code>ββββsrc
β ββββcompany
β ββββacc
β ββββdp
β ββββlogic
β ββββbusiness
β ... | <python><pytest><python-import><python-module><python-packaging> | 2024-10-18 13:00:01 | 1 | 482 | PaweΕ Tajs |
79,102,009 | 9,251,158 | How to load tests from some files and not others? | <p>I want to run a suite of unit tests in the <code>tests</code> folder. The basic code is:</p>
<pre class="lang-py prettyprint-override"><code>suite = unittest.defaultTestLoader.discover('tests')
</code></pre>
<p>I want only some of these tests to run, for example <code>test_e1</code> if file <code>e1.py</code> is pre... | <python><unit-testing><python-unittest> | 2024-10-18 12:05:17 | 2 | 4,642 | ginjaemocoes |
79,101,944 | 839,733 | mypy warning on numpy.apply_along_axis | <p><strong>Edit Oct-18-2024:</strong></p>
<p>An even more trivial reproduction of the problem is shown below.</p>
<blockquote>
<p><code>mypy_arg_type.py</code>:</p>
</blockquote>
<pre><code>import numpy as np
from numpy.typing import NDArray
import random
def winner(_: NDArray[np.bytes_]) -> bytes | None:
retur... | <python><numpy><python-typing><mypy> | 2024-10-18 11:45:32 | 1 | 25,239 | Abhijit Sarkar |
79,101,670 | 5,065,546 | Environment variable not recognised in python or terminal but I can see it in system properties | <p>I am trying to set an openai key to use the ChatGPT api. I did so using the following command in the terminal:</p>
<pre><code>setx OPENAI_API_KEY "api_key_text"`
</code></pre>
<p>After this, if I go to the list of environmental variables from system properties, (i.e. "edit the system environmental var... | <python><windows><environment-variables> | 2024-10-18 10:29:23 | 1 | 362 | Euan Ritchie |
79,101,599 | 386,861 | How to solve strange plotting error in Altair | <p>I'm trying to plot some data which broadly should form a map like so:</p>
<pre><code>import numpy as np
lats = np.random.uniform(51.5, 51.6, 100)
lons = np.random.uniform(-0.1, 0.1, 100)
months = np.arange(1, 13)
vouchers = np.random.randint(1, 100, 100)
test_df = pd.DataFrame({
'lat': lats,
'lon': lons,
... | <python><altair> | 2024-10-18 10:08:52 | 0 | 7,882 | elksie5000 |
79,101,594 | 6,751,456 | django ORM query filter methods running multiple filter duplicates joins | <p>I'm trying to run filters using methods in two separate attributes.</p>
<p>In ICD10Filter:</p>
<pre><code>class Icd10Filter(filters.FilterSet):
# New Filters for DOS Range
dosFrom = filters.DateFilter(method='filter_by_dos_from', lookup_expr='gte')
dosTo = filters.DateFilter(method='filter_by_dos_to', ... | <python><django><join><django-orm> | 2024-10-18 10:07:18 | 1 | 4,161 | Azima |
79,101,444 | 14,264,760 | Unable to login into outlook email server with smtplib even after setting app passkey and 2 factor auth | <p>I am unable to login into outlook email server with smtplib even after setting app passkey and 2 factor authentication in outlook account.</p>
<pre><code>import smtplib
smtp_server = 'smtp.office365.com'
smtp_port = 587
sender_email = 'myemail@outlook.com'
app_password = "my_outlook_app_passwords"
def lo... | <python><authentication><outlook><gmail> | 2024-10-18 09:27:49 | 0 | 339 | Ayush Raj |
79,101,335 | 3,906,713 | Is it possible to vectorize scipy multivariate_normal over means? | <p>I have a multivariate normal distribution. I use it in a markov chain sampler, that makes use of vectorization option. That means that it is most optimal, when it can request logarithm of PDF for multiple different mean vectors at the same time. Below is a minimal example. The first piece of code makes a request for... | <python><scipy> | 2024-10-18 08:59:08 | 1 | 908 | Aleksejs Fomins |
79,101,286 | 8,909,944 | How to have immutable shared object in python multiprocessing map | <p>How can I let all of my worker processes share the same object that none of them mutate? For example, what is the cleanest way of writing a function that computes the dot product of an argument vector with a second vector that is the same for all processes. Naively, I would write something like this:</p>
<pre><code>... | <python><parallel-processing><multiprocessing> | 2024-10-18 08:41:51 | 1 | 321 | David |
79,101,228 | 1,503,683 | boto3 upload_file: how to specify Checksum? | <p>I'm using <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/upload_file.html" rel="nofollow noreferrer"><code>boto3's upload_file</code></a> to upload files to some S3 buckets.</p>
<p>This works well:</p>
<pre class="lang-py prettyprint-override"><code>s3 = boto3.client('s... | <python><amazon-s3><boto3> | 2024-10-18 08:27:29 | 0 | 2,802 | Pierre |
79,101,170 | 428,542 | Disable entityref decoding in html.parser | <p>Python's <code>html.parser.HTMLParser</code> seems to alway decode entityrefs in attributes (e.g. translate <code>&para;</code> to <code>ΒΆ</code>). Is there a way to disable this?</p>
<p>The HTML I like to parse is:</p>
<pre><code> <ul>
<li>&para; &amp; &#xb6;</a>
<li>... | <python><html-parser> | 2024-10-18 08:12:01 | 1 | 3,568 | MacFreek |
79,101,058 | 4,382,305 | Are probabilities correct in elements of toss in binomial distribution in numpy python? | <p>I saw in many tutorials below code in numpy for Binomial Distribution:</p>
<pre><code>x = random.binomial(n=10, p=0.5, size=10)
</code></pre>
<p>n - number of trials.</p>
<p>p - probability of occurrence of each trial (e.g. for toss of a coin 0.5 each).</p>
<p>size - The shape of the returned array.</p>
<p>in above ... | <python><numpy><statistics> | 2024-10-18 07:39:30 | 0 | 2,091 | Darwin |
79,101,053 | 8,445,557 | Access data on my google drive using service account | <p>I can't read the files that I saved on "Google Drive" using the code that You can see below.</p>
<ul>
<li>I've yet enabled the "Google Drive API" in the GCP project.</li>
<li>I've yet created the "service account" and in the "<strong>API/Service Detail</strong>"(<a href="https... | <python><google-drive-api><service-accounts><google-api-python-client> | 2024-10-18 07:37:55 | 1 | 361 | Stefano G. |
79,100,279 | 6,703,592 | dataframe easily implement merge_asof | <p>I have two dataframes:</p>
<pre class="lang-py prettyprint-override"><code>time_start = datetime.datetime.strptime('2024-02-01 10:00:00', "%Y-%m-%d %H:%M:%S")
interval_l = [1, 7, 14, 17, 21, 22, 31]
df_l = pd.DataFrame(index = [time_start + datetime.timedelta(seconds=i) for i in interval_l])
df_r = pd.Data... | <python><pandas><dataframe><merge> | 2024-10-18 01:37:25 | 2 | 1,136 | user6703592 |
79,100,223 | 3,388,962 | How to export a Matplotlib figure to PDF-1.3? | <p>When saving a plot as a PDF, Matplotlib generates files based on the PDF 1.4 standard. (You can check the PDF version by opening the file in a text editor).</p>
<p>However, I run into problems with such PDFs when I use them in Microsoft PowerPoint and other MS Office tools, and then export the MS document again into... | <python><matplotlib><transparency> | 2024-10-18 00:57:19 | 2 | 9,959 | normanius |
79,100,109 | 3,842,845 | How delete a substring part within filename of several files (matching a certain filename pattern) in Python? | <p>I am trying to eliminate some part of file names so I could use for pattern to ingest data daily.</p>
<p>I have following files inside this folder (<strong>F:\Source</strong>).</p>
<pre><code>WH_BEE_FULL_20241017_170853_1.bak
WH_BEE_FULL_20241017_170853_2.bak
WH_BEE_FULL_20241017_170853_3.bak
WH_BEE_FULL_20241017_17... | <python> | 2024-10-17 23:29:14 | 0 | 1,324 | Java |
79,100,013 | 7,273,648 | What does "DataFrame.at[source]: TypeError: only integer scalar arrays can be converted to a scalar index" mean? | <p>Searching for answers to "dataframe. at TypeError: only integer scalar arrays can be converted to a scalar index" resulted in "We couldn't find anything for dataframe. at typeerror: only integer scalar arrays can be converted to a scalar index".</p>
<p>Searching with less stringent rules produced... | <python><pandas><dataframe> | 2024-10-17 22:28:04 | 1 | 471 | Jeff |
79,099,969 | 9,251,158 | How to match specific files with a shell pattern in unit test discoverer? | <p>I want to run a suite of unit tests. The basic code is:</p>
<pre class="lang-py prettyprint-override"><code>suite = unittest.defaultTestLoader.discover('tests')
</code></pre>
<p>The documentation for the function mentions the <code>pattern</code> argument, which defaults to <code>test_*.py</code>:</p>
<blockquote>
<... | <python><shell><unit-testing><wildcard> | 2024-10-17 22:05:17 | 2 | 4,642 | ginjaemocoes |
79,099,953 | 1,082,367 | alternative to unstable scan_pyarrow_dataset()? | <p>We are new to polars and pyarrow, and we are trying to work with a pyarrow <a href="https://arrow.apache.org/docs/python/generated/pyarrow.dataset.Dataset.html" rel="nofollow noreferrer">Dataset</a> of .csv (and possibly other) file formats. We are using pyarrow to create the dataset because it supports partitioning... | <python><python-polars><pyarrow> | 2024-10-17 21:57:51 | 1 | 4,224 | Matthew Cornell |
79,099,894 | 13,968,392 | Avoid many line breaks when formatting long lines containing binary operators with Ruff | <p>The ruff formatter generally wraps lines with more than 88 characters (this is the default, i.e. <code>line-length = 88</code>).</p>
<p>Unfortunately, this leads to lines of pathlib paths wrapped in an unpractical fashion:</p>
<pre><code>from pathlib import Path
path_save = Path().cwd().parents[1] / "some"... | <python><line-breaks><formatter><pathlib><ruff> | 2024-10-17 21:34:58 | 1 | 2,117 | mouwsy |
79,099,776 | 4,796,942 | Importing data from Google Business Review to Python `Error 400: redirect_uri_mismatch` | <p>I am trying to import data from Google Business Reviews into Python but keep running into this error `Error 400: redirect_uri_mismatch` even though I followed the documentation <a href="https://support.google.com/business/thread/215701947/how-do-i-get-user-reviews-for-my-business-via-api?hl=en" rel="nofollow norefer... | <python><google-cloud-platform><python-requests><google-business-profile-api> | 2024-10-17 20:41:17 | 1 | 1,587 | user4933 |
79,099,747 | 4,382,391 | code walkthrough of chain syntax in langchain | <p>I am following a RAG tutorial from: <a href="https://medium.com/@vndee.huynh/build-your-own-rag-and-run-it-locally-langchain-ollama-streamlit-181d42805895" rel="nofollow noreferrer">https://medium.com/@vndee.huynh/build-your-own-rag-and-run-it-locally-langchain-ollama-streamlit-181d42805895</a></p>
<p>In the tutoria... | <python><langchain><large-language-model><retrieval-augmented-generation><rag> | 2024-10-17 20:28:12 | 0 | 1,070 | Null Salad |
79,099,612 | 4,048,657 | When I run without CUDA: Function βPowBackward0β returned nan values in its 0th output | <p>My code was running fine <em>with</em> CUDA, but now that I run it with <code>device="cpu"</code>, with the flag <code>torch.autograd.set_detect_anomaly(True)</code>, the runtime error is raised:</p>
<pre class="lang-none prettyprint-override"><code>RuntimeError: Function 'PowBackward0' returned nan values... | <python><pytorch><autograd> | 2024-10-17 19:34:34 | 2 | 1,239 | Cedric Martens |
79,099,393 | 2,837,253 | Raising errors from a generator function immediately | <p>I have a python class that is a wrapper around a datafile containing a number of variables and attributes. Some of these variables may have also have attributes associated with them, and I want to be able to iterate over these attributes using a generator. I want to be able to raise an Exception if a specified varia... | <python> | 2024-10-17 18:23:58 | 1 | 4,778 | MrAzzaman |
79,099,366 | 11,644,167 | Failed to satisfy constraint: Member must satisfy regular expression pattern | <p>I'm trying to follow a simple example from <a href="https://spacy.io/universe/project/Klayers" rel="nofollow noreferrer">spacy universe layers page</a>, but this is failing for me:</p>
<p>Code Implementation:</p>
<pre class="lang-yaml prettyprint-override"><code># template.yaml file
AWSTemplateFormatVersion: "... | <python><amazon-web-services><aws-lambda><spacy><aws-lambda-layers> | 2024-10-17 18:14:53 | 1 | 3,475 | Willian |
79,099,321 | 16,348,170 | VSCODE not showing documentation on hover for external libraries in python for ipynb files | <p>Ok, everytime I import an external library(any external library) in an ipynb file, vscode doesn't show any documentation whatsoever for the external library functions(almost all the time). I have faced this issue multiple times, with almost any library.</p>
<p>For example,
suppose I import a library and use a method... | <python><visual-studio-code><editor> | 2024-10-17 18:01:55 | 1 | 341 | hidden_machine |
79,099,224 | 11,069,614 | How to replace character and split lines in python | <p>I have a text file with a bunch of data like this:</p>
<pre class="lang-none prettyprint-override"><code>DMG*D8*19931219*F**H~AMT*P3*0~NM1*31*1~N3*2670 SO A W GRIMES BO*#6102~N4*ROUND ROCK*TX*786642849~NM1*QD*1*FIGUEROA*LILIET~N3*2670 SO A W GRIMES BO*#6102~N4*ROUND ROCK*TX*786642849~INS*Y*18*024*07*A***TE~REF*0F*81... | <python> | 2024-10-17 17:28:06 | 1 | 392 | Ben Smith |
79,099,138 | 4,985,049 | usage of retain graph in pytorch | <p>I get error if I don't supply <code>retain_graph=True</code> in <code>y1.backward()</code></p>
<pre><code> import torch
x = torch.tensor([2.0], requires_grad=True)
y = torch.tensor([3.0], requires_grad=True)
f = x+y
z = 2*f
y1 = z**2
y2 = z**3
y1.backward()
y2.backward()
</code></pre>
<pre>... | <python><pytorch><tensor><autograd> | 2024-10-17 16:55:58 | 1 | 403 | pasternak |
79,099,118 | 725,932 | Override value in pydantic model with environment variable | <p>I am building some configuration logic for a Python 3 app, and trying to use <code>pydantic</code> and <code>pydantic-settings</code> to manage validation etc. I'm able to load raw settings from a YAML file and create my settings object from them. I'm also able to read a value from an environment variable. But I can... | <python><pydantic><pydantic-settings> | 2024-10-17 16:49:59 | 2 | 3,258 | superstator |
79,099,059 | 5,133,008 | Moving (PyQt6) window not working when python file is compiled with PyInstaller on Linux Fedora | <p>I'm trying to compile a python program. The UI is made with PyQt6, and the main window is frameless. I wanted to implement moving the window manually by using the <code>move()</code> function of a <code>QWidget</code>. When running the Python code itself, it works, but when I compile the code with PyInstaller, the w... | <python><linux><pyqt><pyinstaller><fedora> | 2024-10-17 16:31:56 | 0 | 441 | svs |
79,099,018 | 2,678,716 | Scraping the hulkapps table using Selenium or Beautiful soup | <p>I have this URL that I am trying to scrape: <a href="https://papemelroti.com/products/live-free-badge" rel="nofollow noreferrer">https://papemelroti.com/products/live-free-badge</a></p>
<p>But it seems that I can't find this table class</p>
<pre><code><table class="hulkapps-table table"><thead>... | <python><selenium-webdriver><beautifulsoup> | 2024-10-17 16:19:32 | 1 | 1,383 | Rav |
79,098,960 | 2,826,018 | PyTorch LSTM regression: Take only last output value or take all output values of LSTM? | <p>I try to train my first LSTM regression model based on global average temperature data. The temperature is available for every month since January 1st, 1850.</p>
<p>From what I've learned online, I feed 12 months in a row into the LSTM and letting it predict the next month and I do this for all my sequences generate... | <python><pytorch><regression><lstm> | 2024-10-17 16:02:16 | 0 | 1,724 | binaryBigInt |
79,098,721 | 6,362,595 | Fixing badly formatted floats with numpy | <p>I am reading a text file only containing floating point numbers using <code>numpy.loadtxt</code>. However, some of the data is corrupted and reads something like <code>X.XXXXXXX+YYY</code> instead of <code>X.XXXXXXXE+YY</code> (Missing <code>E</code> char). I'd like to interpret them as the intended floating point n... | <python><numpy> | 2024-10-17 15:06:05 | 2 | 921 | fgoudra |
79,098,671 | 12,304,000 | Loading gsheet data into Python with gspread | <p>This is an example from their docs:</p>
<pre><code>import gspread
credentials = {
"type": "service_account",
"project_id": "api-project-XXX",
"private_key_id": "2cd β¦ ba4",
"private_key": "-----BEGIN PRIVATE KEY-----\nNrDyLw ... | <python><google-sheets><google-api><google-sheets-api><gspread> | 2024-10-17 14:55:29 | 1 | 3,522 | x89 |
79,098,592 | 2,566,283 | How to identify cases where both elements of a pair are greater than others' respective elements in the set? | <p>I have a case where I have a list of pairs, each with two numerical values. I want to find the subset of these elements containing only those pairs that are <em>not</em> exceeded by both elements of another (let's say "eclipsed" by another).</p>
<p>For example, the pair (1,2) is eclipsed by (4,5) because b... | <python><join><optimization><mathematical-optimization><self-join> | 2024-10-17 14:38:08 | 2 | 2,724 | teepee |
79,098,507 | 2,133,561 | Python - Priority-Based Conditional Data Transformation | <p>I have a use case of a form with 3 dropdowns ( A, B and C for this example). They each have 4 options:</p>
<p><a href="https://i.sstatic.net/BOONcxVz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BOONcxVz.png" alt="enter image description here" /></a></p>
<p>Which gives me data per record/ID like th... | <python><for-loop><if-statement><conditional-statements> | 2024-10-17 14:15:04 | 0 | 331 | user2133561 |
79,098,226 | 9,670,009 | The list of urlpatterns should not have a prefix string | <p>In Django 5.0 I get the error:</p>
<p>The list of urlpatterns should not have a prefix string.</p>
<p>My code is:</p>
<pre><code>from django.conf.urls import url
from django.urls import path, include
from django.contrib import admin
app_name = 'AppServer_test' # specified as string literal rather than a variable
... | <python><django><prefix><url-pattern> | 2024-10-17 13:06:22 | 0 | 537 | Tirna |
79,098,010 | 10,737,147 | unwrapping a contour | <p>I have 3 arrays as below</p>
<pre><code>(Pdb) Istag
[[67, 68], [227, 228]]
(Pdb) spl
array([151, 302])
(Pdb) wspl
array([26, 52])
</code></pre>
<p>what these data represents is as per the diagram below;</p>
<p><a href="https://i.sstatic.net/AJMVI48J.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AJ... | <python><numpy><range> | 2024-10-17 12:11:28 | 1 | 437 | XYZ |
79,097,893 | 8,467,078 | Re-decorate a python (class) decorator | <p>I'd like to create a decorator that basically wraps an already existing decorator that has parameters, such that the new decorator acts like the old one with some of the arguments supplied.</p>
<p>Specifically, this is about the builtin <code>@dataclass</code> decorator. I have a number of classes to decorate with i... | <python><python-typing><python-decorators><python-dataclasses> | 2024-10-17 11:38:06 | 3 | 345 | VY_CMa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.