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,617,946 | 1,273,751 | Solve conda-libmamba-solver (libarchive.so.19) error after updating conda to 23.11.0 without reinstalling conda? | <p>After conda update, I am getting the error below after running <code>$ conda</code>, even after setting the solver to classic (using <code>conda config --set solver classic</code>):</p>
<pre><code>Error while loading conda entry point: conda-libmamba-solver (libarchive.so.19: cannot open shared object file: No such ... | <python><conda><libarchive> | 2023-12-07 06:01:10 | 18 | 2,645 | Homero Esmeraldo |
77,617,920 | 2,802,576 | ModuleNotFoundError: No module named - while importing a module from another folder | <p>I am getting the famous - <code>ModuleNotFoundError</code> when I try to import a module from another folder. Here is the folder structure -</p>
<pre><code>packages
- packageA
- src
- packagename
- app.py <-- imports the readers.reader_module
- __init__.py
- readers
... | <python><module><directory><path><package> | 2023-12-07 05:54:10 | 1 | 801 | arpymastro |
77,617,728 | 2,016,850 | How to select p tags without class attributes in Selectolax | <p>I am trying to select some p tags without class attributes using Selectolax without success. This is my code:</p>
<pre><code>from selectolax.parser import HTMLParser
tree = HTMLParser(
'''
<p class="card_street">
<span class="card_street">123 My Rd. </span>
... | <python><css-selectors> | 2023-12-07 04:51:06 | 1 | 1,051 | glenn15 |
77,617,640 | 9,837,010 | Request to AWS AppSync GraphQl endpoint returns 401 Client Error: Unauthorized for url | <p>I'm trying to use PyCognito (AWS Cognito) to authenticate a user and an attached identity pool authenticated role to give permissions to the user to query an AppSync GraphQL endpoint but I'm getting a 401 Client Error: Unauthorized for url .</p>
<p>Minimal Reproducible Example:</p>
<pre><code>from pycognito import C... | <python><amazon-web-services><python-requests><graphql><boto3> | 2023-12-07 04:22:03 | 0 | 479 | Austin Ulfers |
77,617,568 | 1,911,722 | How to use `case_sensitive` option in pathlib glob? | <p>In the documentation of pathlib, it says</p>
<blockquote>
<p>Path.glob(pattern, *, case_sensitive=None)</p>
</blockquote>
<p>There is two things I do not understand.</p>
<ol>
<li><p>what is the second parameter * ?</p>
</li>
<li><p>I want to use <code>case_sensitive</code> option. But when I run</p>
<p><code>somepat... | <python><pathlib> | 2023-12-07 03:51:24 | 1 | 2,657 | user15964 |
77,617,540 | 8,968,910 | Python: split column when it contains certain word and append a string in the end | <p>I have a dataframe with column called <code>address</code>:</p>
<pre><code>address
xxx City yyy road 17 number 8 floor west bank
ttt City iii road 1 number
ggg City kkk road 25 number 1 floor apple store
</code></pre>
<p>If the address contains <code>floor</code>, I need to split it and get the address before it. Si... | <python><pandas> | 2023-12-07 03:43:06 | 2 | 699 | Lara19 |
77,617,514 | 16,405,935 | Pandas concat multiple excel file in folder by pre defined sheets | <p>I'm trying to concat multiple files in folder with pre defined sheets name (Because each file has some sheets that I don't want to concat) but I got a problem as below. I'm trying to do with below code:</p>
<pre><code>from pathlib import Path
import pandas as pd
import glob
import io
folder = Path(r'D:\Test\New fold... | <python><pandas><concatenation> | 2023-12-07 03:32:51 | 1 | 1,793 | hoa tran |
77,617,326 | 4,225,430 | No floating points needed, but still flag type error float() in producing time series decomposition | <p>I self-learn time series decomposition with python. I get a float() type error.</p>
<p>My data source is from government open data. Basically, I want to visualize the trend of high speed rail passenger flow after the end of covid travel restriction. The time period is 2023 Jan to Nov.</p>
<p>The first part is data c... | <python><pandas><time-series><timestamp> | 2023-12-07 02:24:11 | 1 | 393 | ronzenith |
77,617,256 | 312,662 | Operator overloading on classes themselves | <p>I feel like this code should work, but the second expression fails. Why is that?</p>
<pre><code>class Foo:
@classmethod
def __matmul__(cls, other):
return "abc" + other
print(Foo.__matmul__("def")) # OK
print(Foo @ "def") # TypeError: unsupported operand type(s) for ... | <python><operator-overloading><class-method> | 2023-12-07 01:59:59 | 2 | 1,509 | nick maxwell |
77,617,211 | 558,639 | Is it possible to rescale a tkinter PhotoImage (not from a file)? | <p>Assume I have a 96 x 96 PhotoImage generated algorithmically (not from a file), e.g.:</p>
<pre><code>import tkinter
IMG_W = 96
IMG_H = 96
class App:
def __init__(self, t):
self.i = tkinter.PhotoImage(width=IMG_W,height=IMG_H)
for row in range(0, IMG_H):
for col in range(0, IMG_W):
... | <python><tkinter> | 2023-12-07 01:39:52 | 2 | 35,607 | fearless_fool |
77,617,074 | 7,385,884 | Handling a ValidationError from inputs not conforming to a provided args_schema with a structured tool in langchain | <p>I am trying to come up with the correct way to capture and handle a pydantic <code>ValidationError</code> caused by structured tool arguments not conforming to a provided <code>args_schema</code>.</p>
<p>I am creating structured tools with the <code>StructuredTool.from_function(...)</code> and providing an <code>arg... | <python><error-handling><pydantic><langchain><py-langchain> | 2023-12-07 00:45:43 | 0 | 1,553 | istrupin |
77,617,031 | 17,028,242 | Converting HuggingFace Tokenizer to TensorFlow Keras Layer | <p>I am struggling to understand how to perform inference with a pre-trained HuggingFace model loaded as a TensorFlow Keras model.</p>
<p><strong>Context</strong></p>
<p>In my case, I am trying to fine-tune a pre-trained DistilBert classifier. I have something as follows to preprocess my data and load/train my model:</... | <python><tensorflow><keras><huggingface-transformers> | 2023-12-07 00:28:35 | 3 | 458 | AndrewJaeyoung |
77,616,969 | 5,203,117 | Pandas future warning for idxmax() & idxmin() question? | <p>python 3.9.13, pandas 2.1.3</p>
<pre><code>blahblah.py:29: FutureWarning: The behavior of DataFrame.idxmax with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueError df['max days'] = df[columns].idxmax(axis=1)
</code></pre>
<p>Same warning with: <code>skipna=False... | <python><pandas><dataframe> | 2023-12-06 23:58:45 | 1 | 597 | John |
77,616,803 | 787,675 | Dump kubernetes resource to yaml manifest with kr8s python library | <p>Is there any way to dump existing resources in kubernetes cluster to yaml manifests with <code>kr8s</code> python library? Usually, you apply yaml manifests with <code>kubectl apply -f .</code>, and this is for reverse process to extract them from kubernetes cluster.</p>
<p>Thanks.</p>
| <python><kubernetes><kr8s> | 2023-12-06 23:01:11 | 1 | 717 | Stanislav Hordiyenko |
77,616,738 | 4,867,951 | Matplotlib axes formatter is not working correctly in Seaborn Stripplot | <p>For some reason, when I try to use a <a href="http://matplotlib.org/api/ticker_api.html#matplotlib.ticker.FuncFormatter" rel="nofollow noreferrer">matplotlib.ticker.FuncFormatter</a> to reformat the x axis of a seaborn stripplot, it reformats the positions instead of the labels, MWE below. Using the same formatter f... | <python><pandas><matplotlib><seaborn> | 2023-12-06 22:42:09 | 1 | 634 | Jazz Weisman |
77,616,659 | 9,137,547 | Error type hinting tuple (Vs code Microsoft Python extension) | <p>I like annotating my code and keeping the python extensions type checks in semi-strict mode. I often use generators to create tuples and with variable length tuples I had no problem but I just noticed that when I write something like:</p>
<pre><code>my_tup : tuple[int, int, int] = tuple(i for i in range(3))
</code><... | <python><python-typing> | 2023-12-06 22:26:27 | 0 | 659 | Umberto Fontanazza |
77,616,586 | 15,239,717 | How can I process Image in Django | <p>In my Django Application, I am using imagekit to process images in my model but any time I try uploading image error says: module 'PIL.Image' has no attribute 'ANTIALIAS'. Initially, I never had issues with it but recently any time I try to save my form, I get that error. I have upgraded Pillow and used ImageFilter.... | <python><django><python-imaging-library> | 2023-12-06 22:08:48 | 1 | 323 | apollos |
77,616,578 | 6,651,650 | Named Pipes in Linux with Python read/write miss some lines of text | <p>I am learning how to use named pipes to pass data between processes. To test it out, I wrote two Python scripts, which I called <code>pipewriter.py</code> and <code>pipereader.py</code>, and a named pipe called <code>my_pipe</code> (using <code>mkfifo my_pipe</code>), all in the same directory. The Python scripts ar... | <python><linux><pipe><named-pipes> | 2023-12-06 22:06:55 | 0 | 2,813 | Paul Wintz |
77,616,528 | 19,675,781 | Pandas.loc() return empty values for unavailable indexes | <p>I have a dataframe like this:</p>
<pre><code>ind,l1,l2 = [0,1,0],[1,1,0],[0,0,1]
df = pd.DataFrame([ind,l1,l2],columns=[['C1','C2','C3']])
df.index=[['A','C','E']]
</code></pre>
<p><a href="https://i.sstatic.net/e5ba1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e5ba1.png" alt="enter image descript... | <python><pandas><dataframe><indexing> | 2023-12-06 21:53:52 | 1 | 357 | Yash |
77,616,513 | 890,269 | nginx unit + django + docker - wsgi.py cannot import module | <p>Currently containerizing a legacy Django project, and running into an odd error.</p>
<p>When pushing the config file to the running server, it fails to apply, and on inspecting the log, I get the following:</p>
<pre><code>2023/12/06 21:36:02 [info] 39#39 discovery started
2023/12/06 21:36:02 [notice] 39#39 module: p... | <python><django><docker><nginx> | 2023-12-06 21:50:50 | 2 | 1,056 | Lucifer N. |
77,616,388 | 5,839,462 | How to catch or process RequestValidationError exceptions differently in a FastAPI middleware? | <p>How to correctly combine <code>RequestValidationError</code> exception handlers, such as:</p>
<pre><code>@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
response = prepare_response({}, g_ERROR__INCORRECT_PARAMS)
return JSONResponse(content=response)
</cod... | <python><exception><fastapi><middleware><fastapi-middleware> | 2023-12-06 21:23:15 | 2 | 1,448 | Zhihar |
77,616,353 | 3,376,169 | Apply Rules to pandas dataframe based on criteria defined in rules table | <p>I have tbl_df with cols col1, col2, col3, col4, col5,col6. It has about 7million rows
I have corresponding rules_df with some cells with wild card as * as follows. There are about 20 rules:</p>
<pre><code> col1 col2 col3 col4 value
Rule1 E * P * 1
Rule2 B * P * 2
Rule3 S * P * ... | <python><pandas> | 2023-12-06 21:18:12 | 1 | 439 | user3376169 |
77,616,133 | 519,422 | Python Pandas: how to get data from a website into a dataframe by searching for values following key words? | <p>I asked <a href="https://stackoverflow.com/questions/77566914/how-to-write-specific-values-from-a-pandas-python-dataframe-to-a-specific-plac/77567039#77567039">this</a> question recently and received very helpful advice. I have been building on the advice but have again encountered a problem I can't solve. I would... | <python><python-3.x><pandas><dataframe><file-io> | 2023-12-06 20:31:25 | 1 | 897 | Ant |
77,616,121 | 11,739,577 | Scraping a dropdown menu to return name of items using BS4 | <p>I have the following XML. It is from a menu called Knives with sub-types like Bayonet, Classic Knife, etc.</p>
<pre><code><div class="group inline-block relative w-full lg:w-auto">
<button class="navbar-subitem-trigger text-left py-2 focus:outline-none hover:text-white w-full lg:w-auto block ... | <python><beautifulsoup> | 2023-12-06 20:29:24 | 1 | 793 | doomdaam |
77,616,090 | 455,796 | Python humanize.naturalsize() remove trailing 0's in the fraction | <p>Is it possible to get the output of</p>
<pre><code>1M
1.01M
</code></pre>
<p>by changing the <code>format</code>'s value in the following code?</p>
<pre><code>import humanize
format = "%.2f"
raw1 = 1_048_576;
raw2 = 1_058_576
print(humanize.naturalsize(raw1, format=format, gnu=True));
print(humanize.nat... | <python><humanize> | 2023-12-06 20:22:51 | 2 | 12,654 | Damn Vegetables |
77,616,054 | 6,728,433 | Extract "values" from VectorUDT sparse vector in pyspark | <p>I have a pyspark dataframe with 2 vector columns.
When I show the dataframe in my notebook, it prints each vector like this: {"vectorType": "sparse", "length": 262144, "indices": [21641], "values": [1]}</p>
<p>When I print the schema, it shows up as VectorUDT.</p>
<p... | <python><pyspark><vector><azure-databricks> | 2023-12-06 20:15:38 | 2 | 798 | S.S. |
77,615,797 | 5,094,261 | sqlalchemy 2.0 orm bulk upsert one-to-many relationships | <p>I am trying to bulk insert into multiple tables using sqlalchemy 2.0 ORM using the async engine. The table hierarchy is as follows.</p>
<pre><code>table A -> table B -> table C
</code></pre>
<p>During insertion, I get a batch of JSON objects resembling table A which contain the table B and table C data as well... | <python><postgresql><sqlalchemy><one-to-many> | 2023-12-06 19:25:07 | 0 | 1,273 | Shiladitya Bose |
77,615,693 | 4,896,087 | How to assign values from dict with more arguments than function? | <p>I want to use the <code>**kwargs</code> syntax to assign values to function inputs. However, my dictionary containing the keywords have more arguments than the function. How can I use dict <code>p</code> to provide input values for the fucntion <code>func</code>?</p>
<pre><code>p = {'a': 1, 'b': 2, 'c': 3}
def func... | <python> | 2023-12-06 19:03:28 | 1 | 3,613 | George Liu |
77,615,464 | 7,563,454 | Python, tkinter: Use multiprocessing.Pool() in a class instance, get new data from pool in a function that runs every second | <p>I'm still struggling to get a thread pool working inside a class instance. In a file we'll call <code>test.py</code> I have the following:</p>
<pre><code>import multiprocessing as mp
class Test:
def __init__(self):
pass
def exec(self):
pool = mp.Pool()
result = pool.map(self.thread,... | <python><python-3.x><multithreading><tkinter><multiprocessing> | 2023-12-06 18:19:08 | 1 | 1,161 | MirceaKitsune |
77,615,427 | 3,817,518 | random vector generation which meets a certain condition | <p>Suppose G is a matrix of (100 , 20 ) and h is vector of ( 100).</p>
<p>How do I randomly generate a vector x of size 100 that meets the condition G x <= h ?</p>
<p>Clearly, I can do something like the following. But, that is inefficient if I want to generate thousands of these points. Thanks.</p>
<pre><code>impo... | <python><numpy><random><probability-density> | 2023-12-06 18:13:28 | 3 | 1,986 | nyan314sn |
77,615,407 | 10,985,257 | dependency hell with python-apt | <p>I am building a package which is dependent on two packages, which are difficult to handle.</p>
<p>The two problematic packages are:</p>
<ul>
<li>python-apt (<a href="https://pypi.org/project/python-apt/" rel="nofollow noreferrer">PyPI</a>, <a href="https://apt-team.pages.debian.net/python-apt/library/index.html" rel... | <python><pip><apt><python-venv> | 2023-12-06 18:10:44 | 0 | 1,066 | MaKaNu |
77,615,373 | 19,009,577 | How to split a generator into smaller generators while discarding excess | <p>Split generator of size a*n + b into 1 generator consisting of a generators with n items. There is a similar question <a href="https://stackoverflow.com/questions/24527006/split-a-generator-into-chunks-without-pre-walking-it">here</a>, and I need similar things like</p>
<ul>
<li><p>do not walk the generator beforeha... | <python><generator> | 2023-12-06 18:04:41 | 1 | 397 | TheRavenSpectre |
77,615,257 | 850,781 | Avoid RuntimeWarning using where | <p>I want to apply a function to a <code>numpy</code> array, which goes through infinity to arrive at the correct values:</p>
<pre class="lang-py prettyprint-override"><code>def relu(x):
odds = x / (1-x)
lnex = np.log(np.exp(odds) + 1)
return lnex / (lnex + 1)
x = np.linspace(0,1,10)
np.where(x==1,1,relu(x... | <python><numpy><floating-point> | 2023-12-06 17:46:30 | 1 | 60,468 | sds |
77,615,205 | 13,283,988 | Heroku API for data processing and Postgres post | <p>I'm attempting to write my first API. I wrote (with help of GPT), a simple Request script and I uploaded the Dash-API script to Heroku. I'm getting input from multiple remote locations and I wish to add the remote data to a common Postgres database. I'm uncertain if Heroku dash-style app can be used as an API becaus... | <python><plotly-dash><heroku-postgres> | 2023-12-06 17:39:10 | 1 | 303 | Robert Marciniak |
77,615,189 | 8,849,755 | Python ctypes deepcopy structure | <p>I am not very used to python ctypes, so sorry if this is a naive question. I am trying to copy a struct, this is my code:</p>
<pre class="lang-py prettyprint-override"><code>from ctypes import *
class Group(Structure):
_fields_ = [
("ChSize", c_uint32*9),
("DataChannel", POIN... | <python><ctypes><deep-copy> | 2023-12-06 17:36:36 | 1 | 3,245 | user171780 |
77,614,910 | 7,563,454 | Python: Can multiprocessing.Pool() be used in modules other than '__main__'? | <p>I have the following simple case of using a thread pool:</p>
<pre><code>import multiprocessing as mp
def double(i):
return i * 2
def main():
pool = mp.Pool()
for result in pool.map(double, [1, 2, 3]):
print(result)
main()
</code></pre>
<p>For over a day I've been trying to figure out why runni... | <python><python-3.x><multithreading> | 2023-12-06 16:49:47 | 1 | 1,161 | MirceaKitsune |
77,614,839 | 2,043,974 | twisted integrating blocking confluent-kafka pythong library issues | <p>Lets consider this piece of code</p>
<pre><code>from twisted.web import server, resource
from twisted.internet.task import LoopingCall
from confluent_kafka import Consumer, KafkaException
import json
# Function to handle Kafka consumer
def kafka_consumer():
def fetch_data():
def poll_kafka():
... | <python><apache-kafka><twisted><confluent-kafka-python> | 2023-12-06 16:37:34 | 1 | 1,712 | Jithin |
77,614,611 | 5,519,012 | How to ignore dependency if already installed by Poetry install | <p>I want to install <code>package-1</code> using <code>poetry install</code>, <code>package-1</code> depends on <code>package-2</code>, so when executing <code>poetry install</code> - poetry tries to update <code>package-2</code>.
But <code>package-2</code> have no published compiled release, so it should be compiled ... | <python><containers><python-poetry> | 2023-12-06 16:00:19 | 0 | 365 | Meir Tolpin |
77,614,523 | 19,009,577 | Why does try except not catch StopIteration when trying to split generator into generators | <p>Attempt to split generator of size a*n + b into 1 generator with an items of size n each.</p>
<p>I believe there already exist questions to this problem with minimal modifications <a href="https://stackoverflow.com/questions/24527006/split-a-generator-into-chunks-without-pre-walking-it">here</a>. However its perplex... | <python><generator> | 2023-12-06 15:49:13 | 1 | 397 | TheRavenSpectre |
77,614,456 | 4,486,184 | Detect when global variables are used (Linter notification or other static analysis tools) | <p>In a rush, I often forget the <code>self.</code> before properties:</p>
<pre class="lang-py prettyprint-override"><code>from dataclasses import dataclass
class Game:
agent_speed = 1
@dataclass
class Agent:
x: int
def move(self):
# Here, I forgot self.
x += Game.agent_speed
a = Agent(1)
a.move()
print... | <python><static-analysis> | 2023-12-06 15:39:52 | 0 | 1,604 | Camusensei |
77,614,375 | 2,897,115 | How to convert a JSON string to dataframe? | <p>I am trying to convert a JSON string to dataframe. I am not able to do.</p>
<pre><code>import findspark
findspark.init()
from pyspark.sql import SparkSession
spark = SparkSession.builder \
.appName("MyApp") \
.getOrCreate()
sc=spark.sparkContext
some_json_string = """
[
{"id&... | <python><pyspark> | 2023-12-06 15:29:09 | 1 | 12,066 | Santhosh |
77,614,372 | 16,383,578 | How to decrypt substitution cipher with keys with multiple letters? | <p>I have found the following encoded message <a href="https://scp-wiki.wikidot.com/pitch-haven-hub" rel="nofollow noreferrer">here</a>, it is obviously in hexadecimal and each two digit sequence corresponds to a byte, decoding the byte sequence gives the following message:</p>
<pre><code>"UAYUYAF FOY YIรZYUA'W KY... | <python><cryptography> | 2023-12-06 15:28:48 | 0 | 3,930 | ฮฮญฮฝฮท ฮฮฎฮนฮฝฮฟฯ |
77,614,341 | 298,209 | Access partial stdout and stderr when create_subprocess_shell() times out | <p>I'm trying to use asyncio's <a href="https://docs.python.org/3/library/asyncio-subprocess.html" rel="nofollow noreferrer">subprocess</a> (e.g. <code>create_subprocess_shell</code>) instead of the usual ordinary subprocess module and I can't figure out how to access stdout and err when the task times out:</p>
<p>In t... | <python><python-asyncio> | 2023-12-06 15:21:52 | 0 | 5,580 | Milad |
77,614,255 | 6,645,564 | How do I generate a dynamic list of discrete colors (in rgb format) from Plotly? | <p>I am trying to make some plots using plotly and matplotlib, and the data that I am using usually is sorted into around 4 to 8 different groups, each of which I set to one discrete color within my plot. I found a good resource here (<a href="https://plotly.com/python/discrete-color/" rel="nofollow noreferrer">https:/... | <python><matplotlib><plotly> | 2023-12-06 15:09:47 | 1 | 924 | Bob McBobson |
77,614,223 | 8,176,763 | Sqlalchemy dynamic where statements | <p>From sqlalchemy documentation we have the following example:</p>
<pre><code>s = (
select((users.c.fullname + ", " + addresses.c.email_address).label("title"))
.where(users.c.id == addresses.c.user_id)
.where(users.c.name.between("m", "z"))
.where(
or_(
addresses.c.... | <python><sqlalchemy> | 2023-12-06 15:06:45 | 1 | 2,459 | moth |
77,614,137 | 5,447,434 | How to perform time series analysis on cpu utilization data using python | <p>I am new to time series analysis. I have the following dummy data:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Timestamp</th>
<th>Cpu_utilization_Percentage</th>
<th>Server_name</th>
</tr>
</thead>
<tbody>
<tr>
<td>2022-01-11 00:05:00</td>
<td>80</td>
<td>abc</td>
</tr>
<tr>
<td>2022... | <python><time-series><xgboost><arima><multivariate-time-series> | 2023-12-06 14:52:42 | 0 | 323 | Niranjanp |
77,614,092 | 1,234,434 | How to extract all rows from a pandas dataframe given a series object | <p>I have the following data as a dataframe:</p>
<pre><code>Date Category Sales Paid
8/12/2020 Table 1 table Yes
8/12/2020 Chair 3chairs Yes
13/1/2020 Cushion 8 cushions Yes
24/5/2020 Table 3Tables Yes
31/10/2020 Chair 12 Chairs No
11/7/2020 M... | <python><python-3.x><pandas><dataframe> | 2023-12-06 14:47:23 | 1 | 1,033 | Dan |
77,614,084 | 6,060,982 | Are type vars and type unions incompatible in python? | <p>Consider the following snippet:</p>
<pre class="lang-py prettyprint-override"><code>from typing import TypeVar
import numpy as np
T = TypeVar("T", float, np.ndarray)
def f(x: T) -> T:
"""
expects a float or an array and returns an output of the same type
"""... | <python><python-typing><pyright><type-variables> | 2023-12-06 14:46:46 | 2 | 700 | zap |
77,613,977 | 8,392,919 | Python Byte-encoding functions do not work as expected | <p>I'm trying to convert a hexadecimal number,
like the stack address <code>0x7ffd6fa90940</code>,<br />
into its corresponding Byte representation <code>b'\x40\x09\xa9\x6f\xfd\x7f\x00\x00'</code>.<br />
Just like how it is represented in gdb:</p>
<pre><code>pwndbg> hexdump $rsp \32
+#### 0x7fffffffdc## 0 1 2 3... | <python><byte><endianness><pwntools><binascii> | 2023-12-06 14:35:06 | 1 | 547 | PatrickSteiner |
77,613,936 | 11,159,734 | How to create a vector search index in Azure AI search using v11.4.0 | <p>I want to create an Azure AI Search index with a vector field using the currently <a href="https://pypi.org/project/azure-search-documents/" rel="nofollow noreferrer">latest version</a> of azure-search-documents v11.4.0.</p>
<p>Here is my code:</p>
<pre><code>from azure.core.credentials import AzureKeyCredential
f... | <python><azure><azure-cognitive-services> | 2023-12-06 14:28:25 | 2 | 1,025 | Daniel |
77,613,924 | 521,347 | How to access PCollection from DB I/O connector in next step in Pipeline | <p>I have written a small pipeline using Apache-beam.It uses beam-postgres as Input connector to create a PCollection from a DB table.
The code looks like following-</p>
<pre><code>import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from psycopg.rows import dict_row
from beam_pos... | <python><apache-spark><google-cloud-dataflow><apache-beam> | 2023-12-06 14:27:14 | 2 | 1,780 | Sumit Desai |
77,613,786 | 447,426 | List is doubled only if run from console and initialized on field declaration | <p>I have a test that asserts at the end the length of 2 fields (list) of object under test.
The test is green if run from IntelliJ (either test class or test method).</p>
<pre><code>class TestExtractLegsAndPhase:
@staticmethod
def extract_tsv() -> str:
path: str = (os.path.dirname(os.path.realpath(... | <python><pytest> | 2023-12-06 14:09:01 | 1 | 13,125 | dermoritz |
77,613,285 | 15,456,681 | How to implement np.lib.stride_tricks.sliding_window_view efficiently in JAX? | <p>I have implemented an algorithm in which I calculate the <a href="https://en.wikipedia.org/wiki/Pearson_correlation_coefficient" rel="nofollow noreferrer">Pearson correlation coefficient</a> between a vector in one image and every vector in another image within a given window around the equivalent pixel. In pure num... | <python><numpy><optimization><numba><jax> | 2023-12-06 13:03:46 | 0 | 3,592 | Nin17 |
77,612,658 | 14,351,788 | Formula to project a line onto a plane | <p>I have a vector and project it onto a plane. I tried to compute the projection but I found the formula seems not correct.</p>
<p><a href="https://i.sstatic.net/WrkVA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WrkVA.png" alt="enter image description here" /></a></p>
<p>Here is my code:</p>
<pre><c... | <python><math><3d><projection> | 2023-12-06 11:27:08 | 1 | 437 | Carlos |
77,612,615 | 22,113,674 | Databricks sql - Insert multiple rows using python list values | <p>I have a list of values -
['a', 'b', 'c']</p>
<p>I have a delta table. Consider below one as an example -</p>
<p><a href="https://i.sstatic.net/0VXEs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0VXEs.png" alt="enter image description here" /></a></p>
<p>I am iterating a dataframe in a for loop and... | <python><databricks-sql> | 2023-12-06 11:18:08 | 2 | 339 | mpr |
77,612,605 | 1,693,057 | How Does `case AsyncGenerator():` Work in Python's `match` Statement Without Raising an Exception? | <p>I'm seeking clarity on the use of abstract classes within Python's <code>match</code> statement, specifically the <code>AsyncGenerator</code> from the <code>collections.abc</code> module. In a <code>match</code> statement, using <code>AsyncGenerator()</code> in a <code>case</code> pattern confuses me as it resembles... | <python><python-3.x><pattern-matching><abstract-class> | 2023-12-06 11:15:46 | 0 | 2,837 | Lajos |
77,612,458 | 13,146,029 | Resource punkt not found. In VENV | <p>I have an application that uses ChatterBot - right now it's a simple conversation application. Anyway I started to use a VENV to start the app and now I have an issue with nltk</p>
<p>I'm not sure where in the app it's being used but when I try to run I get that error</p>
<pre><code> Resource punkt not found.
Plea... | <python> | 2023-12-06 10:55:09 | 0 | 317 | Graham Morby |
77,612,387 | 12,081,269 | How can I create conditional column for two sets in a window of a key? | <p>I have two tables with information on retailers users used in pre- and post-periods. My goal is to find what retailers were new for users in postperiod. I wonder how to do it in a <code>user_id</code> window, because <code>is_in()</code> and <code>loc[]</code> solutions do not fit well for my task. Also I was thinki... | <python><pandas> | 2023-12-06 10:45:23 | 1 | 897 | rg4s |
77,612,193 | 972,647 | Uniquify list and get indices of matching elements | <p>I have a list, say <code>[a, b, c, a, a, b]</code>. I want as output to get a list of indices of the matching elements. for this example it would then be <code>[[0, 3, 4], [1, 5]]</code>.</p>
<p>The lists will be small so performance or memory use is not of importance. is there already a built-in function for lists ... | <python> | 2023-12-06 10:16:02 | 3 | 7,652 | beginner_ |
77,612,182 | 14,830,534 | Merge pandas dataframes with multiindex columns | <p>How can I merge two dataframes in <code>pandas</code> that both have multi-index columns. The merge should be an outer merge on a column that is present in both dataframes. See minimal example and resulting error below:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
# Sample DataFrames with... | <python><pandas><dataframe> | 2023-12-06 10:14:20 | 1 | 1,106 | Jan Willem |
77,611,699 | 2,641,825 | In quarto, is it possible to cross reference a figure in another document? | <p>I am writing an article in one quarto <code>.qmd</code> document and would like to refer to a figure that is in an annex in another <code>.qmd</code> document.</p>
<p>Reproducible example:</p>
<ul>
<li>article.qmd</li>
</ul>
<pre><code>See Figure @fig-a in the annex for details.
</code></pre>
<ul>
<li>annex.qmd</li>... | <python><r><markdown><quarto> | 2023-12-06 08:57:37 | 1 | 11,539 | Paul Rougieux |
77,611,637 | 3,291,993 | Jupyter Notebook cell run doesn't finalize | <p>When I run Python code in the jupyter notebook, I got the following error, and cell doesn't finalize.</p>
<p>However, if I run the same Python code in the command line, it finishes its run without any problem.</p>
<pre><code>[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
Fil... | <python><jupyter-notebook> | 2023-12-06 08:47:35 | 1 | 1,147 | burcak |
77,611,116 | 1,509,695 | Does Python's object class come with an id-based equality method built in? | <p>Does Python's <code>object</code> class indeed come with an id-based equality method built in?</p>
<pre><code>class A(object):
def __init__(self, i):
self.i = i
def test_keyset():
i1 = A(1)
i2 = A(1)
# fails:
assert i1 == i2
</code></pre>
| <python> | 2023-12-06 07:02:49 | 0 | 13,863 | matanox |
77,610,957 | 1,113,579 | Installing Poppler for Windows without using package manage for Windows | <p>I have gone thru <a href="https://stackoverflow.com/questions/18381713/how-to-install-poppler-on-windows/62615998">How to install Poppler on Windows?</a> Currently I do not use a package manager for Windows, like conda or scoop or chocolatey, and I wish to install poppler-utils without using a package manager. Is th... | <python><python-3.x><poppler><poppler-utils> | 2023-12-06 06:31:51 | 1 | 1,276 | AllSolutions |
77,610,686 | 159,072 | Why does the one-hot-encoding give worse accuracy in this case? | <p>I have two directories, <code>train_data_npy</code> and <code>valid_data_npy</code> where there are 3013 and 1506 <code>*.npy</code> files, respectively.</p>
<p>Each <code>*.npy</code> file has 11 columns of float types, of which the first eight columns are features and the last three columns are one-hot-encoded lab... | <python><tensorflow><machine-learning><keras><auto-keras> | 2023-12-06 05:12:08 | 2 | 17,446 | user366312 |
77,610,633 | 6,245,473 | Adding yfinance historical price data onto dataframe without hard-coding dates (using dates already in the dataframe) | <p>The following code pulls balance sheet data using yfinance. I would like to get the close price as of the corresponding dates in the dataframe on the last row without hard coding dates.</p>
<pre><code>import yfinance as yf
ticker_object = yf.Ticker('AAPL')
balancesheet = ticker_object.balancesheet
# Select specif... | <python><pandas><dataframe><stock><yfinance> | 2023-12-06 04:52:06 | 1 | 311 | HTMLHelpMe |
77,610,309 | 3,835,843 | gcloud-aio-storage can't upload more than 2GB data | <p><a href="https://talkiq.github.io/gcloud-aio/autoapi/storage/index.html#usage" rel="nofollow noreferrer">gcloud-aio-storage</a> is working in-memory fashion. It requires file content to upload, while we try to get file content from a larger file (more than 2GB), it says:</p>
<blockquote>
<p>OverflowError: string lon... | <python><upload><gcloud> | 2023-12-06 02:55:08 | 0 | 6,588 | Arif |
77,610,206 | 3,121,975 | Get run config from Dagster RunFailureSensorContext | <p>I've setup a sensor in Dagster:</p>
<pre><code>@sensor(job=excel_to_csv)
def convert_unit_list(ctx: SensorEvaluationContext):
env = os.getenv("ENVIRONMENT")
region = os.getenv("AWS_REGION")
appcfg = AppConfig("unit-ingestion", "developer-units", env, region)
... | <python><dagster> | 2023-12-06 02:12:42 | 1 | 8,192 | Woody1193 |
77,609,981 | 7,563,454 | Python thread pools not working: pool.map freezes, pool.map_async returns a MapResult that's not iterable | <p>I'm trying to use the <code>multiprocessing.Pool()</code> function as it seems most fit for my project. I've followed several tutorial articles on how it works and attempted their examples. Some that I'm referring to:</p>
<p><a href="https://superfastpython.com/threadpool-python" rel="nofollow noreferrer">https://su... | <python><python-3.x><multithreading> | 2023-12-06 00:39:53 | 1 | 1,161 | MirceaKitsune |
77,609,841 | 1,887,919 | Fastest way to construct sparse block matrix in python | <p>I want to construct a matrix of shape <code>(N,2N)</code> in Python.</p>
<p>I can construct the matrix as follows</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
N = 10 # 10,100,1000, whatever
some_vector = np.random.uniform(size=N)
some_matrix = np.zeros((N, 2*N))
for i in range(N):
... | <python><arrays><numpy><array-broadcasting> | 2023-12-05 23:46:48 | 3 | 923 | user1887919 |
77,609,745 | 2,446,332 | Trouble getting dict.setdefault to work with tuple argument | <pre><code>#!/bin/python
import logging
import sys
logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(name)s - %(message)s",
level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S",
stream=sys.stdout,
)
logger = logging.getLogger("mylogger")
cache = {}
# Relevant stuff ... | <python><dictionary><setdefault> | 2023-12-05 23:16:48 | 1 | 1,363 | Lyle Z |
77,609,499 | 4,537,160 | Python - import issue, how is path entry determined? | <p>I have this folder structure:</p>
<pre><code>main_folder/
-- tests/
---- test01.py
-- some_package/
</code></pre>
<p>with the file test01.py containing the import statement</p>
<pre><code>import some_package
</code></pre>
<p>I'm running test01.py from <code>main_folder</code>:</p>
<pre><code>python tests/test01.py
<... | <python><python-import> | 2023-12-05 22:08:19 | 2 | 1,630 | Carlo |
77,609,489 | 8,167,752 | python-pptx: How do a enter the title text on a "Section and Header" slide | <p>I'm using the pptx module to create a PowerPoint "Section Header" slide, where I then enter the section title.</p>
<pre><code>import pptx
from pptx import Presentation
prs = Presentation()
mySectionHeaderSlide = prs.slides.add_slide(prs.slide_layouts[2])
mySectionHeaderSlide.shapes.title.text = "Thi... | <python><powerpoint><python-pptx> | 2023-12-05 22:07:42 | 0 | 477 | BobInBaltimore |
77,609,454 | 5,839,462 | fastapi: use middleware to generate a result in which the original result is included as an element | <p>there is this code:</p>
<pre><code>from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
app = FastAPI()
@app.middleware("http")
async def response_middleware(request: Request, call_next):
# execute the request
results = await call_next(request)
return JSONResponse(... | <python><python-3.x><fastapi><middleware><fastapi-middleware> | 2023-12-05 21:58:30 | 0 | 1,448 | Zhihar |
77,609,401 | 6,272,006 | YTM different to zero rates on zero-coupon bonds and issues with settlement days on discounting in QuantLib Python | <p>I have bootstrapped the the yield curve using both zero-coupon bonds and fixed coupon bonds using the code below;</p>
<pre><code># Importing Libraries:
# The code imports necessary libraries:
# pandas for data manipulation, matplotlib.pyplot for plotting, and QuantLib (ql) for quantitative finance calculations.
impo... | <python><quantitative-finance><quantlib> | 2023-12-05 21:43:07 | 1 | 303 | ccc |
77,609,289 | 18,366,396 | Update firebase messaging using python and django | <p>I am using Firebase Admin SDK in Python.</p>
<pre><code>//import sdk
import firebase_admin
from firebase_admin import credentials, messaging
//saved json credentials from google in a private storage
json_file = settings.PRIVATE_STORAGE_JSON_FIREBASE + "/" + "firebase_json/" + "firebase_js... | <python><firebase-cloud-messaging><firebase-admin> | 2023-12-05 21:18:06 | 1 | 841 | saro |
77,609,191 | 14,012,215 | How do I filter using the external Odoo API? | <p>My code is as such</p>
<pre><code> search_domain = [
'&',
('product_id', '=', 'Product_x'),
'&',
('lot_id', '=', 'AG:04/10/2023:UID520:6666'),
('on_hand', '=', True),
]
# Use the search domain to find the specific location
lookuplocationbasedonname = models.execute_kw(db, uid, passwo... | <python><odoo> | 2023-12-05 20:55:48 | 2 | 433 | apexprogramming |
77,609,189 | 678,572 | How to use Nextflow to call scripts from different environments? | <p>I have the following conda environments:</p>
<ul>
<li><code>wf-preprocess_env</code></li>
<li><code>wf-assembly_env</code></li>
</ul>
<p>Each environment has unique dependencies installed. I have 3 scripts:</p>
<ul>
<li><code>preprocess.py</code> which I use with <code>wf-preprocess_env</code> environment</li>
<li>... | <python><anaconda><conda><pipeline><nextflow> | 2023-12-05 20:55:20 | 0 | 30,977 | O.rka |
77,608,787 | 8,849,755 | Python ctypes copy structure located in temporary buffer | <p>I have a code that looks like this:</p>
<pre class="lang-py prettyprint-override"><code>from ctypes import *
some_library = CDLL('/usr/lib/black_box.so')
# This `Group` comes from `some_library`
class Group(Structure):
_fields_ = [
("ChSize", c_uint32*9),
("DataChannel", POIN... | <python><copy><ctypes> | 2023-12-05 19:23:52 | 1 | 3,245 | user171780 |
77,608,756 | 8,030,746 | Why my scraping with Selenium is not working on Digital Ocean droplet? | <p>I'm working with Digital Ocean and droplets for the first time, and I can't get my Selenium script to work. At first I was getting the <code>DevToolsActivePort file doesn't exist</code> error, however, now my script is just not returning anything. It's not actually finishing at all. I tried adding ports and specify... | <python><selenium-webdriver><digital-ocean> | 2023-12-05 19:17:18 | 2 | 851 | hemoglobin |
77,608,755 | 3,861,775 | Computing gradients for Module class in JAX | <p>I created a tiny test case that implements a PyTorch inspired module class in JAX. The forward method works as expected. However, when I try to compute the gradients for the weights in the linear layer, I end up with a single gradient that probably belongs to the loss. How do I compute the gradients for the weights ... | <python><jax> | 2023-12-05 19:17:04 | 1 | 3,656 | Gilfoyle |
77,608,700 | 3,742,823 | pyspark limit number of parallel connections to an API endpoint | <p>In PySpark, how can I limit the number of parallel connections to an API endpoint?</p>
<p>Let's say I start my PySpark session with 32 executors, however, I want to hit the API with only 8 concurrent connections. How can I do so?</p>
<p>Some sample code:</p>
<pre><code>data = [("A", "url1"), (&qu... | <python><apache-spark><pyspark> | 2023-12-05 19:06:29 | 0 | 3,281 | The Wanderer |
77,608,459 | 1,968 | See live changes when editing code across multiple dependent projects in a VS Code Workspace | <p>I am developing a Python application (<code>app</code>), which relies on an internal Python library (<code>lib</code>) that is developed as a separate project. The main application depends on the library via a Git reference (<code>pip install -e git+https://โฆ</code> or equivalent for Poetry). Both <code>app</code> a... | <python><visual-studio-code><vscode-workspace> | 2023-12-05 18:19:39 | 2 | 549,077 | Konrad Rudolph |
77,608,450 | 11,739,577 | Web scraping shows 403 error but website is available | <p>I am trying to scrape CS2 skin prices from <a href="https://pricempire.com/search?q=ursus" rel="nofollow noreferrer">https://pricempire.com/search?q=ursus</a>. From Inspect in Chrome I find <a href="https://api.pricempire.com/v2/search/items?page=1&priceMin=0&priceMax=1000000&orderBy=price_desc&price... | <python><web-scraping> | 2023-12-05 18:18:31 | 0 | 793 | doomdaam |
77,608,326 | 848,746 | returning min from dict values where there are more than one zeros | <p>I have a weird situation with a dict which looks like so:</p>
<pre><code>a={
"key1":[{"a":10,"b":10,"d":0},{"a":100,"b":100,"d":1},{"a":1000,"b":1000,"d":0}],
"key2":[{"a":18,"b"... | <python><python-3.x><python-itertools><itertools-groupby> | 2023-12-05 17:56:06 | 3 | 5,913 | AJW |
77,608,298 | 10,431,629 | Using Pandas to stack a data frame in a specifc format | <p>I have a panas dataframe as follows:</p>
<pre><code> df
Prod ProdDesc tot avg qtr val_qtr
A Cyl 110 8.7 202301 12
A Cyl 110 8.7 202302 56.9
A Cyl 110 8.7 202303 9
A Cyl 110 8.7 202304 0
</code></pre>
<p>... | <python><pandas><pivot-table><transpose><melt> | 2023-12-05 17:51:53 | 1 | 884 | Stan |
77,608,173 | 9,381,985 | sympy solve() result cannot be used in np.isclose(): ufunc 'isfinite' not supported | <p>My code is as following. The goal is to, given 1) a circle with radius <code>r</code>, 2) a point <code>(x0, y0)</code> on it, and 3) a line with <code>slope</code> through that point, find out the other point that the line intersects with the circle. To be simple, we assume the line is NOT tangent with the circle.<... | <python><numpy><sympy> | 2023-12-05 17:29:56 | 1 | 575 | Cuteufo |
77,607,952 | 125,673 | plotly radar chart - I need to set some attributes | <p>I have this code as follows;</p>
<pre><code>self.fig.add_trace(go.Scatterpolar(
r=_r,
theta=_theta,
fill="toself",
line=_line,
name=self.name))
self.fig.update_layout(
polar=dict(
radialaxis=dict(
... | <python><plotly><radar-chart> | 2023-12-05 16:56:39 | 1 | 10,241 | arame3333 |
77,607,928 | 731,041 | How do I produce a German umlaut with KMK | <p>I am making a custom keyboard with KMK / MicroPython on a Raspberry Pi Pico to be used with OSX.</p>
<p>I would like it to have convenient access to German umlauts (รครรถรรผร), so I defined a dedicated <code>KC.UMLAUT</code> key, which, when pressed together with <kbd>A</kbd>, <kbd>O</kbd>, or <kbd>U</kbd> should produ... | <python><raspberry-pi-pico><kmk> | 2023-12-05 16:51:51 | 2 | 2,759 | Kolja |
77,607,894 | 1,185,790 | Palantir Foundry REST API call for adding a row identifier to a dataset | <p>I am currently using the <code>Read dataset as table</code> Palantir Foundry API as described <a href="https://www.palantir.com/docs/foundry/api/datasets-resources/datasets/read-table/" rel="nofollow noreferrer">here</a>. For datasets of a certain size, I end up running into memory constraints when pulling the data ... | <python><rest><palantir-foundry><apache-arrow> | 2023-12-05 16:46:37 | 0 | 723 | baobobs |
77,607,533 | 4,696,802 | Why does creating a Python virtual environment change the folder structure? | <p>I'm on Windows and my Python interpreter is Python.exe, and then there is a subfolder named Lib and then another subfolder named "site-packages". Python is set up to search this path relative to itself to find imports. When I create a virtual environment on Windows it puts the Python interpreter .exe insid... | <python> | 2023-12-05 15:50:36 | 1 | 16,228 | Zebrafish |
77,607,499 | 9,318,323 | Remove warning when using concat() with empty dataframes | <p>My old code concats some dataframes, some may be empty. I now receive two future warnings regarding this.</p>
<p>My goal is to have the old logic but without any warnings. Mainly I need to <strong>retain all the column names without empty rows</strong>.</p>
<p>I wrote the code below (fixed 1 of the 2 warning) but it... | <python><pandas><dataframe> | 2023-12-05 15:46:27 | 1 | 354 | Vitamin C |
77,607,480 | 1,382,763 | How to write results from snowpark to a table? | <p>I am following this code from <a href="https://github.com/interworks/Snowflake-Python-Functionality/blob/main/Created%20via%20Snowpark/User%20Defined%20Table%20Functions/Generate%20Auto%20ARIMA%20Predictions.py" rel="nofollow noreferrer">github</a>: it runs a muilti-series time series forecasting using ARIMA. If you... | <python><snowflake-cloud-data-platform> | 2023-12-05 15:43:49 | 1 | 1,007 | janicebaratheon |
77,607,317 | 12,458,212 | Issues building nested dictionary with python lists | <p>I'm using the following method to build a nested dictionary using 2 python lists:</p>
<pre><code>lvl1 = ['a', 'b']
lvl2 = ['apples','bananas']
results = defaultdict(dict)
for one in lvl1:
for two in lvl2:
results[one][two] = 0
</code></pre>
<p>I'm having issues using the same method with 3 python lists (... | <python><dictionary> | 2023-12-05 15:19:54 | 2 | 695 | chicagobeast12 |
77,607,315 | 7,563,454 | Python: How to handle a repeating function on the main thread requesting updates from multiple sub-threads each execution | <p>Situation: This is the structure of a code I'm working on, it uses Tkinter but I left the details out to keep it simple and related to the threading question. The main thread contains a function we'll call <code>calculate</code> which repeatedly calls itself every second... each call it creates a number of threads r... | <python><python-3.x><multithreading> | 2023-12-05 15:19:06 | 0 | 1,161 | MirceaKitsune |
77,606,953 | 10,941,410 | How long does the `httpx.AsyncClient` can "live" without closing the event loop? | <p>I have an endpoint in <code>Django</code> that orchestrates a bunch of API calls to other underlying services. I intend to use a long-lived instance of <code>httpx.AsyncClient</code> - which will be ultimately responsible for the API calls.</p>
<pre class="lang-py prettyprint-override"><code>from functools import pa... | <python><django><asynchronous><python-asyncio><httpx> | 2023-12-05 14:23:28 | 0 | 305 | Murilo Sitonio |
77,606,824 | 5,594,008 | Pytest, get IntegrityError when inserting ForeignKey by id | <p>I have such table structure</p>
<pre><code>class ParentModel(models.Model):
symbol = models.CharField(max_length=255, primary_key=True)
name = models.CharField(max_length=200)
class ChildModel(models.Model):
parent_instrument = models.ForeignKey(
to=ParentModel,
on_delete=mod... | <python><django><pytest> | 2023-12-05 14:06:21 | 1 | 2,352 | Headmaster |
77,606,668 | 1,309,245 | Default jinja macro template parameter in airflow dag | <p>How do I make an airflow dag to receive a parameter and its default value would be its logical date</p>
<pre><code># Define the DAG
dag = DAG(
dag_id="test",
start_date=days_ago(1),
schedule_interval="@daily",
params={"date_param": "{{ ds }}" }
)
# Define the ... | <python><airflow> | 2023-12-05 13:42:32 | 1 | 1,407 | elvainch |
77,606,651 | 13,180,235 | How to Integrate GTM with Partytown in Django Template | <p>I am trying to integrate my GTM tag using Django Template. Following is my current html snipped that is working perfectly fine without partytown integration.</p>
<pre><code><head>
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
... | <javascript><python><django><google-tag-manager><partytown> | 2023-12-05 13:40:37 | 0 | 335 | Fahad Hussain |
77,606,400 | 2,791,346 | Long running Django Celery task close DB connection | <p>I have a Django Celery task that performs long-running operations and sometimes loses connection to the database (Postgres).</p>
<p>the task looks like something like this:</p>
<pre><code>@app.task(name='my_name_of_the_task')
def my_long_running_task(params):
with transaction.atomic():
object_list = self.g... | <python><django><postgresql><django-celery><connection-timeout> | 2023-12-05 13:02:37 | 0 | 8,760 | Marko Zadravec |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.