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,045,791 | 5,249,203 | executing bash scripts from R Shiny | <p>On a HPC cluster, I have created a workflow pipeline. To execute the pipeline, I need to execute <code>commands.sh</code>. which basically, has series of bash commands such as</p>
<pre><code>module load python
module load java/11.0.8
</code></pre>
<p>It works as expected when I invoke the file from HPC command line... | <python><r><bash><shiny> | 2023-09-05 15:23:33 | 0 | 4,678 | user5249203 |
77,045,776 | 11,578,282 | Why are my async functions not running in parallel? | <p>I'm trying to understand asyncio in Python. I'm expecting my two async functions to run at the same time with the output similar to below.</p>
<pre><code>foo
bar
foo
bar
foo
bar
foo
bar
</code></pre>
<p>Instead, I'm getting a list of 'foo'.</p>
<pre><code>async def print_foo():
while True:
print("fo... | <python><asynchronous><python-asyncio> | 2023-09-05 15:21:58 | 1 | 467 | Eind997 |
77,045,763 | 447,738 | Filter a Pandas dataframe if cell values exist in another dataframe but with a range | <p>I have two pandas DataFrame, with the same structure. Dataframe B is a subset of DataFrame A.</p>
<p>I want to filter DataFrame B, only if the Price value appears in DataFrame A, <strong>or it is within 1% of a value in DataFrame A</strong>.</p>
<p>For example, even if the exact price is not present, I want to keep ... | <python><pandas> | 2023-09-05 15:19:58 | 4 | 2,357 | cksrc |
77,045,722 | 6,742,553 | Python's replace() function's count property is vague | <p>I am relatively new to Python and don't really grasp the idea of <code>replace</code> method's third parameter (count).</p>
<p>So this:</p>
<pre><code>print("This is is it!".replace("is", "are", __count=1))
print("This is is it!".replace("is", "are", __coun... | <python><python-3.x><replace> | 2023-09-05 15:14:30 | 1 | 708 | Serhat |
77,045,716 | 15,673,147 | How to extract score from similarity search when doing RAG with LangChain, GPT and Chainlit UI? | <p>I'm doing RAG (retrieval augmentation generator) using LangChain and OpenAI's GPT, through Chainlit UI. The chain_type I'm using is "map_rerank".</p>
<p>I'm already able to extract the answer and the source document.</p>
<p>But I can't find a way to extract the score from the similarity search and print it... | <python><openai-api><information-retrieval><langchain><large-language-model> | 2023-09-05 15:13:46 | 0 | 343 | Guilherme Giuliano Nicolau |
77,045,640 | 3,087,409 | Colour and transparency in plotly plot based on two columns in pandas dataframe | <p>I'm making a stacked+grouped bar chart in plotly. I have a dict of colours for each category, but I would like each of the groups to have a different transparency to distinguish them.</p>
<p>The data looks like this:</p>
<pre><code> year subplot plot_label value
0 2019 Projected Category 1 3.1
1 ... | <python><pandas><plotly> | 2023-09-05 15:02:03 | 2 | 2,811 | thosphor |
77,045,623 | 9,112,151 | XML - Find without namespace | <p>With xml below:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<ns0:mt_queryRequest xmlns:ns0="http://x5.ru/mdm/common">
<messageHeader>
<reqId>6437636</reqId>
<targetSystem>GGG</targetSystem>
<serviceInterf... | <python><xml><elementtree><xml-namespaces> | 2023-09-05 14:59:24 | 3 | 1,019 | Альберт Александров |
77,045,573 | 9,490,769 | Converting list function to generator using yield | <p>I am trying to convert a for loop into an iterator using yield, but I have failed in my attempts. I don't understand exactly why the <code>yield</code> isn't giving me the expected output. Does anyone know what the problem is?</p>
<p>Attempt at using yield:</p>
<pre class="lang-py prettyprint-override"><code>def ite... | <python><python-3.x><yield> | 2023-09-05 14:53:30 | 5 | 3,345 | oskros |
77,046,197 | 4,120,431 | Read EC Public Key, works in python, error in java | <p>I have this issue moving some code from python to java.
The following public key:</p>
<blockquote>
<p>MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgAC2X07fCab+nIPAWBb5eRlhdOfR0Bkrhx7TgM3cGbR31g=</p>
</blockquote>
<p>can be succesfully read from this python code:</p>
<pre class="lang-py prettyprint-override"><code>key = bytearra... | <java><python><key> | 2023-09-05 14:40:02 | 1 | 3,540 | N Dorigatti |
77,045,475 | 6,068,731 | Numpy `random.choice` but using different weights each time we sample | <p>I have a <code>(N, T+1)</code> array of weights. Its rows are normalized, meaning</p>
<pre><code>np.array_equal(W.sum(axis=1), np.ones(N))
</code></pre>
<p>returns <code>True</code>. Now I want to get <code>N</code> samples from <code>np.arange(T+1)</code> where to select the <code>i</code>th sample, I use the <cod... | <python><numpy> | 2023-09-05 14:39:00 | 1 | 728 | Physics_Student |
77,045,451 | 7,838,925 | How can I fix the deformed piecharts on a map? | <p>I am plotting a pie chart per country with some statistics. A sample of my data (where all the columns except for geometry and size are categories to be shown by the pie charts) looks like this:</p>
<p><a href="https://i.sstatic.net/mPNTL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mPNTL.png" alt=... | <python><python-3.x><matplotlib><geopandas> | 2023-09-05 14:35:05 | 0 | 1,223 | Jan Pisl |
77,045,231 | 19,238,204 | How to Plot Surface Plot / 3-D Laplace Transform for x(t) = exp(-t)sin(t) with SymPy | <p>This is what I want to achieve:</p>
<p><a href="https://i.sstatic.net/5BOe3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5BOe3.png" alt="3" /></a></p>
<p>I have this function <code>x(t) = exp(-t)*sin(t)</code> that will undergone a Laplace transform x(s) :</p>
<p><a href="https://i.sstatic.net/CBdL... | <python><sympy> | 2023-09-05 14:05:36 | 1 | 435 | Freya the Goddess |
77,045,203 | 15,673,855 | How to improve the speed of an n body simulation type project? | <p>I am making a particle simulation, where each particle has an attraction to each other particle, scaling with distance. In addition to this, I have added some other features such as eating food and using energy for the particles to move. I currently am simulating 100 particles, but the speed of the simulation is muc... | <python><performance><optimization><simulation> | 2023-09-05 14:03:18 | 2 | 310 | Mercury |
77,045,095 | 2,725,810 | Cached build with SAM downloads all package dependencies | <p>I am new to the topic and might not be using all the correct terminology, so please forgive it.</p>
<p>I am building a container to be deployed at AWS Lambda. The requirements include the <code>sentence-transformers</code> package, which is very large, so that building the docker image takes a long time.</p>
<p>I wo... | <python><docker><aws-lambda><aws-sam><aws-sam-cli> | 2023-09-05 13:49:43 | 1 | 8,211 | AlwaysLearning |
77,045,048 | 10,771,559 | Python Regex for subsetting columns from dataframe | <p>I have a dataframe with various column names and want to pull all those that end with '-A' followed by either 1 or 2 numbers. For instance, a column name I would want returned is 'Charlie-A14'.</p>
<p>I tried the following</p>
<pre><code>data.columns[data.columns.str.match('\A+\d')]
</code></pre>
<p>However, it does... | <python><pandas><regex> | 2023-09-05 13:42:13 | 2 | 578 | Niam45 |
77,044,930 | 15,673,147 | Get source_documents and score with ConversationalRetrievalChain, Stuff and Chailit UI | <p>I'm having trouble trying to export the source documents and score from this code. I tried a bunch of things, but I can't retrieve it. The most I could do is to pass the my demand to the prompt so the LLM retrieves it to me, but sometimes it just ignores me or hallucinates (ex: it gives me a source link from inside ... | <python><openai-api><information-retrieval><langchain><large-language-model> | 2023-09-05 13:28:37 | 2 | 343 | Guilherme Giuliano Nicolau |
77,044,832 | 19,238,204 | Fourier Transform Plot for exp(-t)sin(t) | <p>I want to achieve this:</p>
<p><a href="https://i.sstatic.net/HPk0R.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HPk0R.png" alt="1" /></a></p>
<p>My code here:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
# Number of samplepoints
N = 600
t = np.arange(0.0,... | <python><numpy> | 2023-09-05 13:14:20 | 0 | 435 | Freya the Goddess |
77,044,821 | 253,986 | Celery Periodic Tasks with Dynamic Arguments | <p>I want to schedule a Celery task that can accept dynamic arguments at each schedule. In essence, the arguments should be derived from the results of a database query. Is there a way to achieve this?</p>
<p>To elaborate, my goal is to distribute Celery tasks in parallel, depending on the number of rows retrieved from... | <python><celery><scheduled-tasks> | 2023-09-05 13:13:34 | 1 | 6,144 | Achaius |
77,044,795 | 4,675,426 | Will list append create a copy? | <p>I am newbie to python. I came across this code.</p>
<pre><code>simple_list = ['a', 'b', 'c']
dict_list = []
for x in simple_list:
local_dict = {'key': x}
dict_list.append(local_dict)
print(dict_list)
</code></pre>
<p>The for loop creates a dictionary for each element in the list <code>simple_list</code> and ... | <python><list><dictionary> | 2023-09-05 13:09:49 | 1 | 1,000 | Karthick |
77,044,763 | 1,474,895 | Programmatably Automate Microsoft Outlook Settings | <p>Is there anyway to set Microsoft Outlook setting, specially the Options-->Mail-->Stationary and Fonts? Our organization has rules set up to set them back to Arial 12 after every restart of the PC which I do often. It only take me 30 seconds to set them back to what I like, but it would be nice if I could use s... | <python><outlook> | 2023-09-05 13:05:30 | 1 | 1,483 | Cody Brown |
77,044,698 | 4,451,521 | Numpy vectorize with signature | <p>Can someone explain how does the signature works with numpy's vectorize?</p>
<p>I have read <a href="https://numpy.org/doc/stable/reference/generated/numpy.vectorize.html" rel="nofollow noreferrer">the documentation</a>. It is confusing and has a very tiny part dedicated to signatures
I have googled numpy vectorize ... | <python><numpy> | 2023-09-05 12:56:18 | 2 | 10,576 | KansaiRobot |
77,044,671 | 19,238,204 | How to Plot Fourier Transform of cos(2x) correctly with Numpy and Python | <p>I watch a video about Fourier Transform and in the Fourier Transform plot of the funciton <code>cos(2x)</code> the hike should be at <code>ω=-2</code> and <code>ω=2</code>, but why mine is different:</p>
<p><a href="https://i.sstatic.net/TA1jh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TA1jh.png"... | <python><numpy> | 2023-09-05 12:52:52 | 1 | 435 | Freya the Goddess |
77,044,659 | 9,958,954 | sqlalchemy proper way of using connection | <p>This is basically the skeleton of what I am using for executing sql statements</p>
<pre><code>engine = "engine_conn_here"
with engine.connect() as connection:
with connection.begin() as transaction:
try:
merge_sql_string = """MERGE SQL QUERY COMMAND HERE""... | <python><sql-server><sqlalchemy> | 2023-09-05 12:51:21 | 0 | 710 | LearningNoob |
77,044,597 | 2,030,532 | How to override the hash function of python data classes? | <p>I am trying to write a base class for python <code>dataclasse</code> with a custom hash function as follows. However, when calling the child class's <code>hash</code> it does not use the custom hash function of the parent class.</p>
<pre><code>import dataclasses
import joblib
@dataclasses.dataclass(frozen=True)
cl... | <python><inheritance><hash><python-dataclasses> | 2023-09-05 12:42:13 | 1 | 3,874 | motam79 |
77,044,540 | 1,652,219 | How to filter out rows in pandas without creating a mask? | <p>Is there not a pretty pipe-way to do filtering in Python's Pandas like in R's tidyverse?</p>
<p>Most examples in Python vs R</p>
<pre><code># Pandas
Iris[(Iris.Petal_Width > 1) & (Iris.Species==’setosa’)][[‘Sepal_length’,’Petal_Length’]]
# Tidyverse
Iris %>%
filter(Petal_Width > 1, Species==’setosa... | <python><r><pandas><tidyverse> | 2023-09-05 12:30:45 | 0 | 3,944 | Esben Eickhardt |
77,044,491 | 7,648,650 | Python Dash: How to use Input from a dynamically created Dropdown? | <p>I got an app that contains a button with callback function to create an unlimited amount of dropdowns which will be automatically id'ed as 'dropdown-i'.
The struggle is that I don't seem to be able to actually use the values I input in these Dropdowns in another callback function (that's only trying to print them).<... | <python><callback><dropdown><plotly-dash> | 2023-09-05 12:24:29 | 1 | 1,248 | Quastiat |
77,044,480 | 9,484,595 | Counting the points below a coordinate | <p>I have the following problem, for which the solution I use at the moment is too slow.</p>
<p><strong>Instance:</strong> a numpy array <code>b</code> of shape <code>(B,2)</code>, a sorted numpy array <code>x</code> of shape <code>(X)</code>, and a sorted numpy array <code>y</code> of shape <code>(Y)</code>.</p>
<p>No... | <python><arrays><numpy> | 2023-09-05 12:22:32 | 1 | 893 | Bubaya |
77,044,403 | 5,371,582 | Type hint function accepting a Union | <p>Here is my (much simplified) code:</p>
<pre><code>def myfun(X:list[str|int]):
for x in X:
print(x)
X = [1,2,3]
myfun(X)
</code></pre>
<p>Pyright complains on the last line because I provide a list of <code>int</code> while the function requires <code>list[int|str]</code>.</p>
<ul>
<li>What is the best ... | <python><python-typing><pyright> | 2023-09-05 12:10:52 | 1 | 705 | Laurent Claessens |
77,044,352 | 2,725,810 | Decoding pickled body in AWS Lambda | <p>I have created a container for the following AWS Lambda function:</p>
<pre class="lang-py prettyprint-override"><code>import pickle
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
def get_embeddings_raw(texts):
try:
return mode... | <python><http><aws-lambda><pickle><aws-sam> | 2023-09-05 12:04:30 | 0 | 8,211 | AlwaysLearning |
77,043,967 | 13,518,907 | Accelerometer Data Classification | <p>I am trying to classify accelerometer data (sampled with a frequency of 100Hz) into 4 different transportation modes (0,1,2,3). I have 41 different CSV files, each representing a time series. I stored every file in a list called subjects. Each CSV-file looks as follows:</p>
<pre><code> # Check if the label mappin... | <python><classification><random-forest><accelerometer><train-test-split> | 2023-09-05 11:02:58 | 1 | 565 | Maxl Gemeinderat |
77,043,946 | 16,716,173 | How to calculate binomial probabilities in Python with very small numbers? | <p>I'm trying to calculate the likelihood of successfully guessing a password in Python. For example, if we take a 10 character lowercase password (26**10 possible passwords) and we can make 1 billion guesses a second, we can calculate the probability of successfully guessing the password in one hour with:</p>
<pre cla... | <python><scipy> | 2023-09-05 11:00:42 | 2 | 327 | Gh0stFish |
77,043,936 | 18,904,265 | Can/Should I define a schema for a requests call using pydantic? | <p>I am writing a class to handle get/post/patch/delete requests to an API. For this, I am writing a method each (e.g. <code>def get_request()</code>). The parameters needed for the requests are quite a few, which would result in a long list of parameters for each function. Therefore I want to define the schema in some... | <python><python-requests><pydantic> | 2023-09-05 10:59:08 | 0 | 465 | Jan |
77,043,882 | 8,887,907 | SSH key asks for passphrase when created using subprocess in python | <p>I have a python project that is supposed to be used for creating a SSH key with ssh-keygen and add it to some remote servers. When I run the command <code>ssh-keygen -f .ssh/id_rsa -t rsa -N ""</code> from the command line everything works fine, and I can simply run the rest of the python code to transfer ... | <python><ssh><subprocess><ssh-keygen> | 2023-09-05 10:52:54 | 1 | 583 | Amir Zare |
77,043,881 | 8,831,165 | Aiohttp: `async with session.get(...)` block blocks until receiving the request: why? | <p>I have following code snipped:</p>
<pre><code>import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as session:
async with session.get("https://hub.dummyapis.com/delay?seconds=1") as r:
print("Here!")
text = await r.text()
... | <python><aiohttp> | 2023-09-05 10:52:44 | 2 | 2,744 | Frederik Bode |
77,043,650 | 9,947,412 | Pylint and flake8: quality score | <p>I was wondering if it was possible to get a code quality score using flake8 like pylint do by default. I cannot find the flake8 configuration for it, if it exists.</p>
<p>I want to be able to compare my file with this insights over the time.</p>
<p>Thank you!</p>
| <python><pylint><flake8> | 2023-09-05 10:19:12 | 0 | 907 | PicxyB |
77,043,614 | 6,008,271 | Structed logging for uWSGI HARAKIRI messages | <p>My observability/logging platform requires that logs be structured in a specific format in order for them to be ingested and available in the right place.</p>
<p>This involves JSON-structuring the logs with some metadata like which service it's coming from.</p>
<p>For normal uwsgi request logs I can solve it like th... | <python><logging><uwsgi> | 2023-09-05 10:14:46 | 0 | 739 | OscarVanL |
77,043,540 | 17,835,656 | How can i add a QR image in pyqt5? | <p>i am working on project works with QR Images and i have to convert a link into a qr image</p>
<p>after that i have to show the image on the window.</p>
<p>i am using <strong>qrcode</strong> library and it provides a way to convert the image into QImage, and i can set it directly on the window without save it as a fi... | <python><python-3.x><pyqt><pyqt5><qr-code> | 2023-09-05 10:02:43 | 1 | 721 | Mohammed almalki |
77,043,496 | 1,422,096 | Is there a split function that returns [] in this case? | <p>Of course we have:</p>
<pre><code>"1,2,3".split(",") # ["1", "2", "3"]
"1".split(",") # ["1"]
</code></pre>
<p>but also this, which is sometimes problematic in some situations (*):</p>
<pre><code>"".split(",") ... | <python><list><split> | 2023-09-05 09:55:22 | 5 | 47,388 | Basj |
77,043,346 | 13,836,083 | Proper way to retrieve last item from JSON array, stored in file | <p>Below is how my JSON file looks like, Here I am continuously watching this. I am watching this file because I want to retrieve the every new item appended to JSON array in Python.</p>
<p>I want to know what could be a better approach.</p>
<pre><code>[
{key1:value1,key2:value2},
{key1:value1,key2:value2}
]
</code... | <python><json> | 2023-09-05 09:33:24 | 1 | 540 | novice |
77,043,285 | 188,331 | NLTK sentence_bleu() returns 0 while evaluating Chinese sentences | <p>I'm trying to evaluate Chinese sentence BLEU scores with NLTK's <code>sentence_bleu()</code> function. The code is as follows:</p>
<pre><code>import nltk
import jieba
from transformers import AutoTokenizer, BertTokenizer, BartForConditionalGeneration
src = '樓上漏水耍花招不處理可以怎麼做'
ref = '上層漏水耍手段不去處理可以怎麼做'
checkpoint = '... | <python><nltk><cjk><bleu> | 2023-09-05 09:25:09 | 2 | 54,395 | Raptor |
77,043,088 | 11,417,794 | How to create this alphabetical pattern in Python | <p>I want to create this alphabetical pattern:</p>
<pre><code>A
B C
D E
B C
A
</code></pre>
<p>So far I have done this:</p>
<pre><code>n = 4
ch = 65
for i in range(0, n):
for j in range(0, i+1):
if j == 0 or j == 1:
print(chr(ch), end =" ")
ch += 1
print()
for i in ra... | <python> | 2023-09-05 08:53:18 | 1 | 898 | CodeSpeedy |
77,043,082 | 13,518,907 | Human Activity Recognition - Train-Test-Split and Modeling | <p>I have a list of CSV files that contains accelerometer (Frequency 100Hz) data from several subjects. I first read in all CSV-files into a list called "subjects". Here is a short snipped on how each dataset in the "subject" list looks like:</p>
<pre><code>test = subjects[0]
print(test.head())
prin... | <python><classification><accelerometer><train-test-split> | 2023-09-05 08:52:45 | 0 | 565 | Maxl Gemeinderat |
77,043,028 | 7,758,765 | Use pip with authentication via a proxy server without storing the password as plaintext | <p>I am currently using a machine within an organization that requires passing through a proxy with authentication. I am running Red Hat 7 and need to use pip. However, it seems that the only ways to use pip through a proxy with authentication involve storing the password as plaintext in the config file or an environme... | <python><pip> | 2023-09-05 08:45:21 | 0 | 833 | Welgriv |
77,042,924 | 2,992,055 | pandas read_csv can't handle additional commas in double quotes | <p>Seems like this has been addressed so many times, yet I'm not able to resolve it.
Here's a minimal example of my CSV:</p>
<pre><code>Issue, Content
Test, "A, B"
Test, "A, B, C"
</code></pre>
<p>Here's the read_csv code (tried all sorts of combinations regarding parameters):</p>
<pre><code>df = pd... | <python><pandas><csv> | 2023-09-05 08:31:12 | 2 | 514 | Pete |
77,042,910 | 17,580,381 | Join on multiprocessing pool deadlock due to [Errno 61] Connection refused | <p>Here's a contrived piece of code that runs exactly as expected:</p>
<pre><code>from multiprocessing import Pool, Manager
from os import cpu_count
PROCESSES = cpu_count() // 2
N = 250
def add_to_list(the_list, the_value):
try:
the_list.append(the_value)
except Exception as e:
print(e)
def... | <python><multiprocessing> | 2023-09-05 08:28:25 | 1 | 28,997 | Ramrab |
77,042,700 | 18,620,559 | Django Database Routing using USER from request | <p>I am trying to implement a PER USER database routing in Django and things are not going that smoothly.</p>
<p>Databases are predefined and they have identical structure.</p>
<p>This is what I have right now and IT WORKS but I was wondering if there is anything better for what I want :</p>
<pre><code>class DatabaseMi... | <python><django><database><routes> | 2023-09-05 07:56:11 | 0 | 343 | Lerex |
77,042,626 | 498,690 | How to pivot dataframe by columns from compound index | <p>My dataframe represents time series. it has three columns: ts, code, count
I try to pivot it.</p>
<pre class="lang-py prettyprint-override"><code># set index by code, ts to get
# code_01 1
# code_01 2
# ...
# code_42 1
# code_42 2
df_count = df[['code', 'count', 'ts']]
df_count = df_count.set_index(['code', 'ts'])... | <python><pandas><dataframe> | 2023-09-05 07:46:15 | 0 | 3,818 | Capacytron |
77,042,247 | 2,009,558 | How can I collect output from a parallelised Python operation in a single list? | <p>I want to run an operation in parallel and colelct the output in a global list. I include the list as a variable that is passed to the parallel script. However, the output doesn't accumulate there. Why doesn't this work?</p>
<p>This is the 1st cell in Jupyter Notebook:</p>
<pre><code>from multiprocessing import Pool... | <python><parallel-processing> | 2023-09-05 06:46:21 | 2 | 341 | Ninja Chris |
77,042,189 | 22,070,773 | Wrapping GLFWwindow with pybind11 | <p><code>GLFWwindow</code> is forward declared in <code>glfw.h</code>, and as such, <code>pybind11</code> tells me it cant properly wrap it without a definition, for example, this:</p>
<pre><code>#include <GLFW/glfw3.h>
#include <pybind11/pybind11.h>
PYBIND11_MAKE_OPAQUE(GLFWwindow);
class Application {
... | <python><c++><pybind11> | 2023-09-05 06:33:43 | 1 | 451 | got here |
77,042,177 | 9,813,860 | Is there an R version of Python's asyncio.sleep() non-blocking wait function | <p>I am using the package (websocket) for R to receive messages sent from Discord. For this communication to work, Discord requires for R to send a message every ~40 seconds (what the call the heartbeat).</p>
<p>To do this, I create an infinite while loop like this:</p>
<pre><code>LastTime=Sys.time()
Send=1
while (Send... | <python><r><websocket><discord> | 2023-09-05 06:31:45 | 1 | 449 | Camilo |
77,041,917 | 116 | How do I tell mypy to load dotenv from my site-packages? | <p>How do I tell mypy the location of a package? The package is in site-packages.</p>
<p>Details:</p>
<p>I am getting this error</p>
<pre><code>% mypy t.py
t.py:10: error: Cannot find implementation or library stub for module named "dotenv" [import]
</code></pre>
<p>on this code</p>
<pre><code>import doten... | <python><mypy> | 2023-09-05 05:25:25 | 0 | 305,996 | Mark Harrison |
77,041,913 | 9,644,490 | how to split Django urls.py into multiple files | <p>I have a function based view in my app, and I am trying to split my urls.py as follows</p>
<pre><code>my_project/
|- my_project/
|- urls.py
|- my_app/
|- urls
|- __init__.py
|- dogs.py
|- cats.py
|- views
|- __init__.py
|- dogs
|- index.py
...
</code></pre>
<pre>... | <python><django> | 2023-09-05 05:24:02 | 0 | 409 | kyuden |
77,041,700 | 12,093,885 | Cannot pip install CUDA-enabled pytorch in nvidia/cuda docker container: not a supported wheel on this platform | <p>I have an image (<code>./app/Dockerfile</code>) defined like this:</p>
<pre><code>FROM nvidia/cuda:11.3.1-base-ubuntu20.04
ENV TZ="Asia/Kuala_Lumpur"
################################################################################
#
# Ubuntu 20.04, Cuda 11.3, python3.10
#
################################... | <python><docker><pip><pytorch> | 2023-09-05 04:12:51 | 1 | 603 | Hajar Razip |
77,041,555 | 11,277,108 | How to re-scrape a page if there is an error in parse method? | <p>The first action in my <code>parse</code> method is to extract a dictionary from a JSON string contained in the HTML. I've noticed that I sometimes get an error as the web page doesn't display correctly and thus doesn't contain the JSON string. If I rerun the spider then the same page displays fine and on it carries... | <python><scrapy> | 2023-09-05 03:15:55 | 1 | 1,121 | Jossy |
77,041,384 | 3,247,006 | How to test Django with multiple broswers together with Selenium to reduce the code? | <p>I installed <a href="https://github.com/pytest-dev/pytest-django" rel="nofollow noreferrer">pytest-django</a> and <a href="https://github.com/SeleniumHQ/selenium" rel="nofollow noreferrer">selenium</a> in Django as shown below.</p>
<pre class="lang-none prettyprint-override"><code>pip install pytest-django &&... | <python><django><selenium-webdriver><browser><pytest-django> | 2023-09-05 02:12:16 | 1 | 42,516 | Super Kai - Kazuya Ito |
77,041,323 | 1,471,980 | how do you apply a function to create a column and insert value in pandas | <p>I have a data frame like this:</p>
<pre><code>df
Server Model
Server1dc xp2
server2dc cc4
server4uat dd4
</code></pre>
<p>I have this function to determine the number of slots given the model:</p>
<pre><code>def total_slot(row):
if "xp" in row["Model"]:
return 5
if &... | <python><pandas> | 2023-09-05 01:52:13 | 2 | 10,714 | user1471980 |
77,041,241 | 10,994,166 | Shuffle array of arrays pyspark columns | <p>I have pyspark column Like this:</p>
<pre class="lang-none prettyprint-override"><code> gm_array
[[1, 4, 6,...], [2, 7, 8,...], [3, 5, 7,...],...]
[[8, 11, 9,...], [7, 2, 6,...], [10, 9, 8,...],...]
[[90, 13, 67,...], [55, 6, 98,...], [1, 6, 2,...],...]
.
.
</code></pre>
<p>Now I want to shuffle th... | <python><apache-spark><pyspark><apache-spark-sql><shuffle> | 2023-09-05 01:17:01 | 2 | 923 | Chris_007 |
77,041,235 | 2,954,547 | Functional difference between `coverage run -m pytest` and `pytest --cov=...`? | <p>The Coverage tool supports generating code coverage data from Pytest tests with <code>coverage run -m pytest ...</code>. However, there is also the Pytest-Cov plugin, which invokes Coverage and generates coverage data by adding the <code>--cov=</code> option to Pytest.</p>
<p>However the Pytest-Cov documentation doe... | <python><pytest><coverage.py><pytest-cov> | 2023-09-05 01:12:00 | 1 | 14,083 | shadowtalker |
77,041,143 | 15,587,184 | Best Approach to Split, Explode, and Tidy Data Using Regex in Python and Pandas | <p>I have a dataset that requires splitting, exploding, and tidying using regular expressions (regex) in Python and Pandas. The dataset consists of logs from multiple users sent through an old machine to a server API. Each cell may contain multiple messages, and my goal is to transform the data into a structured and ti... | <python><pandas><regex> | 2023-09-05 00:32:10 | 1 | 809 | R_Student |
77,041,133 | 4,465,454 | Mixing mapped and calculated columns in SQLAlchemy 2.0 ORM | <p>I am trying to create an SQLAlchemy 2.0 ORM mapping that allows me to mix Mapped columns that exist in my database with "calculated" columns from a query.</p>
<p>Assume I have two tables product_catalog and amount_catalog. The product_catalog lists a series of products I am selling. The amount_catalog list... | <python><sqlalchemy> | 2023-09-05 00:27:00 | 1 | 1,642 | Martin Reindl |
77,040,978 | 21,575,627 | Python class variable (immutable) not properly updating | <p>Here is a code snippet:</p>
<pre><code> class h:
v = 0
def __init__(self):
print(self.v)
def add(self):
self.v += 1
def show(self):
print(self.v)
h.v
0
a = h()
0
a.add()
a.show()
1
h.v
0
</code></pre>
<p>In other words, when the instance of <code>h</co... | <python> | 2023-09-04 23:06:27 | 0 | 1,279 | user129393192 |
77,040,944 | 11,922,765 | Python Dataframe Normalization ValueError: Columns must be same length as key | <p>I am trying to create a function for normalizing a given dataframe for the requested frequency.</p>
<p><strong>code:</strong></p>
<pre><code>import numpy as np
import pandas as pd
def timeseries_dataframe_normalized(df, normalization_freq = 'complete'):
"""
Input:
df : dataframe
... | <python><pandas><dataframe><numpy><normalization> | 2023-09-04 22:53:03 | 1 | 4,702 | Mainland |
77,040,912 | 17,653,423 | How to flat and merge a list of dictionaries in Python? | <p>How can I convert a list of dictionaries into a single dictionary? Given:</p>
<pre><code>data = [
{
"name" : "name1",
"type" : "type1",
},
{
"name" : "name2",
"type" : "type2",
}
]
</code><... | <python><dictionary> | 2023-09-04 22:38:44 | 4 | 391 | Luiz |
77,040,907 | 5,176,158 | Selenium "ERR_CONNECTION_RESET" using headless on Heroku | <p>I have a Django + Selenium app I'm trying to deploy to Heroku. I have a management command I call that activates a Selenium Webdriver to use.</p>
<p>Whenever I run it locally it's totally fine (without <code>headless</code>) however upon deploying to Heroku no matter what I try I just get:</p>
<pre><code>Message: un... | <python><django><selenium-webdriver><heroku> | 2023-09-04 22:36:25 | 2 | 517 | Daniel N. |
77,040,889 | 19,238,204 | Heat Equation Plot: IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices | <p>I get the code from here:</p>
<p><a href="https://stackoverflow.com/questions/49463985/solving-heat-equation-with-python-numpy">Solving heat equation with python (NumPy)</a></p>
<p>But I get an error when running this:</p>
<pre><code># solve the heat equation for a metal rod as one end is kept at 100 °C
# and the o... | <python><numpy><matplotlib> | 2023-09-04 22:28:14 | 1 | 435 | Freya the Goddess |
77,040,787 | 9,915,864 | Tkinter: subpanel is not showing up in the main window | <ul>
<li>Closing this question as Part 1 was my primary problem at the time*
I'm writing a small app to show menu buttons on a left side panel and the functionality on the right.</li>
</ul>
<p><strong>Part 1:</strong> The main app windows shows up fine (first image) and the AppDownloader() works by itself (second image... | <python><tkinter> | 2023-09-04 21:53:21 | 1 | 341 | Meghan M. |
77,040,573 | 11,001,493 | How to create new column based on mean of specific window (number of rows)? | <p>I have a dataframe like this:</p>
<pre><code>import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({"ID":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"A":[30, 20, 10, 20, 60, 80, 90, 70, 120, 150, 120, 140]})
</code></pre>
<p>I would like to create a new column &qu... | <python><pandas><average><scaling> | 2023-09-04 20:59:24 | 1 | 702 | user026 |
77,040,389 | 1,471,980 | how do you merge two data frames on two common columns and fill empty cells | <p>I have 2 data frames df1 and df2, I need to join them based on server and row columns (both df1 and df2 have the same server, row), final_df need to have data from both df1 and df2 where grid =available need to be inserted into the final_df with row and slot numbers. Final_df should not have empty cells. Once new g... | <python><pandas> | 2023-09-04 20:14:05 | 1 | 10,714 | user1471980 |
77,040,373 | 10,431,629 | Pandas Create a column based on first occurrence of keyword strings from another column | <p>I am not sure , how challenging the problem is, but this is my problem:</p>
<p>I have a data frame say as below:</p>
<pre><code> df-in
ColA ColB ColC ColD
PA 1 2 c
PB 3 3 d
PA 5 11 x
... | <python><pandas><multiple-columns><calculated-columns><indicator> | 2023-09-04 20:10:45 | 3 | 884 | Stan |
77,040,311 | 2,030,532 | PyCharm does not recognize the return type of a decorated function? | <p>I am trying to decorate a method of a python class:</p>
<pre><code>from typing import Any, Callable, TypeVar
T = TypeVar('T')
def my_decorator(func: Callable[..., T]) -> Callable[..., T]:
@functools.wraps(func)
def wrapped(*args: Any) -> T:
print("decorator")
print("Be... | <python><pycharm><decorator><python-typing> | 2023-09-04 19:55:29 | 0 | 3,874 | motam79 |
77,040,207 | 10,292,330 | Unable to properly capture mp3 stream frames | <p>I can only get streams to play for between 1 and 10ish frames before the player crashes. I've noticed that every time the player crashes, it has far fewer bytes to work with for that frame. This means there is something wrong with my sync logic. It's finding a sync too early. I don't know how to solve this. I've don... | <python><pygame> | 2023-09-04 19:33:42 | 1 | 5,561 | OysterShucker |
77,040,164 | 498,690 | Grouped column diff, based on another column | <p>Here is my dataframe:</p>
<pre><code>metric_name ts count
m_1 1 10
m_2 1 20
m_1 2 12
m_2 2 19
</code></pre>
<p>I would like to get diff of <code>count</code> value for each metric_name</p>
<pre><code>m_1 1 0 # start for m_1
m_2 1 0 # start for m_2
m_1 ... | <python><pandas><group-by> | 2023-09-04 19:22:34 | 2 | 3,818 | Capacytron |
77,040,058 | 11,188,140 | Making nested if statements more readable and compact | <p>Consider the 1D numpy array <code>arrRow</code> shown below. It is composed of 1s and 0s, but the important feature is that the row has exactly two 0-islands. The right and left ends of each 0-island are called Edge cells (marked E), and the cells immediately beyond each 0-island are called Border cells (marked B... | <python><numpy> | 2023-09-04 18:58:22 | 1 | 746 | user109387 |
77,039,900 | 2,153,235 | Perusing Python help() details and getting them in Spyder's Help pane | <p>I have Spyder running with Spark as per the details in <a href="https://stackoverflow.com/questions/77019827">this posted
question</a> (Annex A and
<code>SpyderSpark.cmd</code> in Annex B). Before accessing Spark
classes, methods, objects, and help, I first had to import the module and
create the top-level object:<... | <python><spyder> | 2023-09-04 18:21:26 | 0 | 1,265 | user2153235 |
77,039,648 | 913,098 | How to log checkpoint location every time one is saved with pytorch lightning? | <p>I am currently saving a checkpoint every validation epoch like so</p>
<pre><code>checkpoint_callback = ModelCheckpoint(
# dirpath=checkpoints_path,
filename="fa_classifier_{epoch:02d}",
every_n_epochs=val_every_n_epochs,
save_top_k=-1,
# monitor=
)
</code></pre>
... | <python><pytorch><pytorch-lightning> | 2023-09-04 17:25:57 | 1 | 28,697 | Gulzar |
77,039,507 | 6,293,211 | Multiple python versions causing pip failure | <p>See <strong>Photo1</strong>. On executing <code>--version</code>, <code>which</code> and <code>where</code> command to <code>python</code> and <code>python3</code>, I discover to have <code>python</code> linked to ver 3.11 and <code>python3</code> linked to 3.9.</p>
<p>See <strong>Photo2</strong>. I search all pytho... | <python><pip><python-install> | 2023-09-04 16:57:51 | 1 | 466 | Sinha |
77,039,365 | 1,087,942 | Outdated - CS50's Introduction to Programming with Python: Code does not break | <p>I'm using the CS50's tutorials to teach myself python. I am trying to solve the 'Outdated' problem in problem set 3. The code works when I input date as 9/8/1636(i.e., correctly transforms date to yyyy-mm-dd and outputs the result) but not when I input September 8, 1636; it again prompts me for input. I cannot figur... | <python><cs50> | 2023-09-04 16:28:48 | 5 | 1,152 | FlyingDutch |
77,039,302 | 17,889,328 | pyinstaller with pydantic v2 - `pydantic:compiled` has been removed in V2.` | <p>i have a python app which i build with pyinstaller, and which i recently brought pydantic v2 into.</p>
<p>pydantic v1 was never used, or as far as i am aware installed on my system.</p>
<p>pyinstaller now fails to build with this error:</p>
<pre><code>23401 INFO: Loading module hook 'hook-pydantic.py' from 'C:\\paul... | <python><pyinstaller><pydantic> | 2023-09-04 16:17:03 | 1 | 704 | prosody |
77,039,278 | 116,906 | How do I have a Python 3.11.5 process suspend itself on Monterey 12.6.8? | <pre><code>#!/usr/bin/python3
import os
import time
os.system('/bin/kill -19 ' + str(os.getpid()))
time.sleep(2)
</code></pre>
<p>On Linux this script returns immediately, suspended. On Mac this script waits for two seconds and exits without suspending itself.</p>
<p>What can I do to make the suspension behavior avai... | <python><python-3.x><signals><macos-monterey> | 2023-09-04 16:12:31 | 1 | 6,021 | Christos Hayward |
77,039,054 | 4,406,532 | Changing ranges in timeline | <p>Following <a href="https://stackoverflow.com/questions/68386624/plot-timeline-in-python">this question</a> I would like to change the X range (date), so that it will be from 1970, 1980,... till 2020 and the events will be a..b, etc... (I have a predefined list of events). I use the following code which dates starts ... | <python><matplotlib><time-series><timeline> | 2023-09-04 15:34:27 | 1 | 2,293 | Avi |
77,039,010 | 6,734,243 | how to ignore folders contained in tests with pytest? | <p>I checked the <a href="https://stackoverflow.com/questions/11117062/how-to-tell-py-test-to-skip-certain-directories">following question</a> and it's many answers. It's very outdated (as OP is referencing py.test) and no answer is specific enough for my use case.</p>
<p>I have the following test structure:</p>
<pre><... | <python><python-3.x><pytest> | 2023-09-04 15:27:16 | 0 | 2,670 | Pierrick Rambaud |
77,038,895 | 5,547,553 | How to count null values in a summary statistics in python polars? | <p>How do you count null values in a column?</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
'prod': ['apple','apple','banana','lemon','lemon','lemon'], 'price': [11, None, 14, 21, None, 23]
})
</code></pre>
<pre><code>shape: (6, 2)
┌────────┬───────┐
│ prod ┆ price │
... | <python><dataframe><python-polars> | 2023-09-04 15:09:01 | 1 | 1,174 | lmocsi |
77,038,836 | 10,251,146 | polars subset struct variable field name | <p>I have a struct column and want to access fields based on another column</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
data = {'my_struct': [{'field1': 1, 'field2': 'A'}, {'field1': 2, 'field2': 'B'}],
'field_name': ['field1', 'field2']}
df = pl.DataFrame(data)
</code></pre>
<pre>... | <python><python-polars> | 2023-09-04 15:00:21 | 1 | 459 | linus heinz |
77,038,811 | 2,837,887 | Recursive regex in Python to match balanced brackets and replace | <p>I have some LaTeX source and have some annotations: three types:</p>
<ul>
<li><code>\ins{who}{what}</code></li>
<li><code>\rem{who}{what}</code></li>
<li><code>\rpl{who}{whatold}{whatnew}</code></li>
</ul>
<p>The goal is to run through the source files and replace all occurences in the following manner:</p>
<pre><co... | <python><regex><recursion><regex-group> | 2023-09-04 14:57:06 | 1 | 1,400 | atapaka |
77,038,678 | 6,178,507 | How to extract metadata from .heic image files on Windows 11 with Python? | <p>I'm running Python 3.10 on Windows 11. I need to extract metadata from <code>.heic</code> image files. Here is what I tried:</p>
<h2>1. ExifRead</h2>
<p>I tried with <strong>ExifRead</strong> (see <a href="https://pypi.org/project/ExifRead/" rel="nofollow noreferrer">https://pypi.org/project/ExifRead/</a>) but that ... | <python><python-3.x><image><windows-11><heic> | 2023-09-04 14:41:04 | 4 | 9,770 | K.Mulier |
77,038,525 | 10,667,216 | Which co-occurrence matrix generation method is better for a list of words? | <p>I am working on a project where I need to generate a co-occurrence matrix for a given list of words. I have found two different methods for generating this matrix, but I'm not sure which one would be more suitable for my task.</p>
<p>The list of words I am working with is quite extensive (provided below an example),... | <python><nlp> | 2023-09-04 14:21:33 | 0 | 483 | Davood |
77,038,494 | 3,899,975 | How to customize the handles and labels for a legend | <p>I am trying to customize the ax from matplotlib plot. Here I am using a surpyval package to fit the data and then plot it. The plot method in surpyval package does not accept arguments other than the ax=ax as I provided. My problem is i can't match the handles and legends as you can see from this example:</p>
<pre>... | <python><matplotlib><legend><legend-properties> | 2023-09-04 14:17:34 | 1 | 1,021 | A.E |
77,038,407 | 17,082,611 | GridSearchCV: You must compile your model before training/testing. But my model is already compiled | <p>I am trying to use <code>GridSearchCV</code> for tuning the hyper-parameter <code>epochs</code> of my model. This is the minimal, reproducible example:</p>
<pre><code>(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
latent_dimension = 25
encoder = Encoder(latent_dimension, (28, 28, 1))
decode... | <python><tensorflow><machine-learning><keras><deep-learning> | 2023-09-04 14:04:31 | 1 | 481 | tail |
77,038,393 | 5,873,325 | Launch a web application locally | <p>As part of a project, a web application was passed to me. This web application has front and back end. The front end was developed with React JS. Here's how the front end folder looks like.</p>
<p><a href="https://i.sstatic.net/eXa4C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eXa4C.png" alt="ente... | <python><node.js><reactjs><docker> | 2023-09-04 14:02:31 | 3 | 640 | Mejdi Dallel |
77,038,382 | 2,502,126 | plotly express sunburst segment color control | <p>I have a set of data like this which is vended from a database:</p>
<pre><code>xdata = [
["ZT","Met",1],
["ZT","Compensates",0],
["ZT","Planned",0],
["ZT","To Do",0],
["ZT Basic","Met",6],
[&q... | <python><plotly> | 2023-09-04 14:01:06 | 1 | 7,633 | Buzz Moschetti |
77,038,132 | 22,497,747 | Python pillow/PIL doesn't recognize the attribute "textsize" of the object "imagedraw" | <p>I already checked python version on my environment (sublime text) and it is 3.11.0, the latest, I checked pillow version which is 10.0.0, the latest, and my code looks similar to other examples online.</p>
<p>the code has a part in Italian, but its pretty understandable.</p>
<p>the problem is at "disegno.textsi... | <python><python-3.x><python-imaging-library> | 2023-09-04 13:27:28 | 7 | 491 | carokann17 |
77,038,120 | 7,339,624 | How to create a 2D tensor of points with PyTorch, each dimension going from 0 to 1? | <p>I'm trying to create a 2D tensor where each dimension ranges from 0 to 1.</p>
<p>For a 1D tensor, I can use:</p>
<pre class="lang-py prettyprint-override"><code>torch.arange(0, 1, 0.2)
</code></pre>
<p>This gives me:</p>
<pre><code>tensor([0.0, 0.2, 0.4, 0.6, 0.8])
</code></pre>
<p>But, I want to extend this to 2D p... | <python><machine-learning><deep-learning><pytorch><tensor> | 2023-09-04 13:25:27 | 3 | 4,337 | Peyman |
77,037,897 | 13,801,302 | How to create an embeddings model in langchain | <p>I want to pass the hidden_states of llama-2 as an embeddings model to my method <code>FAISS.from_document(<filepath>, <embedding_model>)</code>.
Currently, I have the llama-2 model and get embeddings for a string.</p>
<pre class="lang-py prettyprint-override"><code>model_config = transformers.AutoConfig... | <python><word-embedding><data-retrieval><large-language-model><llama> | 2023-09-04 12:56:04 | 0 | 621 | Christian01 |
77,037,838 | 1,021,306 | Get the hex color code for each value of a column based on a cmap | <p>I have a dataframe <code>df_slope</code> with <code>Year</code> and <code>Slope</code> columns:</p>
<pre><code> Year Slope
0 1970 0.283962
1 1971 0.146310
2 1972 -0.548499
3 1973 0.680444
4 1974 0.801810
5 1975 0.354132
... ... ...
51 2021 0.180423
52 2022 0.597477
53 ... | <python><pandas> | 2023-09-04 12:46:53 | 2 | 3,579 | alextc |
77,037,764 | 11,261,546 | Using from, import, as and dot on the same object | <p>I have a folder with several <code>.py</code> files, each of them has several functions, but I would like to import just one function (or any object) from each file.</p>
<p>Using this tree:</p>
<pre class="lang-none prettyprint-override"><code>.
├── caller.py
└── functions
├── A.py
├── B.py
└── C.py
</co... | <python><python-3.x> | 2023-09-04 12:36:04 | 2 | 1,551 | Ivan |
77,037,676 | 14,777,704 | How can I read the contents of an xlsx file stored on Sharepoint? | <p>I need to read a sheet called "Input" from the file data.xlsx present in a Sharepoint location.</p>
<p>Code snippet -</p>
<pre><code>import openpyxl
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.r... | <python><pandas><excel><sharepoint> | 2023-09-04 12:22:25 | 1 | 375 | MVKXXX |
77,037,590 | 7,274,764 | Running python with -c flag in C# | <p>I'm trying to run a python command from within a c# process. This command is a one-liner and not a script. But strangely enough when starting the python process with the <code>-c</code> flag, i.e. the command instead of script flag, I encounter some problems.</p>
<p>First an example of my code that runs a script and... | <python><c#> | 2023-09-04 12:11:02 | 1 | 2,380 | Jurgy |
77,037,560 | 18,308,621 | How to count work days between date columns with Polars | <p>I have the following DataFrame.</p>
<pre class="lang-py prettyprint-override"><code>df = pl.from_repr("""
┌────────────┬───────────────┐
│ date ┆ maturity_date │
│ --- ┆ --- │
│ date ┆ date │
╞════════════╪═══════════════╡
│ 2000-01-04 ┆ 2000-01-17 │
│ 2000-01-... | <python><dataframe><python-polars> | 2023-09-04 12:07:28 | 4 | 331 | Hakase |
77,037,340 | 1,619,706 | Python Stored procedure sql injection | <p><strong>Question:</strong><br />
I would like to know if the below stored procedure is safe from sql injection and I know that the general guideline is to use parametrized query. However, I am not sure how to put parametrized query in a stored procedure.</p>
<p><strong>Context</strong>:<br />
I am using flask/python... | <python><mysql><stored-procedures><sql-injection> | 2023-09-04 11:29:05 | 1 | 331 | jackysatpal |
77,037,297 | 9,615,185 | Creating a Databricks Job with Separate Tasks and Parameters from within a notebook | <p>I'm trying to create a Databricks job using the Databricks Python SDK, and I want to set up separate tasks within the job that call a Python file with specific parameters. Here's a simplified version of my code:</p>
<pre><code>import os
import time
import json
from databricks.sdk import WorkspaceClient
from databri... | <python><databricks><jobs> | 2023-09-04 11:22:07 | 0 | 1,592 | Dor Lugasi-Gal |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.