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,241,720 | 2,029,629 | How can I map a numpy array into another numpy array | <p>I have two numpy arrays. A 3D or 2D array <code>reference</code> and a 3D array <code>map_</code>.</p>
<p>In this example let Reference be</p>
<pre><code>reference = array([[ [11,12,13], [14,15,16], [17,18,19] ],
[ [21,22,23], [24,25,26], [27,28,29] ],
[ [31,32,33], [34,35,36], ... | <python><arrays><numpy> | 2023-10-06 03:37:40 | 3 | 2,678 | Carlos Eugenio Thompson PinzΓ³n |
77,241,655 | 19,675,781 | How to change colors based on the two other rows in Seaborn barplot | <p>I have a dataframe like this:</p>
<pre><code>index = ['Col-45', 'Col-68', 'Col-17', 'Col-69', 'Col-43', 'Col-49', 'Col-91',
'Col-13', 'Col-14', 'Col-18', 'Col-38', 'Col-37', 'Col-40', 'Col-44',
'Col-32', 'Col-82', 'Col-75', 'Col-19', 'Col-5', 'Col-6', 'Col-16',
'Col-4', 'Col-7', 'Col-41', 'Col-1... | <python><pandas><matplotlib><seaborn> | 2023-10-06 03:09:31 | 1 | 357 | Yash |
77,241,563 | 1,637,798 | SWIG wrap for Python a void function with an output reference to smart pointer parameter | <p>Along the lines of <a href="https://stackoverflow.com/questions/53387538/swig-struct-pointer-as-output-parameter">this question</a>, suppose we have a C++ <code>struct S </code>and a function <code>makeS</code> which creates an instance of <code>S</code> and assigns it to a shared pointer <code>p</code>. Here is a ... | <python><c++><swig><swig-typemap> | 2023-10-06 02:31:54 | 2 | 2,134 | Lars Ericson |
77,241,495 | 3,198,767 | How to mock google bigquery client for unittests in pytests | <p>Below I am using a python client library to connect to bigquery and a service account to connect to the bigquery (see <a href="https://cloud.google.com/python/docs/reference/bigquery/latest/index.html" rel="nofollow noreferrer">this link</a> to get more info about the library).</p>
<pre><code>from google.cloud.bigqu... | <python><google-bigquery><mocking><pytest><patch> | 2023-10-06 02:05:07 | 0 | 1,793 | Deepak Kothari |
77,241,412 | 1,833,118 | How to obtain start and commit timestamps of transactions? | <p>How can I obtain start and commit timestamps of transactions in Dgraph from operation messages or database logs? I need to issue multiple transactions in each client session.</p>
<p>I use <a href="https://hub.docker.com/r/dgraph/dgraph" rel="nofollow noreferrer">this Docker image</a>:</p>
<pre><code>docker pull dgra... | <python><transactions><dgraph> | 2023-10-06 01:34:38 | 1 | 2,011 | hengxin |
77,241,390 | 11,117,255 | Querying HTML Content in Common Crawl Dataset Using Amazon Athena | <p>I am currently exploring the massive Common Crawl dataset hosted on Amazon S3 and am attempting to use Amazon Athena to query this dataset. My objective is to search within the HTML content of the web pages to identify those that contain specific strings within their tags. Essentially, I am looking to filter out we... | <python><amazon-web-services><web-crawler><amazon-athena><common-crawl> | 2023-10-06 01:22:01 | 3 | 2,759 | Cauder |
77,241,304 | 807,797 | Broken script fails to break calling program | <p>What specific syntax needs to be changed in the code below in order to cause the broken script to halt the program that calls it?</p>
<p><strong>PROBLEM:</strong></p>
<p>An object-oriented Python 3 program needs to run external scripts. The problem is that, when the program calls a script that breaks, the Python pr... | <python><python-3.x><shell><popen> | 2023-10-06 00:42:34 | 1 | 9,239 | CodeMed |
77,241,240 | 8,245,814 | While using this algorithm to approximate pi, I'm getting: TypeError: unsupported operand type(s) | <p>To find the real value of pi I'm using:</p>
<pre><code>from mpmath import mp
prec= 10**4 # precision equal to 10^4 digits
mp.dps = prec
# mp.pi is the value of pi with 10^4 digits of precision
</code></pre>
<p>I'm using the BBP formula to approximate pi:</p>
<pre><code>from decimal import Decimal, getcontext
getcon... | <python><pi> | 2023-10-06 00:17:56 | 0 | 319 | Pinteco |
77,241,228 | 15,632,586 | TypeError: Invalid data type 'str' when using DataLoader to train SciBERT | <p>I am trying to perform k-fold cross validation with SciBERT, using a dataset with 2 columns: <code>'text'</code> and <code>'label'</code>. My current dataset is looking like this, as a DataFrame from pandas:
<a href="https://i.sstatic.net/b49cG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/b49cG.png... | <python><tensorflow><pytorch><bert-language-model> | 2023-10-06 00:11:08 | 1 | 451 | Hoang Cuong Nguyen |
77,241,220 | 11,249,098 | AWS S3 - how to prevent docs from downloading instead of displaying with pre-signed urls | <p>This may seem like a question similar to others, but the focus is that it is a .doc file.</p>
<p>I am working with Python to generate AWS s3 pre-signed urls that looks like this:</p>
<pre class="lang-py prettyprint-override"><code>def generate_s3_presigned_url(self, filename, expiration=300):
try:
mime_t... | <python><amazon-web-services><amazon-s3><pre-signed-url> | 2023-10-06 00:08:38 | 2 | 489 | Flora Biletsiou |
77,241,219 | 219,153 | Unexpectedly poor zip compression result | <p>This python script:</p>
<pre><code>import numpy as np
a = np.ones((10_000_000_000), dtype='u1')
np.savez_compressed('a-zip', a=a)
</code></pre>
<p>produces 9.7MB large file. Theoretically this array can be compressed to less than 100 bytes: 71 bytes for <code>.npy</code> header and a handful of bytes for 10,000,000... | <python><numpy><zip><compression> | 2023-10-06 00:08:11 | 2 | 8,585 | Paul Jurczak |
77,241,030 | 10,291,435 | gecoder module works fine in the code, but is not found in udf pyspark running in virtual env for python | <p>I created virtual env in python and I installed gecoder, on it.</p>
<p>I try to run this:</p>
<pre><code>import geocoder
def get_lat_long(address):
g = geocoder.osm(address, method='reverse')
if g.ok:
location = g.json
return (location.get('lat', 0), location.get('lng', 0))
else:
... | <python><pyspark><python-venv> | 2023-10-05 23:06:02 | 0 | 1,699 | Mee |
77,241,026 | 17,653,423 | How to get dictionary in a list of dicts based on key value? | <p>A function receives a list of emails and calls other methods which can return a payload with status <code>success</code> or <code>error</code>. If a method returns <code>error</code> it doesn't stop the flow, the function continue to the following method.</p>
<p>For each email, I want to get the first payload with <... | <python> | 2023-10-05 23:04:40 | 3 | 391 | Luiz |
77,241,020 | 1,432,980 | serialize json object with classmethods | <p>I have an object that looks like this</p>
<pre><code>import json
from typing import Any
class Identity:
def __init__(self, name: str) -> None:
self.name = name
class BasicEncoder(json.JSONEncoder):
def default(self, obj: Any) -> Any:
return obj.__dict__
id = Identity(name='Ra... | <python><json> | 2023-10-05 23:00:19 | 1 | 13,485 | lapots |
77,240,996 | 607,846 | Matching on part of a string in a unittest | <p>I have the following test:</p>
<pre><code>self.assertDictEquals(
result,
{
1: 2,
3: 4,
5: "Error: You entered 1, while one of the following values was expected: 2, 3, ... 1000"
}
)
</code></pre>
<p>where the string above is very long as it lists all the expected values. Therefore I... | <python><unit-testing> | 2023-10-05 22:53:47 | 0 | 13,283 | Baz |
77,240,878 | 15,587,184 | Tokenizing and summarizing Textual data by group efficiently in Python | <p>I have a dataset in Python that look like this one:</p>
<pre><code>data = pd.DataFrame({
'ID': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'],
'TEXT': [
"Mouthwatering BBQ ribs cheese, and coleslaw.",
"Delicious pizza with pepperoni and extra cheese.",
"Sp... | <python><pandas><dataframe><nlp><gensim> | 2023-10-05 22:16:39 | 1 | 809 | R_Student |
77,240,858 | 7,656,369 | How to fix: cannot import name '_request_ctx_stack' from 'flask' | <p>I made some changes to my project (and after rebuilding its virtual environment) I started encountering this issue when running my suite of unit tests:</p>
<pre><code>ImportError: cannot import name '_request_ctx_stack' from 'flask'
</code></pre>
<p>The weird thing is that I hadn't altered the code related to the te... | <python><flask><python-venv><flask-script> | 2023-10-05 22:12:12 | 3 | 992 | alejandro |
77,240,746 | 22,371,917 | Endpoint not working with flask-selenium on render.com? | <p>Code:</p>
<pre class="lang-py prettyprint-override"><code>from selenium import webdriver
from selenium.webdriver.common.by import By
from flask import Flask
app = Flask(__name__)
@app.route("/t")
def st():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless=ne... | <python><selenium-webdriver><flask><render.com> | 2023-10-05 21:42:44 | 0 | 347 | Caiden |
77,240,678 | 1,812,732 | How to find the threshold that will yield the desired number of array elements | <p>Given an array of numbers and a target count, I want to find the threshold such that the number of element that are above it will be equal the target (or as close as possible).</p>
<p>For example.</p>
<pre><code>arr = np.random.rand(100)
target = 80
for i in range(100):
t = i * 0.01
if (arr > t).sum() <... | <python><numpy> | 2023-10-05 21:28:14 | 4 | 11,643 | John Henckel |
77,240,508 | 22,466,650 | How to make hbars in subplots with shared properties and no delimiter? | <p>My input is a dataframe <code>df</code> (you can find a snippet in the end of my question) and I try to create a plot like the second 'Panel vendor bar chart' here : <a href="https://peltiertech.com/stacked-bar-chart-alternatives" rel="nofollow noreferrer">https://peltiertech.com/stacked-bar-chart-alternatives</a></... | <python><matplotlib><bar-chart><subplot> | 2023-10-05 20:51:22 | 1 | 1,085 | VERBOSE |
77,240,144 | 7,492,737 | What is numpy doing when assigning values beyond the dimensions of the array? | <p>What exactly is numpy doing when you assign values outside the bounds of the array? Does it pose a risk of overwriting some area of the memory currently used by something else?</p>
<p>In this example, it writes row 9 to all ones. I was hoping to use this to get around an edge case, but I can't find any documentation... | <python><numpy> | 2023-10-05 19:45:55 | 1 | 302 | Chris McL |
77,240,105 | 3,566,606 | Python Typing: Generic Type that has the same interface as the wrapper type | <p>I would like to define a sort of "wrapper" Generic Type, say <code>MyType[T]</code>, so that it has the same type interface as the wrapped type.</p>
<pre class="lang-py prettyprint-override"><code>from typing import Generic, TypeVar
T = TypeVar("T")
class MyType(Generic):
pass # what to wr... | <python><python-typing> | 2023-10-05 19:39:56 | 2 | 6,374 | Jonathan Herrera |
77,240,058 | 11,751,799 | `plotly` Sankey plot: able to color the inflows and outflows upon hovering over a node | <p>I am working with the <code>plotly</code> package in Python and have made a nice Sankey plot. Other Stack Overflow posts discuss how to set the connection colors. However, I am content to have the default colors unless the user hovers over a node. In that case, I would like the inflows to light up in blue and the ou... | <python><colors><graphics><plotly><sankey-diagram> | 2023-10-05 19:29:29 | 1 | 500 | Dave |
77,239,936 | 7,064,415 | How to call `subprocess` efficiently (and avoid calling it in a loop) | <p>I have a Python script that contains a for-loop that iterates through a list of items. I need to perform a computation on a property of each item, but the code that does this computation is in Java (where the java <code>main()</code> method accepts two arguments: <code>arg1</code> and <code>arg2</code> in the exampl... | <python><for-loop><subprocess> | 2023-10-05 19:07:52 | 1 | 732 | rdv |
77,239,727 | 4,133,188 | Open3D: Creating a partial sphere | <p>I am using Open3D with Python and would like to create a partial sphere based on limits for $\phi$ and $\theta$ (spherical coordinate representation). The <code>create_sphere</code> only allows me to create complete spheres.</p>
<pre><code>import open3d as o3d
a = o3d.geometry.TriangleMesh.create_sphere()
a.compute_... | <python><open3d> | 2023-10-05 18:28:58 | 1 | 771 | BeginnersMindTruly |
77,239,704 | 856,804 | In Ray, does worker node system logs get streamed back to header node or only stay in worker node by default | <p>I noticed system logs on worker node become unavailable when the node is gone, suspecting the log only stays in worker node. Is that correct? If so, how does the worker node becomes available on Ray dashboard?</p>
<p>The Ray log persistence doc at <a href="https://docs.ray.io/en/latest/cluster/kubernetes/user-guides... | <python><ray> | 2023-10-05 18:25:29 | 1 | 9,110 | zyxue |
77,239,338 | 1,968,829 | How to optimize this iterable over a pandas dataframe | <p>I have the following dataframe:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import re
d = {
'I am a sentence of words.': 'words',
'I am not a sentence of words.': 'words',
'I have no sentence with words or punctuation': 'letter',
'I am not a sentence with a letter or pun... | <python><pandas><vectorization> | 2023-10-05 17:27:37 | 1 | 2,191 | horcle_buzz |
77,239,148 | 5,405,669 | psycopg stops deserializing in celery app context | <p>I have a psycopg <code>ConnectionPool</code> that extends the flask app:</p>
<pre class="lang-py prettyprint-override"><code>def init_pool(cfg, connection_class, name) -> ConnectionPool:
pool = ConnectionPool(
conninfo=f"postgresql://{cfg['user']}:{cfg['password']}@{cfg['host']}/{cfg['database']... | <python><python-3.x><flask><celery-task><psycopg3> | 2023-10-05 16:54:17 | 1 | 916 | Edmund's Echo |
77,239,047 | 2,386,113 | Different floating point precision in Matrix multiplication in Python and C++ | <p>I am trying to do a very simple thing</p>
<ol>
<li>take a square shape 2d array</li>
<li>take its transpose</li>
<li>multiply the array with its transpose</li>
</ol>
<p>I am trying to perform the above steps in C++ and Python as shown in the programs below:</p>
<p><strong>C++ Program:</strong></p>
<pre><code>#includ... | <python><c++><precision><floating-accuracy> | 2023-10-05 16:36:19 | 0 | 5,777 | skm |
77,239,027 | 4,489,998 | Basinhopping (two-phase) optimization on multivariate-valued functions | <h3>Background</h3>
<p>So far, I've been using <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.least_squares.html" rel="nofollow noreferrer"><code>scipy.optimize.least_squares</code></a> to find a root to a multivalued function <code>f: R^n -> R^m</code>. This works great for local optim... | <python><scipy><scipy-optimize> | 2023-10-05 16:32:47 | 0 | 2,185 | TrakJohnson |
77,238,998 | 769,486 | dependency-injector: How to provide fallbacks for configuration values? | <p>Iβm in the process of introducing dependency-injector to some old projects. In one of them I have a config value that has a fallback to another value and a default value. Essentially Iβm looking for an equivalent of:</p>
<pre class="lang-py prettyprint-override"><code>value = config.get("value", config.get... | <python><dependency-injection> | 2023-10-05 16:28:48 | 2 | 956 | zwirbeltier |
77,238,991 | 2,767,937 | How can I make my Python library with TensorFlow dependencies adaptable for both CPU and GPU versions using Setuptools? | <p>I am building a python library that would be deployed as a python package on PyPI.
The tool I'm using as build system is Setuptools. The library is supposed to work with TensorFlow as a dependency so it is pretty straightforward to add it to the project:</p>
<pre class="lang-ini prettyprint-override"><code>[project]... | <python><tensorflow><pip><setuptools><pep> | 2023-10-05 16:28:03 | 1 | 629 | TantrixRobotBoy |
77,238,856 | 22,307,474 | Problems installing libraries via pip after installing Python 3.12 | <p>Today I installed the new Python 3.12 on my Ubuntu 22.04 from the ppa repository <strong>ppa:deadsnakes/ppa</strong>.</p>
<p>Everything works, but when I try to install some library with the command <code>python3.12 -m pip install somelibrary</code>, I get the following error</p>
<pre><code>ERROR: Exception:
Traceba... | <python><python-3.x><pip> | 2023-10-05 16:10:58 | 3 | 510 | bin4ry |
77,238,738 | 20,591,261 | Iterate average of n elements per row | <p>I have a dataframe with a shape of (2205, 6000) obtained using a sensor with sampling rate 100hz. Each row correspond to a minute cicle (In this case i have 2205 cicles, 6000 samples per minute), but i need to get info for each second.</p>
<p>So, for each row i need to get the mean for the 100 values until the last ... | <python><dataframe> | 2023-10-05 15:54:05 | 2 | 1,195 | Simon |
77,238,646 | 14,667,736 | Python: http.server.ThreadingHTTPServer fails since update to Python 3.12 | <p>I've got a simple Python HTTP server application based on <code>http.server.ThreadingHTTPServer</code>, running in a Docker container. It works fine with Python 3.11, but under Python 3.12 aborts with the following as soon as a HTTP request comes in:</p>
<pre><code>Exception occurred during processing of request fro... | <python><python-3.x><http.server> | 2023-10-05 15:42:46 | 0 | 341 | Wolfram RΓΆsler |
77,238,628 | 805,886 | In VS Code: Red (stop running script) square button disappeared | <p>This happened to me: For years had a green "play" button at top right of screen to run my python script. When running (<strong>not in debug mode</strong>), a red square "stop" button would be in that spot that I could press to cause my code to stop running. Just today I was installing VS Code on ... | <python><visual-studio-code> | 2023-10-05 15:40:34 | 1 | 1,054 | ScotterMonkey |
77,238,503 | 14,982,219 | pydantic. Add optional field depends on value of another field | <p>Hi I have to validate this two json<br />
first json</p>
<pre><code>{ 'building_type' : 'flat',
'direction': 'Fake Street',
'number': 123,
'apartment': 3
}
</code></pre>
<p>second json</p>
<pre><code>{ 'building_type' : 'house',
'direction': 'Fake Street',
'number': 123
}
</code></pre>
<p>my model</p>
<pre... | <python><json><pydantic> | 2023-10-05 15:23:38 | 0 | 381 | vll1990 |
77,238,451 | 15,900,832 | Plotly: Hide colorbar on Surface plot | <p>I can't figure out how to hide the colorbar on a Plotly Surface plot.</p>
<p>The code I am using is:</p>
<pre><code>import plotly.graph_objs as go
import numpy as np
x = np.linspace(0, 9, 10)
y = x
z = np.linspace(0, 99, 100).reshape((10, 10))
fig = go.Figure()
fig.add_trace(
go.Surface(
x=x,
y... | <python><plotly><colorbar> | 2023-10-05 15:16:45 | 1 | 633 | basil_man |
77,238,396 | 14,584,978 | Duckdb query plan parse to json | <p>Is there a better way to export data from the duckdb in sql? The default is to export to a pretty print format with boxes and details on each.</p>
<p><a href="https://duckdb.org/docs/guides/meta/explain.html" rel="nofollow noreferrer">Duckdb Explain docs</a></p>
<p>I am currently running the following script to pars... | <python><sql><duckdb> | 2023-10-05 15:10:25 | 1 | 374 | Isaacnfairplay |
77,238,309 | 565,380 | How can I cast a Polars DataFrame to string | <p>How do I stringify a small <em><strong>df.head</strong></em> result.</p>
<p>I have the following code:</p>
<pre><code>df.head(row_amount).to_pandas().to_string()
</code></pre>
<p>I normally print out 2 or 3 rows but I need it in a string. I solved it like above by transforming it to pandas first. I have also solved ... | <python><pandas><python-polars> | 2023-10-05 14:58:21 | 1 | 2,597 | Hans Wassink |
77,238,109 | 3,535,537 | Python - How to append conditionaly in array? | <p>I have a list of lists (records). Each record consists of 4 elements: <code>[id, msg_key, msg_value, date]</code></p>
<p>For example:</p>
<pre><code>events = [
[1, "foo", "bar", 709],
[1, "foo", "bar2", 710],
[1, "foo", "bar", 711],
[1, &q... | <python> | 2023-10-05 14:30:57 | 2 | 11,934 | StΓ©phane GRILLON |
77,238,097 | 14,956,120 | QPrintPreviewWidget freezes the application when the horizontal scrollbar is shown | <p>I am having a bug with QPrintPreviewWidget (PySide2 5.15.2.1, Windows 11). From the moment I made this post, I didn't found anything related online.</p>
<p>When I force the horizontal scrollbar to appear inside the inherited scroll area (by resizing the window), the application becomes unresponsive, freezing instant... | <python><pyqt5><pyside2><qscrollarea><qprinter> | 2023-10-05 14:29:10 | 1 | 1,039 | Carl HR |
77,238,077 | 13,184,183 | How to enforce pyspark reader to use specified schema instead of inferring one from parquet? | <p>I have a parquet file which has some schema. It involves some invalid characters, so I want to use my own schema. Let's say the parquet metadata contains <code>original_schema</code> and I have <code>new_schema</code> which is obtained by renaming most of the fields of <code>original_schema</code>, so they both have... | <python><apache-spark><pyspark> | 2023-10-05 14:26:24 | 1 | 956 | Nourless |
77,237,969 | 3,041,764 | How to serve static files from submodules in Flask | <p>I'm writing a Flask application divided into modules, with each module residing in a separate folder that includes 'templates' and 'static' folders.</p>
<p>In each module, I'm passing a global variable 'custom_js' to the template:</p>
<pre><code>module_bp = Blueprint('module', __name__, template_folder='templates', ... | <python><flask><jinja2><static-files> | 2023-10-05 14:15:19 | 1 | 849 | user3041764 |
77,237,945 | 16,852,041 | E ModuleNotFoundError: No module named 'botocore.compress' | <p>I had both <code>boto3</code> and <code>botocore</code> installed in my conda venv, but was getting this error during compilation:</p>
<pre class="lang-bash prettyprint-override"><code>E ModuleNotFoundError: No module named 'botocore.compress'
</code></pre>
| <python><pip><boto3><modulenotfounderror><botocore> | 2023-10-05 14:12:26 | 1 | 2,045 | DanielBell99 |
77,237,818 | 2,160,809 | How to load a huggingface pretrained transformer model directly to GPU? | <p>I want to load a huggingface pretrained transformer model directly to GPU (not enough CPU space)
e.g. loading BERT</p>
<pre><code>from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("bert-base-uncased")
</code></pre>
<p>would be loaded to CPU until executing</p>
<pre>... | <python><nlp><huggingface-transformers> | 2023-10-05 13:57:40 | 1 | 2,274 | cookiemonster |
77,237,557 | 4,317,946 | In project build results, Python Pyramid referencing a view source file that no longer exists | <p>In a Python Pyramid project, I tried to rename a project view file temporarily while testing a new version of this file. Originally, the project started with the following view file:</p>
<pre><code>/myproject/myproject/views/default.py
</code></pre>
<p>I then renamed this file to some other temporary name:</p>
<pre>... | <python><pyramid> | 2023-10-05 13:25:38 | 0 | 690 | Tim D |
77,237,544 | 5,475,506 | Identifying Correct JAR Versions for S3 Integration with PySpark 3.5 | <p>I am attempting to set up a PySpark environment to read data from S3 using PySpark 3.5 in a Conda environment (Python 3.12). However, I am facing difficulties in identifying the correct versions of the <strong>aws-java-sdk</strong> and <strong>hadoop-aws</strong> JARs to use (needed for reading data from S3 directly... | <python><amazon-web-services><amazon-s3><pyspark> | 2023-10-05 13:24:32 | 2 | 516 | AngryCoder |
77,237,513 | 3,380,209 | How to control the zorder of polygons | <p>I have modified the <a href="https://matplotlib.org/stable/gallery/event_handling/poly_editor.html" rel="nofollow noreferrer">Poly Editor</a> (from the gallery of Matplotlib) to make it able to load several polygons at a time. This works fine except on one point: I don't know how to control the zorder of the polygon... | <python><matplotlib><tkinter-canvas> | 2023-10-05 13:20:05 | 1 | 3,100 | albar |
77,237,468 | 11,028,689 | Is there a better way to access values in a JSON file than a 'for' loop? | <p>I have a JSON file which looks like this:</p>
<pre><code>[{'data': [{'text': 'add '},
{'text': 'Stani, stani Ibar vodo', 'entity': 'entity_name'},
{'text': ' songs in '},
{'text': 'my', 'entity': 'playlist_owner'},
{'text': ' playlist '},
{'text': 'mΓΊsica libre', 'entity': 'playlist'}]},
{'data': [{'... | <python><json><list><readlines> | 2023-10-05 13:14:33 | 2 | 1,299 | Bluetail |
77,236,930 | 4,205,289 | PyCharm warning for 'None' argument passed to function decorated with functools.cache | <p>I have a function that may accept None as a value of its argument, this function is cached using functools.cache. Here is a simplified example:</p>
<pre><code>from functools import cache
counter = 0
@cache
def cached_func(arg1, arg2):
global counter
print('Call of cached func: #{}, args: {}, {}'.format(coun... | <python><pycharm><functools> | 2023-10-05 12:04:00 | 0 | 543 | Roman |
77,236,916 | 3,616,293 | torch DDP Multi-GPU gives low accuracy metric | <p>I am trying Multi-GPU, single machine DDP training in PyTorch (CIFAR-10 + ResNet-18 setup). You can refer to the model architecture code <a href="https://github.com/arjun-majumdar/CNN_Classifications/blob/master/ResNet18_swish_torch.py" rel="nofollow noreferrer">here</a> and the full training code <a href="https://g... | <python><pytorch><multi-gpu> | 2023-10-05 12:01:07 | 0 | 2,518 | Arun |
77,236,763 | 14,314,892 | Can't install pyinstaller for python 2.7 | <p>I try to install pyinstaller through pip and i get a syntax error. It succesfully downloads package and components then throws the error. The error is showing me an f string. I know that f strings came with python3 and i am trying to install old version of pyinstaller which is 3.6 and compatible with python 2.7. My ... | <python><pip><pyinstaller> | 2023-10-05 11:37:48 | 1 | 707 | aoiTenshi |
77,236,722 | 4,504,877 | Simulating - speeding up script in python | <p>I have the following script:</p>
<pre><code>import pandas as pd
import numpy as np
import os
import scipy.stats as sp
raw = pd.read_csv("ELT_RawData.csv")
raw["weight"] = raw["RATE"] / np.sum(raw["RATE"])
MU = np.sum(raw["RATE"])
poisson = sp.poisson(mu=MU)
n_... | <python><profiling> | 2023-10-05 11:31:48 | 4 | 566 | user33484 |
77,236,506 | 1,669,328 | async BlobClient.stage_block() regularly raises exception for 'HTTP Error 400. The request verb is invalid.' | <p>I'm using the python SDK to upload a block to an Azure Bob Storage Container. I need to do a partitioned upload so I'm using the <code>BlobClient.stage_block(...)</code> call. For performance reasons, I'm using the asynchronous version of the BlobClient (<code>azure.storage.blob.aio</code>).</p>
<p>Staging the first... | <python><python-3.x><azure><azure-blob-storage><azure-python-sdk> | 2023-10-05 11:00:52 | 1 | 548 | Matthias Holzapfel |
77,236,502 | 4,809,603 | Python to send a message to Teams using Microsoft Graph whilst keeping formatting with JSON vnd.microsoft.card.adaptive | <p>I am trying to send a message to MS Teams using MS Graph. This code works if I just use an unformatted string, like the below:</p>
<pre><code> headers = {
"Authorization": f"Bearer {bearer_token}"
}
body = {
"body": {
"content": message
... | <python><json><microsoft-graph-teams> | 2023-10-05 11:00:43 | 0 | 415 | Rhys |
77,236,381 | 7,895,542 | coverage/pytest and gitlab CI not running | <p>I am currently having two issues involving coverage/pytest and gitlab CI.</p>
<p>The bigger and more recent one is that pytest and coverage do nothing at all when i call them in the gitlab CI. I do not get any output or error message at all. Only at the end does the job return with a non-zero exit code and fail. It ... | <python><gitlab><pytest><gitlab-ci><coverage.py> | 2023-10-05 10:41:59 | 0 | 360 | J.N. |
77,236,281 | 7,895,542 | Type hinting pairwise with overhang | <p>I took over a code base (support down to 3.9) and wanted to add some type hinting. However I am currently stuck at this function.</p>
<pre><code>def _pairwise(iterable: T.Iterable, end=None) -> T.Iterable:
left, right = itertools.tee(iterable)
next(right, None)
return itertools.zip_longest(left, right... | <python><python-itertools><python-typing> | 2023-10-05 10:25:27 | 1 | 360 | J.N. |
77,236,258 | 3,567,987 | converting float (32 bit) and double (64 bit) to bytes | <p>I am trying to send a data buffer from Python over TCP to a C++ server.</p>
<p>The TCP pack order is defined as follows:</p>
<ol>
<li>bytes[0 till 3] must be an integer (32 bit) with value = length of the buffer</li>
<li>bytes[4 till 7] must be a float (32 bit)</li>
<li>bytes[8 till 15] must be a double (64 bit)</li... | <python><floating-point><byte> | 2023-10-05 10:22:36 | 0 | 2,289 | Thomas |
77,236,253 | 2,132,157 | How can I get the path vertices of an Ellipse with the axes coordinates and not -1 to 1 coordinates? | <p>When I try to get the path vertices of an ellipse using Matplotlib the vertices are returned scaled from -1 to 1.
I would like to understand what is the suggested way to get the vertices using the axes coordinates system and not the scaled one:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
fig,... | <python><matplotlib><ellipse> | 2023-10-05 10:21:41 | 0 | 22,734 | G M |
77,236,080 | 10,159,065 | A/B testing using t test | <p>I am running some simulations to test changes to the current model, Let's call the changes as new algorithm.
My model predicts the route for a particular transaction between two possible routes. The success rate is defined as total success/ total transactions.
The below dataframe has two columns old and new. old has... | <python><pandas><statistics><simulation><ab-testing> | 2023-10-05 09:58:28 | 1 | 448 | Aayush Gupta |
77,235,773 | 5,501,815 | python/mypy exhaustiveness checking with tuples | <p>I am trying to match on the value of a <code>Union</code> and have mypy perform exhaustiveness checking. Here is a minimal working example:</p>
<pre class="lang-py prettyprint-override"><code>t: tuple[int, float] | str
match t:
case str():
print("found str")
case (int(), float()):
p... | <python><match><mypy> | 2023-10-05 09:18:36 | 1 | 1,306 | Sebastiaan |
77,235,643 | 13,184,183 | Why renamed schema alter result of query pyspark? | <p>I have large parquet dataframe with invalid characters in the names of fields (dots and braces)
If I read it as is and print some aggregation</p>
<pre class="lang-py prettyprint-override"><code>>>> df1 = spark.read.parquet(source)
>>> df1.select('`A.B.C`').fillna(0).agg({'`A.B.C`' : 'max'}).show()
... | <python><dataframe><apache-spark><pyspark> | 2023-10-05 08:58:33 | 1 | 956 | Nourless |
77,235,565 | 18,108,367 | Why the thread inherited by the child process is in the stopped status while in parent process is in the status started? | <h2>Safely forking a multithreaded process is problematic</h2>
<p>I'm learning to use the <code>multiprocessing</code> module. Now I'm focusing on the following sentence:</p>
<blockquote>
<p>Note that safely forking a multithreaded process is problematic.</p>
</blockquote>
<p>present in the <a href="https://docs.python... | <python><linux><multithreading><multiprocessing><fork> | 2023-10-05 08:48:04 | 1 | 2,658 | User051209 |
77,235,342 | 2,573,168 | Run external program inside a conda environment in R | <p>I am trying to run <a href="https://jamieheather.github.io/stitchr/index.html" rel="nofollow noreferrer">stitchr</a> in R. For programs that run in Python, I use <code>reticulate</code>. I create a conda environment named <code>r-reticulate</code>, where I want to install <code>stitchr</code> and run it.</p>
<p>I tr... | <python><r><conda><external><reticulate> | 2023-10-05 08:13:44 | 2 | 3,247 | DaniCee |
77,235,225 | 7,188,690 | Is there an efficient way to union all the spark dataframes than using union()? | <p>I am trying to union a big spark data frame. But I am getting <code>Py4JJavaError: An error occurred while calling o26434.collectToPython. : org.apache.spark.SparkException: Job 390 cancelled because SparkContext was shut down</code>
Is there any better way to union the dataframes that will be efficient in terms of ... | <python><pyspark> | 2023-10-05 07:58:55 | 0 | 494 | sam |
77,235,156 | 3,999,951 | Check if a column's integer is in another column's string of integers | <p>A dataframe has two columns. One has a single integer per row. The other has a string of multiple integers, separated by ',', per row:</p>
<pre><code>import pandas as pd
duck_ids = ["1, 4, 5, 7", "3, 11, 14, 27"]
ducks_of_interest = [4,15]
duck_df = pd.DataFrame(
{
"DucksOfIntere... | <python><pandas> | 2023-10-05 07:48:42 | 2 | 467 | acolls_badger |
77,235,064 | 17,721,722 | How to Format Python Code to 'No Wrap' with an extention in VS Code? | <p>I have both Autopep8 and Black Formatter Installed in VS Code. I don't want to wrap python code to new lines. Please provide different ways to do this.</p>
<p>I tried to format this line, So that wrapping will go away.</p>
<pre><code>definition_mst_id = self.request.query_params.get(
'defination_id', None)
</cod... | <python><visual-studio-code> | 2023-10-05 07:34:32 | 1 | 501 | Purushottam Nawale |
77,235,006 | 4,196,578 | ImportError: cannot import name 'docstring' from 'matplotlib' | <p>Recently, my code involving <code>matplotlib.pyplot</code> suddenly stopped working on all my machines (Ubuntu 22.04 LTS). I tried a simple <code>import</code> and got the following error:</p>
<pre><code>$ python
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyrig... | <python><matplotlib><importerror> | 2023-10-05 07:26:05 | 2 | 22,728 | thor |
77,234,933 | 2,562,058 | How to correctly change the internal state of a closure in python? | <p>I am looking into closures, but I am a bit confused on how to change their internal state.</p>
<p>Consider the following two examples:</p>
<pre><code>def mean():
sample = []
def inner_mean(number):
sample.append(number)
return sum(sample) / len(sample)
return inner_mean
</code></pre>
<p... | <python><python-3.x> | 2023-10-05 07:16:20 | 1 | 1,866 | Barzi2001 |
77,234,846 | 7,848,740 | Persistent name of USB serial device with Python pyserial | <p>I have a Python application that chose serial device using <a href="https://pyserial.readthedocs.io/en/latest/tools.html#module-serial.tools.list_ports" rel="nofollow noreferrer">pyserial</a> <code>serial.tools.list_ports</code></p>
<p>I have two USB to RS485 serial adapter connected. They won't be disconnected from... | <python><linux><serial-port><pyserial> | 2023-10-05 07:01:04 | 1 | 1,679 | NicoCaldo |
77,234,815 | 1,800,755 | Threading OpenCV video in GTK and keep events? | <p>I'm trying to get my camera feed into a GTK window,
and I'd like to keep the button-press-event and motion-notify-event events working.</p>
<p>I've found how to get the video by refreshing the image in a Gtk.image,
in a GLib.idle_add, tried with a thread.Threading, tried with a GLib.timeout_add,
but the loop is stil... | <python><multithreading><opencv><gtk3><glib> | 2023-10-05 06:54:14 | 2 | 478 | s4mdf0o1 |
77,234,759 | 2,858,044 | XCom pull by task_ids doesn't get value | <p>I have a simple dag which has two tasks in task group.
This dag has schedule every 10 minutes to pull message from google pub/sub. However the pull sensor working well to get messages, but on the next task doesn't get the message which already pushed to XCom.</p>
<p>Here is my dag</p>
<pre><code>from airflow import ... | <python><airflow> | 2023-10-05 06:45:33 | 1 | 1,419 | itx |
77,234,301 | 2,525,940 | pyqt dynamic update of property and css | <p>I'm trying to create an alert label that changes color based on some system state</p>
<pre class="lang-py prettyprint-override"><code>import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QPushButton
class MainWindow(QMainWindow):
def __init__(self):
super(Mai... | <python><css><pyqt5> | 2023-10-05 04:45:56 | 0 | 499 | elfnor |
77,234,200 | 16,545,894 | mark as read when a product order is views with id. In Django rest framework | <p>This is my models</p>
<pre><code>class Notification(models.Model):
is_read = models.BooleanField(default=False)
</code></pre>
<p>and this is my views</p>
<pre><code>
class NotificationListCreateView(generics.ListCreateAPIView):
queryset = Notification.objects.all()
serializer_class = NotificationSerializ... | <python><django-rest-framework><mvt> | 2023-10-05 04:10:37 | 1 | 1,118 | Nayem Jaman Tusher |
77,234,199 | 2,547,403 | MSYS2 and Embedding Python. No module named 'encodings' | <p>I'm trying to use embedded python in my C++ dll library. The library is built and compiled in MSYS2 using GCC compiler, CMake and Ninja. Python 3.10 is also installed on MSYS2 using pacman. Windows 10 env contains <code>C:\msys64\mingw64\bin</code> in Path (python is also located there). Python doesn't installed on ... | <python><c++><cmake><mingw><msys2> | 2023-10-05 04:10:10 | 1 | 369 | DiA |
77,233,967 | 1,718,174 | Django apps.get_models(): how to load models from other folders | <p>I have the following folder structure:</p>
<p><a href="https://i.sstatic.net/3t3fz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3t3fz.png" alt="enter image description here" /></a></p>
<p>All models from <code>apps/<some_app_name>/models.py</code> are loaded OK when using <code>apps.get_model... | <python><django><django-models> | 2023-10-05 02:40:06 | 2 | 11,945 | Vini.g.fer |
77,233,855 | 22,686,386 | Why did I get an error ModuleNotFoundError: No module named 'distutils'? | <p>I've installed <code>scikit-fuzzy</code>, but when I <code>import skfuzzy as fuzz</code> I get an error</p>
<pre class="lang-none prettyprint-override"><code>ModuleNotFoundError: No module named 'distutils'"
</code></pre>
<p>I already tried to <code>pip uninstall distutils</code> and got this output</p>
<pre cl... | <python><setuptools><distutils><skfuzzy><python-3.12> | 2023-10-05 01:54:27 | 7 | 781 | Kada |
77,233,643 | 1,245,262 | How can I fix duplicate targets with Cmake? | <p>I am currently trying to install <code>gr-matchstiq</code> from <a href="https://github.com/epiqsolutions/gr-matchstiq" rel="nofollow noreferrer">GitHubLink</a> and am having trouble. The code no longer conforms to CMake's standards.</p>
<p>Specifically, cmake 2.6 intoduced the policy that logical target names must ... | <python><c++><cmake> | 2023-10-05 00:18:19 | 1 | 7,555 | user1245262 |
77,233,621 | 14,963,549 | How to get a file from SharePoint by using Selenium in Databricks (Azure)? | <p>I've a code where I'm trying to develop an algorithm with web scraping thats be able to go into a SharePoint URL, make click in "Descargar" button in order to download a file and storage it into a temporary path, and then, convert it in a Data Frame to transform it with python. I'm using this method since ... | <python><selenium-webdriver><web-scraping><sharepoint><databricks> | 2023-10-05 00:10:03 | 1 | 419 | Xkid |
77,233,607 | 2,805,482 | Fill image are based on coordinates in cv2 | <p>I am stuck on this easy task, I have a rectangular area in an image that I need to fill with a color. I know the x1, x2, y1, y2 coordinate of the image how to fill the area based on coordinate? consider the below image and the coordinates of the area that I want to fill with a is x1 = 132.5, x2 = 270, y1 = 68.5, y2 ... | <python><opencv> | 2023-10-05 00:03:32 | 1 | 1,677 | Explorer |
77,233,600 | 6,440,589 | Can potly graph objects be used with Azure Data Explorer? | <p>I managed to create a scatter plot by evaluating a <strong>plotly</strong> snippet into a <strong>Kusto</strong> query into <strong>Azure Data Explorer</strong> (ADX):</p>
<pre><code>let varName = ```if 1:
import plotly.express as px
import pandas as pd
fig = px.scatter(df, x='easting', y='no... | <python><azure><plotly><scatter-plot><kql> | 2023-10-05 00:01:01 | 1 | 4,770 | Sheldon |
77,233,552 | 489,517 | How to use GPU to accelerate imread/imwrite of OpenCV in Python | <p>I use OpenCV Python 4.8.1 on Ubuntu to split an image into some small images.
The performance is not good and I want to accelerate the performance.
I downloaded OpenCV 4.8.1 source code and built it.
(follow this document: <a href="https://gist.github.com/raulqf/f42c718a658cddc16f9df07ecc627be7" rel="nofollow norefe... | <python><opencv><python-imaging-library><gpu> | 2023-10-04 23:45:32 | 0 | 619 | Dennys |
77,233,492 | 857,932 | Chaining classmethod constructors | <p><a href="https://stackoverflow.com/a/682545/857932">There is an idiom in Python</a> to use classmethods to provide additional ways to construct an object, where the conversion/transformation logic stays in the classmethod and the <code>__init__()</code> exists solely to initialize the fields. For example:</p>
<pre c... | <python><python-3.x><oop><class-method> | 2023-10-04 23:25:32 | 1 | 2,955 | intelfx |
77,233,467 | 2,955,541 | Convert Multivariate Polynomial to Matrix Representation | <p>Let's say I have a multivariate polynomial:</p>
<pre><code>import sympy
x_1, x_2, x_3, x_4 = sympy.symbols('x_1 x_2 x_3 x_4')
expressions = [
-x_1*x_1-x_2*x_2+x_1*x_2,
x_2*x_2-x_1*x_2,
x_1*x_1-x_1*x_2,
x_1*x_2,
x_1*x_1-x_1*x_3,
x_1*x_3,
x... | <python><matrix><sympy><polynomials> | 2023-10-04 23:12:01 | 1 | 6,989 | slaw |
77,233,404 | 11,279,970 | Using llama-index loading Nodes into Weaviate Vector Store errors with TypeError: Object of type WindowsPath is not JSON serializable | <p>I am following the llama-index tutorial <a href="https://gpt-index.readthedocs.io/en/stable/examples/low_level/ingestion.html#load-data" rel="nofollow noreferrer">Building Data Ingestion From Scratch</a> which uses Pinecone to ingest the formatted nodes with</p>
<pre><code>from llama_index.vector_stores import Pine... | <python><weaviate><llama-index> | 2023-10-04 22:51:56 | 1 | 508 | Simon Palmer |
77,233,242 | 13,062,745 | Python defaultdict(list) behavior | <p>I was playing around with Chatgpt and it kind of suprised me that if you declare</p>
<pre><code>node = defaultdict(list)
node['xyz'] = 'xyz'
</code></pre>
<p>adding a new string key-value pair. I thought node will create a new list when 'xyz' key doesn't present in the node, therefore if you assign A string to [], i... | <python><python-3.x><list><defaultdict> | 2023-10-04 22:04:10 | 2 | 742 | zxcisnoias |
77,233,241 | 14,328,794 | Inserting huge data from one to another table and simultaneously deleting after movement using pyodbc package in Python file | <p>I am trying to use SQL Server and Python to perform data migration and deletion.
However, during the process of execution, I find it hard to reconcile the data which is being inserted in new table in a loop is also moving the same data and also deleting the same data in a batch of 1000. I mean the exact rows.</p>
<p... | <python><sql><sql-server><pyodbc> | 2023-10-04 22:02:44 | 1 | 380 | Anil Dhage |
77,233,108 | 6,084,335 | Poetry No file/folder found when attempting to reference another local poetry project | <p>I have the following directory structure:</p>
<pre><code>βββ lib
βΒ Β βββ stuff
βΒ Β βββ __init__.py
βΒ Β βββ math.py
βΒ Β βββ poetry.lock
βΒ Β βββ pyproject.toml
βββ services
βββ a
βββ __init__.py
βββ main.py
βββ poetry.lock
βββ pyproject.toml
</code></pre>
<p>Both <co... | <python><python-poetry> | 2023-10-04 21:32:31 | 0 | 1,717 | Jack Evans |
77,233,041 | 8,387,921 | Tkinter is freezing using for loop to iterate and download files from driver | <p>I use python and selenium to read a text file which contains a more then 2000 of download link of zip files. Then on click of button i want to download files. But when i click button then tkinter freezes and give error of program not responding error. I also use time.sleep(5) methods inside for loop in hope that loo... | <python><selenium-webdriver><tkinter><selenium-chromedriver> | 2023-10-04 21:19:05 | 1 | 399 | Sagar Rawal |
77,232,820 | 2,610,522 | Solving complicated expression in SymPy takes a long time | <p>I am trying to solve symbolically the following equations using sympy. I set the <code>simplify=False</code>, and <code>rational=False</code> in the <code>solve</code> as well and it helped a lot with eq7. But it did not help with e14 and it takes forever. How can I improve this? The same code in Matlab takes a few ... | <python><sympy> | 2023-10-04 20:36:58 | 2 | 810 | Ress |
77,232,741 | 13,142,245 | How to block progression in asyncio | <p>So I understand that using <code>async ... await</code> python can prevent blocking and accomplish xyz to follow. But what about the opposite, where I <em>want</em> python to block xyz until an process has completed?</p>
<p>For example, suppose I have three functions, A,B & C where A should not block B and vice ... | <python><async-await><python-asyncio> | 2023-10-04 20:22:34 | 2 | 1,238 | jbuddy_13 |
77,232,609 | 19,130,803 | use nested class without instance | <p>I am working on python web application using <code>dash</code>.In a module,Earlier all were individual variables inside my <code>Utils</code> class, For eg:</p>
<pre><code>class Utils:
port = some_port
address = f"some_domain:some_port"
gui_docs = f"{some_domain}/docs"
gui_pgadmin = f... | <python> | 2023-10-04 19:59:58 | 0 | 962 | winter |
77,232,606 | 2,600,531 | Memory management in multiprocess python application on constrained device | <p>I have a fairly constrained Ubuntu 20.04 host (256MB RAM) that is running into OOM errors after a few hours of running my python application. I ultimately solved this by manually calling <code>gc.collect()</code> in one subprocess but I want to know why and be sure this is the best solution.</p>
<p>I identified the ... | <python><memory-management><multiprocessing><garbage-collection><out-of-memory> | 2023-10-04 19:59:15 | 0 | 944 | davegravy |
77,232,604 | 8,944,208 | How to capture id size photo with webcam using python | <p>I have this few lines code which capture images using webcam but the pictures width and heigth is large.Is it a way i can
have the frame to be small to capture images as the size of passport picture.</p>
<p>Is the any available resource I can use to achieve that .This is how I want my frame to look like so I can us... | <python><webcam><image-size> | 2023-10-04 19:58:37 | 2 | 597 | O JOE |
77,232,528 | 2,743,931 | Azure function can't create a local folder (python) | <p>I'm using Azure functions and I want to make a local folder, where I can put a file and copy it to a blob storage.</p>
<p>I'm following this tutorial: <a href="https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python?tabs=managed-identity%2Croles-azure-portal%2Csign-in-azure-cli#upload-b... | <python><azure-functions> | 2023-10-04 19:43:43 | 1 | 312 | user2743931 |
77,232,399 | 1,451,632 | can I control setuptools imports more finely? | <p>I'm having some difficulty controlling precisely which modules of my package are being imported by <code>setuptools</code>. It seems to be importing "greedily" and I don't know why.</p>
<p>Let's say I have the following (flat) code structure:</p>
<pre><code>tstpkg/
pyproject.toml
tstpkg/
__init__.p... | <python><python-import><setuptools> | 2023-10-04 19:20:05 | 0 | 311 | user1451632 |
77,232,242 | 12,282,834 | How to pass output variables of CodePipeline Lambda Action to CodeBuild action | <p>I'm trying to build a simple CICD Pipeline usind CDK python library. I have the code for creating a construct which consists of the following:</p>
<ol>
<li>A Lambda Function to be used inside a codepipeline action. Main purpose of this lambda function is to get the output values for a cloudformation stack that is in... | <python><amazon-web-services><aws-cdk> | 2023-10-04 18:47:30 | 1 | 523 | Francisco Parrilla |
77,232,241 | 3,171,007 | Use Pandas to concat csv's into another folder | <p>A coworker wrote this to combine csv files that are batch downloads of a DB table:</p>
<pre><code>import os
import pandas as pd
folder_path = r'C:\_batches'
files = [os.path.join(folder_path, file) for file in os.listdir(folder_path)]
df = pd.concat([pd.read_csv(os.path.join(folder_path, file)) for file in files])
... | <python><pandas> | 2023-10-04 18:47:22 | 1 | 1,744 | n8. |
77,232,035 | 6,003,620 | Accessing path variable in fastapi | <p>I have fastapi endpoint</p>
<pre><code>@app.post("/{ap_name}/{branch_name}")
</code></pre>
<p>Here branch is github repo branch name , that I need to capture
If user gives one word branch name then its fine,
if user gives branchname with slashes , like ap_name/<strong>ap/rt</strong>
Then it errors out.
Is ... | <python><rest><fastapi> | 2023-10-04 18:11:53 | 1 | 1,155 | niranjan pb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.