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,653,011 | 12,304,000 | send 50k post requests within a minute | <p>I want to load-test a system so I want to send around 50k POST requests within a minute. I want to do this for around 4 hours consecutively. The URL and payload is always the same. I just need to play around with the number of requests.</p>
<p>This is what I tried:</p>
<pre><code>import requests
import concurrent.fu... | <python><python-3.x><multithreading><http><concurrency> | 2023-12-13 10:58:36 | 0 | 3,522 | x89 |
77,652,773 | 1,342,516 | Matching elements in two equal-sized lists so that the pairs of elements have similar values | <p>For lists</p>
<pre><code>l1 = [2.5, 1.1, 3.6]
l2 = [3.4, 1.0, 2.2]
</code></pre>
<p>how to sort l2 efficiently to</p>
<pre><code>l2_sorted = [2.2, 1.0, 3.4]
</code></pre>
<p>so that Sum_i(l2_sorted[i] - l1[i])^2 is minimum?</p>
<p>There is a context for this question: the three complex roots, root_A, root_B, and ro... | <python> | 2023-12-13 10:24:51 | 1 | 539 | user1342516 |
77,652,505 | 5,731,101 | class inheritance in python as fields - side effects / incorrect handling | <p>Take the following simplified class structure which is used to clean and structure data from a legacy system.</p>
<ul>
<li>ProductModels contain fields</li>
<li>Fields are their own classes and types on which a bunch of cleaning is done.</li>
</ul>
<p>Overall the approach works like a charm in our use-case. But ther... | <python><python-3.x><class><composition> | 2023-12-13 09:47:19 | 2 | 2,971 | S.D. |
77,652,464 | 11,801,298 | How to add rows with missing dates in pandas dataframe? | <p>I have dataframe with empty dates.
How can I add new rows with absent dates?</p>
<pre><code> dt_object high
0 2000-01-03 27.490000
1 2000-01-04 27.448000
2 2000-01-05 27.597000
3 2000-01-06 27.597000
4 2000-01-07 27.174000
5 2000-01-10 28.090000
6 2000-01-... | <python><pandas> | 2023-12-13 09:40:53 | 1 | 877 | Igor K. |
77,652,320 | 4,847,250 | How to fix an vtk DLL import error when compiling with Pyinstaller? | <p>I'm having this error when I compile a code that uses the vtk module with pyinstaller.
<a href="https://i.sstatic.net/oKMnY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oKMnY.png" alt="enter image description here" /></a></p>
<p>usually I add some vtk hiddenimports to fix that kind of issue</p>
<pr... | <python><import><dll><pyinstaller><vtk> | 2023-12-13 09:20:33 | 0 | 5,207 | ymmx |
77,652,217 | 143,091 | Allow optional parameter anywhere between subcommands | <p>I'm using argparse to create a tool with sub-commands. I have a flag, for example <code>-j</code> which gives the output as JSON, and want the user to be able to pass it anywhere on the command line:</p>
<pre><code>mytool courses list -j
mytool -j courses list
</code></pre>
<p>If I add the argument to my subparser, ... | <python><argparse> | 2023-12-13 09:03:03 | 3 | 10,310 | jdm |
77,652,174 | 3,701,393 | How to make the client download a static file from a custom module on clicking a button? | <p><strong>Odoo 14 Community Edition</strong></p>
<p>I have a custom module with a custom model inside it.</p>
<p>I created a custom view. It is working correctly.</p>
<p>Now that I need to add a button that let the client download a static file from the server.</p>
<p>The file should be put in the module folder, which... | <python><odoo><odoo-14> | 2023-12-13 08:55:05 | 1 | 6,768 | holydragon |
77,651,902 | 3,815,773 | How can I figure out where a Python Segmentation fault comes from? | <p>I have a somewhat complex logging program, which I used to run for months in a row without crashes or problems. But recently I am getting - about once per day - crashes of this kind:</p>
<blockquote>
<p>Segmentation fault (core dumped)</p>
</blockquote>
<p>This is the sole error output I can see. It says "core ... | <python><pyqt5><segmentation-fault> | 2023-12-13 08:04:08 | 0 | 505 | ullix |
77,651,883 | 2,238,378 | Getting/sending some information from Telegram at bot startup, after Application build() but before run_polling()? | <p>I'm a bit confused about this because Im new to python-telegram,-bot, and most examples online dont reflect the v20 changes for Updater and asyncio.</p>
<p>The relevant snippet of code is:</p>
<pre><code>def main() -> None:
persistence_object = PicklePersistence(filepath=persistent_data_file_path)
applica... | <python><telegram><python-telegram-bot> | 2023-12-13 07:59:29 | 1 | 590 | Stilez |
77,651,841 | 8,037,521 | Streamlit: buttons side-by-side in a sidebar | <p>I want to have two buttons side-by-side in the Streamlit sidebar. I search for this question and found this solution:</p>
<pre><code>col1, col2 = st.sidebar.columns(2)
with col1:
st.sidebar.button("Add")
with col2:
st.sidebar.button("Remove")
</code></pre>
<p>Unfortunately, it does absolu... | <python><streamlit> | 2023-12-13 07:51:52 | 1 | 1,277 | Valeria |
77,651,804 | 8,601,590 | Python is not able to find libraries while accessing from shiny script | <p>I have a python script which is working fine while I'm running it from terminal. The same script I'm trying to invoke from shiny application with the arguments, but the shiny-server log says <code>File "/home/linuxadmin/Desktop/ADLS_test2.py", line 9, in <module> from azure.identity import Default... | <python><r><python-3.x><shiny><shiny-server> | 2023-12-13 07:42:17 | 1 | 1,233 | msr_003 |
77,651,663 | 2,444,251 | Ffmpeg - transform mulaw 8000khz audio buffer data into valid bytes format | <p>I'm trying to read a bytes variable using ffmpeg, but the audio stream I listen to, sends me buffer data in <strong>mulaw encoded buffer</strong> like this:</p>
<p><a href="https://github.com/boblp/mulaw_buffer_data/blob/main/buffer_data" rel="nofollow noreferrer">https://github.com/boblp/mulaw_buffer_data/blob/main... | <python><ffmpeg> | 2023-12-13 07:08:41 | 2 | 592 | Bob Lozano |
77,651,471 | 16,853,253 | AWS boto3 error 'IllegalLocationConstraintException' | <p>I'm getting this error - <code>'IllegalLocationConstraintException' 'The me-central-1' location constraint is incompatible for the region specific endpoint this request was sent to'</code> issue when trying to access object using presigned-url. I have created bucket to the location <code>('me-central-1')</code> and ... | <python><amazon-web-services><amazon-s3><boto3> | 2023-12-13 06:20:32 | 1 | 387 | Sins97 |
77,651,418 | 2,052,889 | How to use xfail in pytest in parameterized fixture when pytest.param is an elemenent in a tuple? | <p>This works</p>
<pre><code>import pytest
@pytest.mark.parametrize( "expected",
[
pytest.param(42, marks=pytest.mark.xfail(reason="some bug")),
],)
def test_func(expected):
assert 123 == expected
</code></pre>
<p>output is</p>
<pre><code>test_xfail_demo_1.py::test_fu... | <python><pytest><fixtures> | 2023-12-13 06:08:17 | 0 | 4,192 | Shuman |
77,651,219 | 10,200,497 | Finding the first row that meets conditions of a mask and selecting one row after it | <p>This is my dataframe:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [100, 1123, 123, 100, 1, 0, 1],
'b': [1000, 11123, 1123, 0, 55, 0, 1],
'c': ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
}
)
</code></pre>
<p>And this is the output that I want. I want to create column <code>x... | <python><pandas> | 2023-12-13 05:07:12 | 2 | 2,679 | AmirX |
77,651,188 | 4,451,521 | Visual Studio Code: How to run a python file with arguments | <p>I usually run and debug my programs from the console. Lately I have been started to run and debug from the vs code window. However I cannot do this when the program require arguments.</p>
<p>Searching on how to do this I found <a href="https://www.youtube.com/watch?v=zSljcz54pYQ" rel="nofollow noreferrer">this video... | <python><visual-studio-code><command-line-arguments> | 2023-12-13 04:54:15 | 0 | 10,576 | KansaiRobot |
77,651,034 | 23,512,643 | R: Making a Transparent Plot | <p>I am working with the R programming language.</p>
<p>Here is a transparent wire plot made in Python (<a href="https://www.geeksforgeeks.org/3d-wireframe-plotting-in-python-using-matplotlib/" rel="nofollow noreferrer">https://www.geeksforgeeks.org/3d-wireframe-plotting-in-python-using-matplotlib/</a>):</p>
<pre><code... | <python><r> | 2023-12-13 03:57:02 | 1 | 6,799 | stats_noob |
77,649,919 | 23,002,898 | In Tkinter, how to define two checkboxes from one file in the function of a function in another file? | <p>When i select <code>Tab2</code>, i would like to select the <code>Select all</code> checkbox which should automatically select the checkboxes <code>checkbox1</code> and <code>checkbox2</code>. The "Select all" Checkbox is located in the <code>x.py</code> file, so also the checkbox list <code>all_checkbox =... | <python><python-3.x><tkinter> | 2023-12-13 02:27:35 | 1 | 307 | Nodigap |
77,649,812 | 825,227 | Issues sending params dictionary to RESTful API | <p>Getting an error when trying to pass query params within a requests get call. Using the following in python:</p>
<pre><code>import requests as re
url = 'https://api.eia.gov/v2/natural-gas/pri/fut/data/?api_key=' + API_KEY
params = {
"frequency": "daily",
"data": [
&quo... | <python><python-requests> | 2023-12-13 01:39:49 | 1 | 1,702 | Chris |
77,649,754 | 2,526,586 | PyQt/Pyside: storing individual value in QPushButtons(or QWidgets in general) | <p>Suppose I have some <code>QPushButton</code>s displayed in a <code>QListWidget</code> or <code>QTableWidget</code>. The <code>QPushButtons</code> connect to the same slot function that carries out the same action for their relative list item or table row.</p>
<p>I am not sure if I am thinking in the right direction:... | <python><pyqt><pyside><qpushbutton><slot> | 2023-12-13 00:50:18 | 0 | 1,342 | user2526586 |
77,649,610 | 9,661,990 | Do I need to explicitely call con.close() after having done con.execute in SQLite? | <p>Suppose we have this code:</p>
<pre><code>def _te(tn: str, db_id: str) -> bool:
with _connect_db(db_id) as conn:
cur = conn.cursor()
cur.execute("SELECT count(*) FROM sqlite_master WHERE type='table' AND name=?", (tn,))
return cur.fetchone()[0] == 1
def _connec... | <python><sqlite> | 2023-12-12 23:50:52 | 1 | 441 | InfiniteLoop |
77,649,601 | 2,821,077 | Combining python "in" and "==" operator has confusing behavior | <p>A buddy of mine is learning python and I saw an odd thing he did with his code:</p>
<pre><code>if ch in input[index] == test[index])
</code></pre>
<p>Obviously there's some context missing for that fragment, but interestingly, that if statement gives him his desired behavior. Similarly, the below statement prints <c... | <python><operators><operator-precedence> | 2023-12-12 23:48:22 | 1 | 389 | Christian Baker |
77,649,536 | 4,019,495 | Is there an easy way to reorder the coordinate levels in a DataArray? | <p>I have the following DataArray.</p>
<pre><code>data = xr.DataArray(
np.arange(24).reshape(2, 3, 4),
dims=['x', 'y', 'z'],
coords={
'x': ['a', 'b'],
'y': [10, 20, 30],
'z': [100, 200, 300, 400]
}
)
transposed_data = data.transpose('z', 'y', 'x')
</code></pre>
<p>When I print <c... | <python><python-xarray> | 2023-12-12 23:24:58 | 1 | 835 | extremeaxe5 |
77,649,492 | 1,458,688 | Running a Python script in Node-RED results in [Errno 2] No such file or directory | <p>I am just starting out with Node-RED and trying to run a Python script but get the error "No such file or directory". Node-Red is running in docker on my Pi4.</p>
<pre><code>python: can't open file '/home/pi/docker/nodered/data/python/bins.py': [Errno 2] No such file or directory
</code></pre>
<p>In node r... | <python><node-red> | 2023-12-12 23:06:11 | 1 | 319 | Digital Essence |
77,649,333 | 6,307,685 | Substituting entire IndexedBase objects in Sympy | <p>I have an expression for the entropy <code>h</code> written in terms of the discrete distribution <code>p</code>, which is an IndexedBase.</p>
<pre class="lang-py prettyprint-override"><code>import sympy as sym
x = sym.Idx("x")
p = sym.IndexedBase("p")
N_X = sym.Symbol("N_X", positive=... | <python><sympy><symbolic-math> | 2023-12-12 22:23:58 | 0 | 761 | soap |
77,649,233 | 1,601,580 | How to install swarms; AssertionError: Error: Could not open 'optimum/version.py' due [Errno 2] No such file or directory: 'optimum/version.py' | <p>I'm trying to install swarms but I cannot and get this error:</p>
<pre class="lang-py prettyprint-override"><code>pip install swarms
Collecting swarms
Using cached swarms-2.7.7-py3-none-any.whl.metadata (15 kB)
Collecting Pillow (from swarms)
Using cached Pillow-10.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.meta... | <python><machine-learning><deep-learning><nlp> | 2023-12-12 21:58:14 | 0 | 6,126 | Charlie Parker |
77,649,157 | 9,251,158 | How to attach files with space in filename when sending email | <p>I am developing a Python application to send email. I follow <a href="https://www.geeksforgeeks.org/send-mail-attachment-gmail-account-using-python/" rel="nofollow noreferrer">this tutorial</a> and attach with this code:</p>
<pre><code>import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.t... | <python><email><email-attachments><mime> | 2023-12-12 21:37:21 | 1 | 4,642 | ginjaemocoes |
77,649,036 | 9,072,753 | how to detect if input is stdin or not using python click? | <p>Consider the following code:</p>
<pre><code>import click
@click.command()
@click.argument("file", type=click.File())
def cli(file):
print(file)
if __name__ == "__main__":
cli()
</code></pre>
<p>Executing as:</p>
<pre><code>$ python ./cmd.py -
<_io.TextIOWrapper name='<stdin>' mo... | <python><python-3.x><python-click> | 2023-12-12 21:06:28 | 1 | 145,478 | KamilCuk |
77,649,007 | 3,084,178 | Python itertools all permutations of a list with repeated elements | <p>I'm wanting to generate all permutations of a list that contains repetitions.</p>
<p>A naive approach might be to use itertools.permutations, but permutations doesn't care about elements being repeated:</p>
<pre><code>for j in itertools.permutations([0,1,1]):
print(j)
(0, 1, 1)
(0, 1, 1)
(1, ... | <python><permutation><python-itertools> | 2023-12-12 20:59:37 | 0 | 1,014 | Dr Xorile |
77,648,923 | 2,573,075 | Can I render a graph template in flask and save to PDF? | <p>It is not very clear for me if I can save a generated chart graphics to PDF.</p>
<p>I have the following case, I have and endpoint that returns a json and i want to generate graphics and tables from that, and after than to make a PDF.</p>
<p>The source of everything (endpoint, webpage) are on the same server. I woul... | <javascript><python><html><flask><pdf> | 2023-12-12 20:36:54 | 0 | 633 | Claudiu |
77,648,683 | 401,173 | How reference a namespace at the root of my Python package? | <p>I am creating a local Python package to pip install into a series of applications.</p>
<p>I have a file in a subfolder of the package</p>
<p><code>\src\my_package\model\do_stuff_x.py</code></p>
<p>and a file at the root</p>
<p><code>\src\my_package\request_models.py</code></p>
<p>When I try to use <code>from request... | <python><pip><pyproject.toml> | 2023-12-12 19:46:40 | 1 | 3,241 | Josh Russo |
77,648,668 | 8,112,003 | setuptools dependency-management for different python versions | <p>Assume you have a giant continous integration to care about, there are tons of terabyte of docker-containers, and rebuilding containers takes more time somebody could ever pay for and whatever version you change will break all the depencies.</p>
<p>Conclusion: you have docker-containers with python x.y.z and for all... | <python><pip><setuptools><pypi> | 2023-12-12 19:44:01 | 0 | 752 | Nikolai Ehrhardt |
77,648,536 | 3,458,191 | How to create a line graph from multiple columns in streamlit and python | <p>I am trying to create python script with help of streamlit and pandas from a csv file that has weather data with the below columns:
time,temperature,pressure,humidity,lux,Oxi-kO,Red-kO,NH3-kO,P1,P2,P3</p>
<p>What I am trying to do is to be able to select:</p>
<ol>
<li>Date range</li>
<li>Data set(s), a multiple sele... | <python><pandas><numpy><plotly><streamlit> | 2023-12-12 19:17:01 | 1 | 1,187 | FotisK |
77,648,390 | 297,780 | How to create Pandas Dataframe from Google API Response Object | <p>I'm trying to get a Google Analytics Admin API response into a Pandas dataframe, and I'm having trouble parsing the results. I'm working with the <a href="https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1beta/properties.customDimensions/list" rel="nofollow noreferrer">list customDimensions me... | <python><pandas><google-api-python-client> | 2023-12-12 18:43:48 | 1 | 1,414 | Lenwood |
77,648,219 | 1,283,611 | Issue with numpy in WSL2: libgcc_s.so.1: cannot open shared object file: No such file or directory | <p>I'm trying to get a python project running that uses numpy down the line and am getting an ImportError issue. I can't seem to resolve and unfortunately I haven't found a useful answer yet, so I'm hoping for help here. This is all running in Windows WSL2 Ubuntu. Here is the latest I can do to reproduce the issue. Thi... | <python><python-3.x><numpy><gcc><windows-subsystem-for-linux> | 2023-12-12 18:07:14 | 1 | 998 | flamebaud |
77,648,138 | 8,167,752 | Looking for an efficient way to find specific subfolders in a folder | <p>I'm trying to come up with a faster/more efficient way to scan a folder and find the subfolders of interest.</p>
<p>Below is what I have. It works fine for test cases, where I'm trying to find, say, a dozen folders of interest in a folder that contains, say, a hundred or so subfolders.</p>
<p>However, it chokes in m... | <python> | 2023-12-12 17:53:05 | 1 | 477 | BobInBaltimore |
77,647,949 | 8,832,997 | Python next() function fails while __next__ works on file? | <p>I was studying <em>Mark Lutz's</em> book on python called "<em>Learning Python (5th Ed)</em>". While perusing chapter 14 on <em>Iteration and Comprehensions</em> , I faced a problem in page 423.</p>
<p>There, we have created a file object returned by <code>os.popen()</code> call. It is an iterable object (... | <python> | 2023-12-12 17:20:10 | 1 | 1,357 | Sabbir Ahmed |
77,647,923 | 1,471,980 | How do you update column value based on other column values in pandas | <p>I have this data frame:</p>
<pre><code>df
Server Port
Ser123 Ethernet3
Ser123 Ethernet4
Ser123 Ethernet12
Ser123 Ethernet567
Serabc Ethernet2
Serabc Ethernet34
Serabc Ethernet458
Serabc Ethernet5689
</code></pre>
<p>I need to create another column based on values on Port column. I need to check if... | <python><pandas><regex> | 2023-12-12 17:14:26 | 1 | 10,714 | user1471980 |
77,647,740 | 1,422,096 | Copy a Numpy array to clipboard on Windows without win32 dependency? | <p>The main answer from <a href="https://stackoverflow.com/questions/22488566/how-to-paste-a-numpy-array-to-excel">How to paste a Numpy array to Excel</a> works to copy a Numpy array in the clipboard, ready to be pasted in Excel:</p>
<pre><code>import numpy as np
import win32clipboard as clipboard
def toClipboardForExc... | <python><windows><numpy><ctypes><clipboard> | 2023-12-12 16:45:21 | 2 | 47,388 | Basj |
77,647,692 | 4,537,160 | Pytorch I3D Resnet model on a custom dataset | <p>This is a follow-up to a couple of questions I asked before...I want to fine-tune the I3D model for action recognition from Pytorch hub (which is pre-trained on Kinetics 400 classes) on a custom dataset, where I have 4 possible output classes.</p>
<p>I'm loading the model and modifying the last layer by:</p>
<pre><c... | <python><pytorch><resnet> | 2023-12-12 16:36:18 | 1 | 1,630 | Carlo |
77,647,564 | 7,563,454 | Copy class instance, inheriting changes from old instance but allowing new changes without modifying it | <p>I'm looking for a way to clone a class instance, such that the new instance contains any variables changed at the time of copying but other changes can be done to it without retroactively modifying the instance it was copied from. I need to copy <code>y</code> from <code>x</code> instead of spawning a new <code>Item... | <python><python-3.x> | 2023-12-12 16:15:59 | 1 | 1,161 | MirceaKitsune |
77,647,453 | 4,588,188 | Alias field to existing key in Pydantic | <p>I am working with a legacy API and need to alias a response field to something that has an existing key. For example, the API response looks like this:</p>
<pre><code>[
{
"model_name": "Survey",
"logo": {
"url": "foo"
},
... | <python><pydantic> | 2023-12-12 16:00:56 | 1 | 618 | AJwr |
77,647,370 | 11,801,298 | Make numbers less than 360 in pandas column | <p>This is my function</p>
<pre><code>def price_to_ephe(data):
converted = []
for i in data:
while i >= 360:
i = i - 360
converted.append (i)
return converted
</code></pre>
<p>it makes every number less than 360. I want to apply it to column in dataframe.</p>
<pre><code>2009-0... | <python><pandas> | 2023-12-12 15:48:39 | 2 | 877 | Igor K. |
77,647,255 | 11,267,783 | White space using GridSpec and right colorbar with Matplotlib | <p>I would like to make a figure with 2 subplots.</p>
<p><a href="https://i.sstatic.net/UogI5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UogI5.png" alt="enter image description here" /></a></p>
<p>The problem is that on the right of the first figure, there is a whitespace (which belongs to the subpl... | <python><matplotlib> | 2023-12-12 15:31:43 | 1 | 322 | Mo0nKizz |
77,647,079 | 4,726,173 | What's wrong with my subclass of pytorch's DataLoader? - Error: Too many open files | <p>What is wrong with my subclass of <code>torch.utils.data.DataLoader</code>? After using this instead of the original, I get an error. The error is solved by setting <code>pin_memory</code> (in the superclass) to <code>False</code>.</p>
<p>This is the class (the actual class has a few more parameters which are all no... | <python><pytorch><pytorch-dataloader> | 2023-12-12 15:05:53 | 1 | 627 | dasWesen |
77,647,014 | 1,914,781 | bucket time duration dataframe with pandas | <p>I would like to bucket a datetime duration dataframe with pandas.
example:</p>
<pre><code>import pandas as pd
import itertools
import numpy as np
df = pd.DataFrame({
'ts': [1, 5, 10, 12],
'dur': [1, 2, 6, 6],
})
print(df)
ts dur
0 1 1
1 5 2
2 10 6
3 12 6
</code></pre>
<p>I n... | <python><pandas> | 2023-12-12 14:57:03 | 1 | 9,011 | lucky1928 |
77,646,970 | 2,328,066 | How can I pytest+monkeypatch a callable class to reusably specify the return of __call__? | <p>I am trying to write tests for classes that use Langchain's <code>LLMChain</code> class under the covers. The <code>LLMChain</code> class is callable.</p>
<pre class="lang-py prettyprint-override"><code>class MockLLMChain:
"""
Mock LLMChain class for testing
Example usage in a test:
... | <python><mocking><pytest> | 2023-12-12 14:48:48 | 1 | 901 | Erik Jacobs |
77,646,956 | 12,596,824 | Using llama index but avoiding the tiktoken API call | <p>I want to use <code>llama_index</code> but when I import the package I get the following error</p>
<pre><code>ConnectionError: ('Connected aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
</code></pre>
<p>This is because <code>llama_index</co... | <python><nlp><large-language-model><llama-index><retrieval-augmented-generation> | 2023-12-12 14:46:47 | 0 | 1,937 | Eisen |
77,646,924 | 12,390,973 | How to add time limit to gurobi solver in Pypsa model? | <p>I have create a model using Pypsa and I am using gurobi solver to solve it. I am testing the time limit parameter of Gurobi. Here is how I am adding it to the model :</p>
<pre><code>solverOptions = {
'LogFile': "gurobiLog",
'MIPGap': model_inputs['model_data']['solverMipGap'], # 0.001
... | <python><gurobi><pypsa> | 2023-12-12 14:41:42 | 1 | 845 | Vesper |
77,646,884 | 5,401,672 | How to invalidate a Cloudfront distribution using the AWS Python CDK? | <p>We have a static site which is hosted in S3 and I'm trying to create a stack which will automate uploading the files and invalidate the Cloudfront distribution.</p>
<p>I can upload the files but can't see any way to create the invalidation.</p>
<p>I can get the distribution like this:</p>
<pre class="lang-py prettyp... | <python><amazon-cloudfront><aws-cdk> | 2023-12-12 14:36:16 | 2 | 1,601 | Mick |
77,646,789 | 747,228 | How to have the dialog box for choosing download location appeared in the frontend, before the file gets downloaded, using FastAPI? | <p>I have a <code>GET</code> endpoint that should return a <strong>huge file</strong> (500Mb).
I am using <code>FileResponse</code> to do that (the code is simplified for clarity reasons):</p>
<pre><code> async def get_file()
headers = {"Content-Disposition": f"attachment; filename={filename}"... | <javascript><python><html><download><fastapi> | 2023-12-12 14:20:31 | 1 | 2,028 | unresolved_external |
77,646,624 | 9,284,651 | Data Frame- remove special character | <p>My DF looks like below:</p>
<pre><code>id date
1 ' : 07/01/2020 23:25'
2 ': 07/02/2020'
3 ' 07/03/2020 23:25 1'
4 '07/04/2020'
5 '23:50 07/05/2020'
6 '07 06 2023'
7 '00:00 07 07 2023'
</code></pre>
<p>I need to remove all special characters and numbers that are between ':' so DF should looks like below</p>
<... | <python><pandas><dataframe><replace><data-cleaning> | 2023-12-12 13:53:21 | 1 | 403 | Tmiskiewicz |
77,646,583 | 10,595,871 | Pandas shift dataframe if date is found in string column | <p>I have a pandas dataframe that should have 7 columns. It has 9 columns instead, that's because some rows are shifted to the right to one or two columns.</p>
<p>I need to make some order in my df. I have this elements:</p>
<ul>
<li>the first two columns are always fine, but the second one could be null (that is also ... | <python><pandas> | 2023-12-12 13:46:45 | 0 | 691 | Federicofkt |
77,646,470 | 4,537,160 | Pytorch dataloader, returned shape of targets | <p>I'm running a Pytorch model training, where I defined the <strong>getitem</strong> method of the dataset to return:</p>
<pre><code>def __getitem__(self, ind):
[...]
return processed_images, target
</code></pre>
<p>processed_images is a sequence of 5 RGB images with shape (224,224), while target is a 4-dim v... | <python><pytorch><pytorch-dataloader> | 2023-12-12 13:27:38 | 1 | 1,630 | Carlo |
77,646,466 | 13,178,529 | Function that returns pointer, when imported in separate file, return number instead of object | <p>I have a file called, runner.py, which has a lot of functions that make calls to a market DLL.</p>
<pre><code>#Imports para execução da DLL
import time
import gc
from ctypes import *
from ctypes.wintypes import UINT
import struct
from datetime import*
import sys
import functions
from threading import Thread
rotPass... | <python><python-3.x><pointers> | 2023-12-12 13:26:45 | 1 | 1,200 | Nilton Schumacher F |
77,646,455 | 1,075,996 | PyMySQL TypeError when connecting | <p>I'm working with the following (very simple) MariaDB connection:</p>
<pre><code>>>> from dbconfig import db_host, db_user, db_pass, db_name, system_number
>>> import pymysql as mdb
>>> print(db_host, db_user, db_pass, db_name)
some.server.co.uk my_username my_password my_db_name
>>&g... | <python><mysql><mariadb><pymysql> | 2023-12-12 13:25:08 | 1 | 453 | btongeorge |
77,646,431 | 6,372,189 | Why is shutil.rmtree takes hours to delete a folder sometimes? Any alternatives? | <p>It seems like a trivial issue but I've noticed lately that the <code>shutil.rmtree</code> function is either taking a ridiculously long time (like 6 hours) or is simply blocking the execution of the remaining script.</p>
<p>I have a script that does a bunch of operations but before starting everything else, it delet... | <python><python-3.x><shutil> | 2023-12-12 13:20:44 | 0 | 701 | Prashant Kumar |
77,646,352 | 14,695,308 | Test-dependent teardown fixture | <p>I'm using teardown fixtures as follow</p>
<pre><code>@pytest.fixture
def clean_after_test()
yield
function_to_clean()
def test_object(clean_after_test)
<TESTING CODE>
</code></pre>
<p>But in specific test-case I need to create object, do something with it and after testing done remove it by ... | <python><pytest> | 2023-12-12 13:10:05 | 0 | 720 | DonnyFlaw |
77,646,307 | 6,836,950 | Correlation matrix like DataFrame in Polars | <p>I have Polars dataframe</p>
<pre class="lang-py prettyprint-override"><code>data = {
"col1": ["a", "b", "c", "d"],
"col2": [[-0.06066, 0.072485, 0.548874, 0.158507],
[-0.536674, 0.10478, 0.926022, -0.083722],
[-0.21311, -0.... | <python><python-polars> | 2023-12-12 13:02:00 | 3 | 4,179 | Okroshiashvili |
77,646,165 | 235,472 | How to get the current directory from the whole path? | <p>With:</p>
<pre><code>currentPath = pathlib.Path.cwd()
</code></pre>
<p>I get the current path:</p>
<pre><code>/path/to/my/location/
</code></pre>
<p>How can I get the directory <code>location</code> without the need to manually process the complete path?</p>
| <python><python-3.x> | 2023-12-12 12:36:41 | 2 | 13,528 | Pietro |
77,645,765 | 12,571,870 | Custom Python module not found when placed in Docker container (with setup.py and entry_points, console_scripts) | <p>I have the following structure of my project:</p>
<pre><code>|--Dockerfile
|--requirements.txt
|--setup.py
|--mydummyproject
|--|--__init__.py
|--|--__main__.py
|--|--dummy.py
</code></pre>
<p>The <code>dummy.py</code> has one simple function:</p>
<pre><code>import numpy as np
def return_output(*args):
for a in ... | <python><docker> | 2023-12-12 11:33:33 | 1 | 438 | ivan199415 |
77,645,742 | 6,060,982 | pyright and imports from shared libraries | <p>Can pyright or any other linter resolve imports from <code>.so</code> libraries?
In my case I have a c++ shared library with pybind11 used to generate the python bindings.
I can successfully import and use the <code>FourierSeries</code> from the <code>.so</code> library</p>
<pre class="lang-py prettyprint-override">... | <python><pybind11><pyright> | 2023-12-12 11:29:56 | 0 | 700 | zap |
77,645,552 | 5,973,911 | Is it possible to reformat python __all__ statement with ruff to make it multiline? | <p>I'm using <code>ruff</code> (<a href="https://docs.astral.sh/ruff/" rel="nofollow noreferrer">https://docs.astral.sh/ruff/</a>). Is it possible to format the code from this:</p>
<pre><code>__all__ = ["Model", "User", "Account"]
</code></pre>
<p>Into this?</p>
<pre><code>__all__ = [
... | <python><ruff> | 2023-12-12 11:00:05 | 1 | 853 | Михаил Павлов |
77,645,520 | 6,759,459 | Dockerized FastAPI SQLAlchemy PostgreSQL 'NoneType' object has no attribute 'execute' | <p>This is a sudden error, whose root cause I haven't been able to figure out.
I successfully built 2 Docker images that are connected over the same network:</p>
<ol>
<li>FastAPI</li>
<li>PostgreSQL</li>
</ol>
<p>I am not able to use the SQLAlchemy dependency injection to connect to my DB.
However, I was able to seed m... | <python><postgresql><docker><sqlalchemy><fastapi> | 2023-12-12 10:56:18 | 1 | 926 | Ari |
77,645,510 | 16,674,436 | Simple seaborn distribution plot not working | <p>I’m trying to plot the distribution of scores on reddit posts, but can’t figure it out.</p>
<p>My data frame is something like that</p>
<pre><code>df = pd.DataFrame({"score": [12, 19, 25987, 887, 887, 1],
"author": ["xxx", "x", "xxx", "xx"... | <python><plot><statistics><seaborn><distribution> | 2023-12-12 10:55:25 | 1 | 341 | Louis |
77,645,454 | 4,752,738 | PyCharm removes unused imports when moving a file | <p>I'm using Pycharm for moving files inside my project and PyCharm updates the imports in the project to the new path which is great.</p>
<p>The problem is that it also <em>removes unused imports</em> from those files. This is a very bad behavior for me and I can't find a way to stop this.</p>
<p>I can't check whether... | <python><pycharm> | 2023-12-12 10:45:59 | 2 | 943 | idan ahal |
77,645,290 | 9,488,023 | How can I choose to not change the image size when reprojecting with Python rioxarray? | <p>I have an image in tif-format of size 18346x10218 in coordinate system EPSG:4326 that I want to convert to a new coordinate system, which I do with the following method with rioxarray in Python.</p>
<pre><code>import rioxarray
rast_path = "old_projection.tif"
rds = rioxarray.open_rasterio(rast_path)
rds_... | <python><raster><python-xarray><projection><epsg> | 2023-12-12 10:21:43 | 1 | 423 | Marcus K. |
77,645,267 | 8,580,469 | pcolormesh: artefacts / overlapping points when using ec='face' | <p>I am plotting maps with pcolormesh and cartopy. When I don't use the option <code>edgecolor</code> or set it to None, results are like expected. But when I use <code>ec='face'</code>, I get really strange artefacts and/or overlapping points - depending on the selected output format.
I have tried with <code>snap</cod... | <python><matplotlib><cartopy> | 2023-12-12 10:17:43 | 1 | 377 | Waterkant |
77,645,115 | 1,897,839 | Bokeh legend breaks on Python callback | <p>I have implemented a Bokeh figure with</p>
<ol>
<li>a scatter plot using <code>circle()</code> with a <code>legend_group</code> for colouring and for creating an interactive legend.</li>
<li>a range slider with a Python callback that filters the data</li>
</ol>
<p>I have set <code>click_policy=hide</code> for the le... | <python><slider><filtering><legend><bokeh> | 2023-12-12 09:53:46 | 1 | 2,092 | Carsten |
77,645,110 | 1,799,528 | Iterate on langchain document items | <p>I loaded pdf files from a directory and I need to split them to smaller chunks to make a summary. The problem is that I can't iterate on documents object in a for loop and I get an error like this: <strong>AttributeError: 'tuple' object has no attribute 'page_content'</strong></p>
<p>How can I iterate on my document... | <python><openai-api><langchain> | 2023-12-12 09:53:10 | 3 | 1,376 | gabi |
77,645,015 | 4,537,160 | Fine-tune Pytorch I3D model on a custom dataset | <p>I want to fine-tune the I3D model from torch hub, which is pre-trained on Kinetics 400 classes, on a custom dataset, where I have 4 possible output classes.</p>
<p>I'm loading the model by:</p>
<pre><code>model = torch.hub.load("facebookresearch/pytorchvideo", i3d_r50, pretrained=True)
</code></pre>
<p>I p... | <python><pytorch> | 2023-12-12 09:39:49 | 1 | 1,630 | Carlo |
77,644,943 | 11,942,776 | asynch.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server <host:port> (expected Hello or Exception, got Unknown packet) | <p>I'm trying to connect to clickhouse with sqlalchemy. I'm using:</p>
<ul>
<li>python3.11</li>
<li>clickhouse-driver == 0.2.6</li>
<li>sqlalchemy == 2.0.23</li>
<li>clickhouse-sqlalchemy == 0.3.0</li>
<li>asynch == 0.2.3</li>
<li>asyncio == 3.4.3</li>
</ul>
<p>Here is my script I used:</p>
<pre class="lang-py prettypr... | <python><sqlalchemy><python-asyncio><clickhouse> | 2023-12-12 09:28:53 | 1 | 331 | Nguyễn Đức Huy |
77,644,803 | 936,269 | h5py: how save a scalar attribute as array with shape=(1,) | <p>I have some data that I need to write into an HDF5 file which will be read by a data processing application.
This I do with <a href="https://www.h5py.org/" rel="nofollow noreferrer">h5py</a>.
However, the data processing application seems to only accept attributes with an array size of one, but when I create my attr... | <python><h5py> | 2023-12-12 09:04:15 | 1 | 2,208 | Lars Kakavandi-Nielsen |
77,644,752 | 6,215,597 | How to improve training performance of model.fit() with generators? | <p>Normally when I train models with tensorflow, I just feed my entire data set to the model training (Scenario 1). However, from time to time this data set is to large to fit into my GPU. For that reason I wanted to use generators and just load batch after batch into the GPU (Scenario 2). Both scenarios run perfectly ... | <python><tensorflow><generator><tf.keras> | 2023-12-12 08:55:18 | 0 | 433 | Max2603 |
77,644,650 | 1,487,336 | How to change pandas MultiIndex name? | <p>I would like to change the pandas multi-index name as follows and encountered this strange issue. Is this a bug? My pandas version is 1.5.3.</p>
<p><a href="https://i.sstatic.net/J19Wf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/J19Wf.png" alt="enter image description here" /></a></p>
| <python><pandas><dataframe> | 2023-12-12 08:35:51 | 0 | 809 | Lei Hao |
77,644,631 | 17,347,824 | Connecting Alpaca to Python in AWS | <p>I am creating a program to simulate stock trading with an Alpaca paper trade account but I'm not able to get my program to work with Alpaca.</p>
<p>I have installed the module the documentation says to install using <code>pip3 install alpaca_py</code> it says it is successful, but then when I try to import it and us... | <python><alpaca> | 2023-12-12 08:31:37 | 2 | 409 | data_life |
77,644,599 | 18,125,313 | Why does adding a break statement significantly slow down the Numba function? | <p>I have the following Numba function:</p>
<pre class="lang-py prettyprint-override"><code>@numba.njit
def count_in_range(arr, min_value, max_value):
count = 0
for a in arr:
if min_value < a < max_value:
count += 1
return count
</code></pre>
<p>It counts how many values are in the... | <python><performance><numba> | 2023-12-12 08:24:15 | 1 | 3,446 | ken |
77,644,510 | 8,963,682 | FastAPI with Azure AD: TypeError on OAuth2 Authentication | <p>I'm trying to implement Azure AD OAuth2 authentication in a FastAPI application. I have set up the environment variables correctly and configured the OAuth client with Azure AD's endpoints. However, I'm encountering a TypeError: Invalid type for url. Expected str or httpx.URL, got <class 'NoneType'>: None when... | <python><azure><oauth-2.0><oauth><fastapi> | 2023-12-12 08:06:34 | 1 | 617 | NoNam4 |
77,644,469 | 4,451,521 | Counting the inequalities in a dataframe column | <p>I have two dataframes that are basically the same.</p>
<p>However in a particular column there are some rows where the values (floats) are different.</p>
<p>I would like to calculate the number of rows where the values are different.</p>
<p>This task seem pretty simple if not for the fact of the following two things... | <python><pandas> | 2023-12-12 07:59:44 | 2 | 10,576 | KansaiRobot |
77,644,424 | 2,859,206 | SQL code works in Azure, but Sqlalchemy throws ProgrammingErrors: Invalid column name OR multi-part identifier could not be bound | <p>I'm trying to run an sql query that works as native sql code in a program like Azure, but throws programming errors when I try to use the exact code in python using SQLAlchemy with ODBC and pandas.</p>
<p>SQL code:</p>
<pre><code>Select RecordNumbers -- ID des Falles
... | <python><sql><sql-server><sqlalchemy> | 2023-12-12 07:50:32 | 1 | 2,490 | DrWhat |
77,644,270 | 17,721,722 | Creating Django Models Without Rounding off Decimal Fields | <p>For now, when I save an amount like 5400.5789, it is being saved as 5400.58. However, I want it to be saved as 5400.57 only. I don't want to round off the decimal places. How can I achieve that?</p>
<pre><code>class PerTransaction(models.Model):
amount = models.DecimalField(default=0, max_digits=10,decimal_place... | <python><django><postgresql><django-models> | 2023-12-12 07:16:21 | 1 | 501 | Purushottam Nawale |
77,644,117 | 12,780,274 | Decode protobuf without proto files in python | <p>I would like to decode protobuf.</p>
<p>Example of the protobuf data: <code>0a06282c0241057a10011805220d080510bea3f493062a03010c1628f1a6f493063002382b4001481482010f383634333233303532343736343839</code></p>
<p>I can Decoding online (e.g. via <a href="https://protobuf-decoder.netlify.app/" rel="nofollow noreferrer">ht... | <python><protocol-buffers><protobuf.js><protobuf-python> | 2023-12-12 06:42:10 | 1 | 643 | henrry |
77,644,026 | 11,082,866 | Django middleware is executed at every API call | <p>I created a middleware to record the activity log for user login but it executes at every API call. The <code>ActivityLog</code> is to record the entries.</p>
<p>Middleware.py</p>
<pre><code>class UserActivityMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__... | <python><django> | 2023-12-12 06:13:16 | 0 | 2,506 | Rahul Sharma |
77,643,953 | 4,620,616 | PySimpleGUI appends Plots in Canvas | <p>I have the issue that if I try to update a canvas in PySimpleGUI the application instead appends the new plot below the old one. Trigering the 'Generate Plot' from the code below leads to the output at the bottom. Instead of Appending the plot I expected it to replace it.</p>
<pre><code>import PySimpleGUI as sg
impo... | <python><matplotlib><tkinter><pysimplegui> | 2023-12-12 05:55:35 | 3 | 490 | mhwh |
77,643,828 | 10,964,685 | Insert word at beginning of row - python | <p>I want to insert a word at the beginning of a string for each row in a column where the first word is not <em>x</em>. If it is <em>x</em>, then move on. For below, <em>x</em> = <code>BP</code>. So if first word in cat is not <code>BP</code>, then insert it.</p>
<pre><code>df = pd.DataFrame({
'cat': ['BP STATION'... | <python> | 2023-12-12 05:17:10 | 2 | 392 | jonboy |
77,643,527 | 20,803,947 | Docker-compose: ModuleNotFoundError: No module named 'src' | <p>I have a problem trying to run my flask, python, celery, mongodb and rabbitmq app via docker.</p>
<p>When I run the docker build command and then compose-up
I get the following problem:</p>
<p><a href="https://i.sstatic.net/15kLr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/15kLr.png" alt="enter im... | <python><docker><docker-compose><dockerfile> | 2023-12-12 03:25:29 | 1 | 309 | Louis |
77,643,512 | 10,964,685 | Split column by last delimiter AND uppercase values - python | <p>I'm trying to split a column by the last <code>' - '</code> <strong>AND</strong> being followed by all uppercase strings letters.</p>
<p><strong>It may not necessarily be the last delimiter in isolation. But it will be the last before all uppercase strings</strong>.</p>
<p>I can find separate questions that separate... | <python><pandas><split> | 2023-12-12 03:17:03 | 1 | 392 | jonboy |
77,643,373 | 188,740 | Attach debugger to Firebase Python Functions | <p>I'm using the emulator to run cloud functions with Python. I'd like to attach a debugger using VS Code. This is easy when using Node, I just need to pass the <code>--inspect-functions</code> flag in when starting the emulator:</p>
<pre><code>firebase emulators:start --project demo-project --inspect-functions
</code>... | <python><google-cloud-functions><vscode-debugger><firebase-tools> | 2023-12-12 02:34:22 | 0 | 57,942 | Johnny Oshika |
77,643,232 | 6,533,037 | Output 256-bit using Argon2 hasher | <p>I am trying to generate a 256-bit output using Argon2 password hasher. The function take s a <code>hash_len</code> parameter which I set to 32. Thinking that 32 bytes equals 256 bits.</p>
<p>Why does Argon2 output the length of 43, and not 32?</p>
<pre><code>from argon2 import PasswordHasher
password = "abc123... | <python><argon2-cffi> | 2023-12-12 01:33:34 | 1 | 1,683 | O'Niel |
77,643,184 | 10,266,059 | Why does pydoc say "any" is a package? I thought any() was a function | <p>I am learning Python and I thought I would try using pydoc to give me a description of each built-in function. But when I run <code>pydoc any</code>, it returns:</p>
<pre class="lang-none prettyprint-override"><code>Help on package any:
NAME
any
PACKAGE CONTENTS
FILE
(built-in)
</code></pre>
<p>However,... | <python> | 2023-12-12 01:12:06 | 1 | 1,676 | Aleksey Tsalolikhin |
77,643,183 | 10,200,497 | groupby streak of numbers and one row after it then check the first value of a column for each group | <p>This is an extension to this <a href="https://stackoverflow.com/questions/77372530/groupby-streak-of-numbers-and-one-row-after-it">post</a>.</p>
<p>This is my dataframe:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [ 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0],
'b': [-1, 1, 1... | <python><pandas> | 2023-12-12 01:11:37 | 2 | 2,679 | AmirX |
77,643,130 | 10,964,685 | Split col by any delimiter and Uppercase values | <p>I'm trying to split a column by the last <code>' - '</code> that is followed by all uppercase strings letters.</p>
<p>Below, I have a df with <code>Value</code> containing various combinations. I want to split the col into two individuals columns, whereby, everything before the last <code>' - '</code> and uppercase ... | <python><pandas><split> | 2023-12-12 00:57:17 | 2 | 392 | jonboy |
77,643,104 | 232,798 | AWS Lambda, Snowflake connector and "module 'cryptography.hazmat.bindings._rust.openssl' has no attribute 'hashes'" | <p>I am creating a layer for the snowflake connector.
I downloaded amazon linux image, installed the snowflake connector in the image:
<code>pip install snowflake-connector-python</code>;</p>
<p>after that I uploaded the layer and lambda through SAM installation.
Lambda is still giving me this issue though</p>
<pre><co... | <python><aws-lambda><snowflake-cloud-data-platform> | 2023-12-12 00:44:46 | 0 | 10,613 | Danail |
77,643,086 | 11,124,121 | How to solve the error:ufunc 'isfinite' not supported for the input types in the sm.models? | <p>I tried to follow the code in this link:
<a href="https://jbhender.github.io/Stats506/F17/Projects/Poisson_Regression.html" rel="nofollow noreferrer">https://jbhender.github.io/Stats506/F17/Projects/Poisson_Regression.html</a></p>
<p>But the error message popped up:</p>
<pre><code>TypeError: ufunc 'isfinite' not sup... | <python><pandas><numpy> | 2023-12-12 00:36:05 | 0 | 853 | doraemon |
77,642,881 | 9,263,783 | Python 3.11 Typing for multiple inheritance models | <p>I want to implement typing for a group of related classes that share a common metaclass (<code>AMeta</code>), there are two 'de facto' abstract parent classes:</p>
<ul>
<li><code>A</code> (:type[AMeta])</li>
<li><code>ADerived</code> - that also inherits from another class <code>C</code>.</li>
</ul>
<p>Finally there... | <python><mypy><typing> | 2023-12-11 23:23:50 | 1 | 341 | Bravhek |
77,642,836 | 4,398,966 | Simplify .format printing in Python | <p>I'm trying to print out the following:</p>
<pre><code>-----------------------------
| | |
| | P |
| | Y |
| | T |
| PYTHON! | H |
| | O |
| | N |
| | ! ... | <python><python-3.x><for-loop><format> | 2023-12-11 23:07:15 | 3 | 15,782 | DCR |
77,642,795 | 13,135,901 | Pandas change values in pandas dataframe based on a slice with selected indexes and shift() | <p>Let's say I have a dataframe <code>df</code>. First I filter it, then I need to find all rows that satisfy a criteria and then mark all these rows plus 2 previous rows for each in a specific bool column in the original dataframe:</p>
<pre><code>df = pd.DataFrame({{'A': {0: nan, 1: nan, 2: 1944.09, 3: nan, 4: nan, 5:... | <python><pandas><dataframe> | 2023-12-11 22:55:13 | 1 | 491 | Viktor |
77,642,777 | 329,365 | inconsistent "Invalid JSON from piped input" error from python/powershell | <p>I have a Jenkins instance running on a windows server. There is a specific job that runs a python script and part of that python script is calling powershell:</p>
<pre><code>generate_password = f"""Invoke-Expression $('{PASSWORD}' | op signin --account {ACCOUNT} )
op item create --vault shared title=... | <python><powershell><jenkins> | 2023-12-11 22:50:06 | 0 | 3,447 | danspants |
77,642,702 | 3,361,462 | How does iterated application of the `+=` operator to a string variable manage to avoid quadratic complexity? | <p>I am kinda confused. I was sure that due do immutability of <code>str</code> operation like <code>s += "abc"</code> need to copy whole <code>s</code> content to another place in memory so effectively adding character to very long string will consume much time.</p>
<p>I wrote snippet to prove my theory:</p>... | <python><string><string-concatenation><cpython> | 2023-12-11 22:28:47 | 1 | 7,278 | kosciej16 |
77,642,635 | 7,563,454 | Convert list index to a 3D position based on width and height | <p>I'm working on a CPU voxel raytracer in Python. With the amount of costly calculations involved everything must be as efficient as possible especially storing and fetching point data in space. I started by storing 2D and 3D data in dictionaries indexed by string positions, eg: <code>data["4,16"] == "s... | <python><python-3.x><math><vector><3d> | 2023-12-11 22:06:11 | 1 | 1,161 | MirceaKitsune |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.