QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 โ |
|---|---|---|---|---|---|---|---|---|
79,565,542 | 58,347 | Using typing.assert_never() with abstract base classes to ensure full coverage | <p>I have an abstract base class <code>ParserNode</code>, with a bunch of concrete subclasses (<code>StartTag</code>, <code>RawText</code>, etc).</p>
<p>I have a function that takes a ParserNode and does different things based on which subtype it is. I'd like to ensure that mypy will complain if I ever add a new <code>... | <python><python-typing><mypy> | 2025-04-10 00:30:31 | 1 | 18,453 | Tab Atkins-Bittner |
79,565,521 | 8,284,452 | What is the data_vars argument of xarray.open_mfdataset doing? | <p>I have two datasets with identical dimension names and shapes and I am trying to use <code>xarray.open_mfdataset()</code> to merge them into one dataset before opening them. You can drop this code in your own IDE if you want to play with it:</p>
<pre class="lang-py prettyprint-override"><code>import xarray as xr
imp... | <python><python-xarray><netcdf> | 2025-04-10 00:09:21 | 0 | 686 | MKF |
79,565,427 | 1,267,780 | Pydantic CLIApp/CLISubCommand with Env Vars | <p>I am currently building a CLI using <a href="https://docs.pydantic.dev/latest/concepts/pydantic_settings/" rel="nofollow noreferrer">Pydantic</a>. One of the sub commands has 2 parameters I would like to load via an Env variable. I was able to load the environment variables on its own when I instantiated the class d... | <python><pydantic><pydantic-settings> | 2025-04-09 22:30:14 | 1 | 3,695 | CodyK |
79,565,407 | 2,289,986 | How to read 10-K XBRL file using python? | <p>What I tried: I could save a 10-K XBRL file in text format and read line by line to extract various sections.</p>
<p>Requirement: I want to separate text from tables from 10-K.</p>
<p>Problem: For this I need to use the html and it has complex structure. And extracting text and tables seems complex with beautifulsou... | <python><xbrl> | 2025-04-09 22:10:08 | 2 | 524 | Chandra |
79,565,269 | 5,166,365 | OpenSCAD for Mac (M1 + Rosetta 2), brew, This application failed to start because it could not find or load the Qt platform plugin "cocoa" in "" | <p>So, I downloaded openscad via <code>brew install openscad</code>, but when I run openscad CLI I get</p>
<pre><code>This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".
</code></pre>
<p>I saw some bug reports indicating that this may be a known b... | <python><macos><qt><homebrew><openscad> | 2025-04-09 20:21:39 | 1 | 1,010 | Michael Sohnen |
79,565,204 | 17,729,094 | Transpose 2d Array elements in a column | <p>I have a dataframe like:</p>
<pre><code># /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# "polars",
# ]
# ///
import numpy as np
import polars as pl
n_rows = 5
a = np.random.uniform(size=n_rows).astype(np.float32)
b = np.random.uniform(size=(n_rows,... | <python><python-polars><polars> | 2025-04-09 19:31:12 | 2 | 954 | DJDuque |
79,565,121 | 4,606,149 | TensorFlow `next()` hangs in infinite loop after `take(1)` | <p>When using TensorFlow's <code>tf.data.Dataset.take(1)</code> to get the first element of a dataset and then attempting to retrieve this element using <code>iter()</code> and <code>next()</code>, the <code>next()</code> call enters an infinite loop if the <code>pandas</code> library is imported <em>before</em> <code>... | <python><pandas><tensorflow> | 2025-04-09 18:47:48 | 1 | 1,511 | J.E.K |
79,565,063 | 1,938,552 | Does pyopencl transfer arrays to host memory implicitly? | <p>I have AMD GPU. I'm using pyopencl. I have a context and a queue. Then I created an array:</p>
<pre><code>import pyopencl
import pyopencl.array
ctx = pyopencl.create_some_context(interactive=False)
queue = pyopencl.CommandQueue(ctx)
array = pyopencl.array.empty(queue, [10], dtype=float)
print(array)
</code></pre>
<p... | <python><gpu><opencl><pyopencl> | 2025-04-09 18:21:56 | 1 | 1,059 | haael |
79,564,589 | 16,383,578 | How to find all grid points that correspond to non-reduced fractions in a square? | <p>Given a positive integer N, we can label all grid points in the square N x N, starting at 1, the total number of grid points is N x N, and the grid points are <code>list(itertools.product(range(1, N + 1), repeat=2))</code>.</p>
<p>Now, I want to find all tuples <code>(x, y)</code> that satisfies the condition x/y is... | <python><algorithm><math><number-theory> | 2025-04-09 14:19:47 | 4 | 3,930 | ฮฮญฮฝฮท ฮฮฎฮนฮฝฮฟฯ |
79,564,452 | 5,168,534 | Format String based on List of Dictionaries | <p>I have string which needs to be substituted with values from a list of dictionaries.
The size of the list can vary. Based on the size of the list, the string will be repeated because accordingly the data from the list will be substituted.</p>
<p>e.g. string is like</p>
<pre><code>str_template = '''
Part 1: {}
Part 2... | <python> | 2025-04-09 13:23:41 | 2 | 311 | anshuk_pal |
79,564,236 | 2,281,751 | Can olmocr Run on Two 12 GB Titan X GPUs? | <p>Iโm trying to run olmocr (<a href="https://github.com/allenai/olmocr" rel="nofollow noreferrer">https://github.com/allenai/olmocr</a>) locally, which requires a GPU with 20 GB RAM. I have two Titan X GPUs (12 GB each). When I run it, I get:</p>
<pre><code>ERROR:olmocr.check:Torch was not able to find a GPU with at l... | <python><pytorch><gpu><ocr> | 2025-04-09 11:38:51 | 0 | 756 | Dandelion |
79,564,149 | 2,894,535 | Automatically encode/decode ctypes argument and return value | <p>I have a shared library exposing a function:</p>
<pre class="lang-c prettyprint-override"><code>const char* foo(const char* s);
</code></pre>
<p>To call it from Python using ctypes, I can do the following:</p>
<pre class="lang-py prettyprint-override"><code>import ctypes
foo = ctypes.cdll.LoadLibrary('foo.so')
foo.... | <python><dll><ctypes> | 2025-04-09 10:52:04 | 1 | 3,116 | Dominik Kaszewski |
79,563,745 | 2,148,420 | Databricks merge issue with null values | <p>I'm merging two delta tables with databricks and one struct in the target delta table isn't merged as expected.</p>
<p>On the source delta table I have data as follow:</p>
<pre class="lang-json prettyprint-override"><code>{
id: '123',
artist: {
song: {
id: null,
name: null,
country: null
... | <python><pyspark><merge><databricks> | 2025-04-09 07:48:25 | 1 | 1,758 | Yabada |
79,563,650 | 3,381,215 | ImportError: Error importing numpy: you should not try to import numpy from its source directory | <p>I'm starting a new Python project, I made the following pyproject.toml file (using poetry):</p>
<pre class="lang-ini prettyprint-override"><code>[tool.poetry]
name = "snaqs"
version = "3.0.0"
description = "A minimal rewrite of Philips' snaqs for DCDC Tx"
authors = ["Freek van Heme... | <python><numpy><python-poetry><nix> | 2025-04-09 06:51:15 | 1 | 1,199 | Freek |
79,563,224 | 12,702,027 | Python narrow class type variable in method | <p>I'm trying to emulate Rust's</p>
<pre class="lang-rs prettyprint-override"><code>impl<T> Trait for Struct<T> where T: Bound
</code></pre>
<p>(assuming <code>Struct</code> does not bound its type variable, as is <a href="https://stackoverflow.com/questions/49229332/should-trait-bounds-be-duplicated-in-str... | <python><python-typing> | 2025-04-08 23:48:48 | 1 | 386 | Jason |
79,563,158 | 9,102,437 | "User directory already in use" Selenium Python | <p>I am aware that there are other questions like this one on the site, but I have found that they are trying to do a different thing and the solution is not applicable to my case. The issue is that I want to run a few instances of chrome simultaneously which works fine right now, but I would also like to save the data... | <python><python-3.x><selenium-webdriver> | 2025-04-08 22:31:22 | 1 | 772 | user9102437 |
79,563,063 | 7,340,304 | Different number of __init__ calls for almost the same __new__ implementation | <p>My goal is to create a Factory class that will produce instances of slightly different classes based on <code>real_base</code> parameter. For simplicity I pass new base class directly, in reality base class would have been determined based on input parameter with some complex logic.
The problem is that if I use same... | <python><python-3.x><oop><init> | 2025-04-08 21:13:26 | 0 | 591 | Bohdan |
79,563,051 | 3,817,456 | What is the difference between numpy.atan and numpy.arctan? | <p>When looking for the 2-pi range version of np.atan (which turns out to be np.atan2) I found that there's a np.arctan as well - is there some difference between np.arctan and np.atan? The test below doesn't seem to show any difference between atan and arctan , or between atan2 and arctan2:</p>
<pre><code>import nump... | <python><numpy> | 2025-04-08 21:03:34 | 2 | 6,150 | jeremy_rutman |
79,562,820 | 9,715,816 | Django with a single db raises "the current database router prevents this relation" when intializing model | <p>In django I have the following database models:</p>
<ul>
<li><code>ParentA</code></li>
<li><code>ParentB</code></li>
<li><code>Connector</code> which has a foreign key that references the model <code>ParentA</code> and a foreign key that references the model <code>ParentB</code></li>
</ul>
<p>The <code>Connector</co... | <python><django> | 2025-04-08 18:40:25 | 1 | 2,019 | Charalamm |
79,562,760 | 2,266,881 | Read logs from cloud run function in python | <p>As the title says, it's possible/how can i read, using python, the logs from a Cloud Run function?</p>
<p>My guess is that, somehow, it can be done with the logging module from google.cloud, but it seems they are for the logging console only.</p>
| <python><google-cloud-platform> | 2025-04-08 18:05:36 | 1 | 1,594 | Ghost |
79,562,726 | 14,833,503 | IRFs Appear Reversed in RBC Model Simulation - Problem with Recursive Shock Application? | <p>I'm trying to simulate a fairly standard RBC model. The equations used in the code are all correct based on the chosen specification, so my question relates more to the implementation side.</p>
<p>Specifically, I want to use the technology shock generated in z_hat:</p>
<pre><code># Generate the autoregressive proces... | <python><optimization><dynamic><economics> | 2025-04-08 17:40:12 | 0 | 405 | Joe94 |
79,562,711 | 10,634,126 | Issues with personal Microsoft Sharepoint upload from Python | <p>I am trying to use a Python script to upload a CSV file to a SharePoint personal directory, with a URL like:</p>
<pre><code>https://{tenant}-my.sharepoint.com/personal/{user}_{tenant}_com/Documents/{path}
</code></pre>
<p>I have configured SharePoint API access with a <code>client_id</code> and <code>client_secret</... | <python><sharepoint><office365> | 2025-04-08 17:27:55 | 1 | 909 | OJT |
79,562,663 | 16,563,251 | Use importlib.resources.files with no argument | <p>I want to use <code>importlib.resources.files</code> to access a file from a module.
According to the <a href="https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files" rel="nofollow noreferrer">docs</a>,</p>
<blockquote>
<p>If the anchor is omitted, the callerโs module is used.</p>
</blo... | <python><python-module><python-importlib> | 2025-04-08 17:00:27 | 0 | 573 | 502E532E |
79,562,461 | 6,335,342 | V1Meta Authenticate Using SSO | <p>In the Python SDK README, the example for instantiating a V1Meta instance looks like:</p>
<pre><code>with V1Meta(
instance_url = 'https:// ...`,
username = 'admin',
password = 'admin'
) as v1:
</code></pre>
<p>What would that look like if rather than authenticating with username and password, I need to use t... | <python><authentication><versionone> | 2025-04-08 15:22:34 | 0 | 1,605 | steverb |
79,562,411 | 8,543,025 | MNE/Matplotlib Visualization Causes EasyGUI-QT to Crash | <p>I'm facing an issue combining <code>mne</code>, <code>matplotlib</code> and <code>easygui-qt</code> and I'm not sure how to find out where the issue is exactly.</p>
<p>I'm trying to show the user an <code>mne</code>-generated figure (preferably interactive) and an <code>easygui-qt</code>-generated modal (see example... | <python><qt><matplotlib> | 2025-04-08 14:59:11 | 0 | 593 | Jon Nir |
79,562,296 | 865,169 | Why can Pandas weekday DateOffset only move the date forward? | <p>I am trying to find the last of a weekday in a month. For example, let us say the last Sunday in October.</p>
<p>I try to do like this:</p>
<pre><code>pd.Timestamp("2025-10-31") - pd.DateOffset(weekday=6)
</code></pre>
<p>The resulting date is <code>Timestamp('2025-11-02 00:00:00')</code>, i.e. the result ... | <python><pandas><datetime> | 2025-04-08 14:13:57 | 2 | 1,372 | Thomas Arildsen |
79,562,207 | 8,563,165 | Flask-smorest get rid of "Default error response" from OpenAPI page | <p>The method doesn't return errors responce and I'd like to remove default error responce</p>
<pre class="lang-py prettyprint-override"><code>from flask.views import MethodView
from flask_smorest import Blueprint
from schemas.items import ItemsSchema
blp = Blueprint("api", "items", url_prefix=&quo... | <python><flask><flask-smorest> | 2025-04-08 13:41:18 | 1 | 848 | akpp |
79,562,059 | 17,040,989 | how to randomly add a list of sequences into a text body | <p>This is one of my first tasks with actual Python code.</p>
<p>What I need to do is to import a set of (FASTA) sequences, select those with a length between 400 and 500 (base pairs) characters, and randomly pick 100 of those to be added into another (FASTA genome) text body โ again at random.</p>
<p>One thing to cons... | <python><string><bioinformatics><biopython><fasta> | 2025-04-08 12:37:31 | 2 | 403 | Matteo |
79,561,979 | 5,980,655 | regex replace numbers between to characters | <p>I have a string <code>'manual__2025-04-08T11:37:13.757109+00:00'</code> and I want <code>'manual__2025-04-08T11_37_13_00_00'</code></p>
<p>I know how to substitute the <code>:</code> and <code>+</code> using</p>
<pre><code>'manual__2025-04-08T11:37:13.757109+00:00'.replace(':','_').replace('+','_')
</code></pre>
<p>... | <python><regex> | 2025-04-08 12:09:26 | 5 | 1,035 | Ale |
79,561,920 | 2,094,708 | Find shortest orthogonal path between two points in a 2D plane, through specified channels? | <p>How to find the shortest orthogonal path between two points in a 2D plane ?
The path should pass through channels whose coordinates are specified as union of orthogonal rectangles. The points can be assumed to be atleast touching the channels.
Is there any python module which can give this ?</p>
| <python><python-3.x> | 2025-04-08 11:44:56 | 1 | 2,283 | Sidharth C. Nadhan |
79,561,697 | 2,883,209 | Missing libraries (libpango) in Azure Python Function App 4.1037.1.1 | <p>Good morning all</p>
<p>Was hoping someone may be able to shed some light, or even just know where Microsoft publishes their release notes for their Azure Function App Runtimes</p>
<p>We tried to go live with a new function app about three weeks ago, and when we created the new python ~4 function app, and when the a... | <python><azure-functions> | 2025-04-08 09:47:13 | 1 | 1,244 | vrghost |
79,561,367 | 7,791,963 | How to disable robot framework automatically logging KubeLibrary response to DEBUG in my python keyword? | <p>I am utilizing robot framework's <a href="https://github.com/devopsspiral/KubeLibrary/tree/master/src/KubeLibrary" rel="nofollow noreferrer">KubeLibrary</a> to interact with my k8s cluster.</p>
<p>By default, any function and response is automatically logged to DEBUG in robot framework, meaning that it's response wi... | <python><robotframework> | 2025-04-08 06:47:48 | 1 | 697 | Kspr |
79,561,195 | 11,084,338 | Drop rows with all zeros in a Polars DataFrame | <p>I can use <code>drop_nans()</code> function to remove rows with some or all columns set as <code>nan</code>.</p>
<p>Is there an equivalent function for dropping rows with all columns having value 0?</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({"a":[0, 0, 0, 0, ... | <python><dataframe><filter><python-polars> | 2025-04-08 04:46:27 | 1 | 326 | GH KIM |
79,561,147 | 11,084,338 | Change column type in Polars DataFrame | <p>I have a Polars DataFrame below.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({"a":["1.2", "2.3", "5.4"],
"b":["0.4", "0.03", "0.12"],
"c":[&qu... | <python><dataframe><python-polars> | 2025-04-08 04:01:48 | 1 | 326 | GH KIM |
79,561,013 | 11,098,908 | Is it OK to not use the value of the index 'i' inside a for loop? | <p>Would it be frowned upon if the index variable <code>i</code> were not used inside a <code>for</code> loop? I have never come across a code that didn't use the value of the index while it iterates through the loop.</p>
<pre><code>def questionable():
for i in range(3):
print('Is this OK?') # (or do someth... | <python><for-loop> | 2025-04-08 01:34:33 | 2 | 1,306 | Nemo |
79,560,990 | 15,828,895 | Pylance slows my VSCode's autocomplete to as much as 5-10 sec of wait for the dropdown | <p>I discovered that Pylance was the source of my VSCode's autocomplete's slowness after following <a href="https://stackoverflow.com/questions/51874486/visual-studio-code-intellisense-is-very-slow-is-there-anything-i-can-do">Visual Studio Code Intellisense is very slow - Is there anything I can do?</a> and disabling a... | <python><visual-studio-code><pylance> | 2025-04-08 00:50:11 | 1 | 2,198 | plutownium |
79,560,716 | 5,203,069 | Dockerized Django app - `gunicorn: command not found` on AWS deployment | <p>I have a Dockerized Django app that is deployed on an AWS t3a.micro EC2 instance - after some recent updates to the Debian and PostgreSQL images that I'm using in the Dockerfile, the app is suddenly failing to start running successfully when it hits AWS due to an issue with <code>gunicorn</code> -</p>
<pre><code>pye... | <python><django><amazon-web-services><docker><gunicorn> | 2025-04-07 20:13:47 | 0 | 8,640 | skwidbreth |
79,560,688 | 7,959,614 | Transform list of dictionaries into nested dictionary | <p>I have the following list of dictionaries</p>
<pre><code>l = [{'u': 1, 'v': 2, 'k': [1, 1, 1, 1, 1]},
{'u': 1, 'v': 3, 'k': [2, 2, 2, 2, 2]},
{'u': 2, 'v': 3, 'k': [3, 3, 3, 3, 3]},
{'u': 1, 'v': 4, 'k': [4, 4, 4, 4, 4]},
{'u': 2, 'v': 5, 'k': [5, 5, 5, 5, 5]}]
</code></pre>
<p>I want to created ... | <python><dictionary> | 2025-04-07 19:57:49 | 3 | 406 | HJA24 |
79,560,656 | 3,777,717 | How does Python represent slices in various cases? | <p>Consider</p>
<pre><code>l = [1, 2, 3, 4, 5]
print(l is l[:])
t = (1, 2, 3, 4, 5)
print(t is t[:])
print(t[1:] is t[1:])
print('aa'[1:] is 'aa'[1:])
print('aaa'[1:] is 'aaa'[1:])
</code></pre>
<p>The result is, somewhat surprisingly, <code>False</code>, <code>True</code>, <code>False</code>, <code>True</code>, <code>... | <python><data-structures><heap-memory><implementation> | 2025-04-07 19:40:43 | 0 | 1,201 | ByteEater |
79,560,599 | 20,102,061 | Algorithm for detecting full loop when iterating over a list | <p>Assignment:</p>
<blockquote>
<p>Write a funcion <code>cycle_sublist(lst, start, step)</code> where:</p>
<ul>
<li><code>lst</code> is a list</li>
<li><code>start</code> is number that satisfies: <code>0 <= start < len(lst)</code></li>
<li><code>step</code> is the amount we increase your index each iteration</li... | <python><list><algorithm><loops> | 2025-04-07 19:02:29 | 2 | 402 | David |
79,560,569 | 10,634,126 | Issue uploading CSV to SharePoint from Python | <p>I am trying to upload a CSV of a Pandas DataFrame generated by a Python script to Microsoft SharePoint / OneDrive.</p>
<p>I cannot figure out how to get past the following error when I try to connect to upload a file:</p>
<pre><code>import pandas as pd
from office365.sharepoint.client_context import ClientContext
f... | <python><sharepoint><onedrive> | 2025-04-07 18:39:31 | 0 | 909 | OJT |
79,560,413 | 1,501,073 | how to use xsd with included and imported files with python | <p>I have a base.xsd file which includes an enums.xsd. Both files are in the same directory.</p>
<pre class="lang-xml prettyprint-override"><code><xs:include id="enums" schemaLocation="enums.xsd"/>
</code></pre>
<p>The enums.xsd imports:</p>
<pre class="lang-xml prettyprint-override"><code><... | <python><xsd><xsd-validation> | 2025-04-07 16:50:24 | 0 | 7,830 | tschmit |
79,560,285 | 9,173,710 | Logging in PySide6 GUI with rich.logging RichHandler and QTextEdit HTML text, causes spacing and alignment issues | <p>I want to show the application log on the GUI in some way.
I am using my own class, which inherits from both <code>QTextEdit</code> and <code>logging.Handler</code>. It is added to logging as a handler at init.</p>
<p>If I insert the text as plaintext into the widget, it prints fine. Linespacing is just fine. For th... | <python><logging><pyside6><rich> | 2025-04-07 15:36:23 | 1 | 1,215 | Raphael |
79,560,135 | 14,385,099 | Creating new rows in a dataframe based on previous values | <p>I have a dataframe that looks like this:</p>
<pre><code>test = pd.DataFrame(
{'onset': [1,3,18,33,35,50],
'duration': [2,15,15,2,15,15],
'type': ['Instr', 'Remember', 'SocTestString', 'Rating', 'SelfTestString', 'XXX']
}
)
</code></pre>
<p>I want to create a new dataframe such that when <code>type<... | <python><pandas> | 2025-04-07 14:22:41 | 1 | 753 | jo_ |
79,560,075 | 16,563,251 | Exclude methods consisting of a single pass statement from coverage reports in python | <p>In my class, I have some methods that can be overridden by subclasses, but do not need to be.</p>
<p>I like to test my project and generate a coverage report using <a href="https://coverage.readthedocs.io/" rel="nofollow noreferrer">coverage.py</a>.
Because the method of the superclass does not do anything, it is no... | <python><abstract-class><python-class><coverage.py> | 2025-04-07 13:58:10 | 0 | 573 | 502E532E |
79,559,952 | 11,062,613 | Howto efficiently apply a gufunc to a 2D region of a Polars DataFrame | <p>Both Polars and Numba are fantastic libraries that complement each other pretty well. There are some limitations when using Numba-compiled functions in Polars:</p>
<ul>
<li>Arrow columns must be converted to NumPy arrays (and then converted back).</li>
<li>NumPy/Numba does not support missing data.</li>
</ul>
<p>I'm... | <python><numpy><python-polars><numba><polars> | 2025-04-07 12:57:01 | 0 | 423 | Olibarer |
79,559,899 | 91,401 | Solve the kinematic equations for aiming a simulated turret with velocity and acceleration | <p>I am working on a problem for a simulated game. I want my AI to be able to aim at a moving enemy target with a given starting location, starting velocity, and constant acceleration.</p>
<p>The position of the enemy is given by</p>
<pre><code>p_e(t) = s_e + v_e * t + 0.5 * a_e * t ** 2
</code></pre>
<p>and the positi... | <python><sympy> | 2025-04-07 12:33:49 | 2 | 384 | James Aguilar |
79,559,870 | 2,043,014 | Monitoring Actual Bytes Written to Flash After SQLite Insert Operations | <p>I am currently working on a project where I need to monitor the actual bytes written to flash storage after performing insert operations in an SQLite database. I've simplified my approach to the following code snippet:</p>
<pre class="lang-py prettyprint-override"><code>def get_sectors_written_from_stat():
with ... | <python><linux><database><sqlite><iostat> | 2025-04-07 12:24:13 | 0 | 671 | user12345 |
79,559,711 | 1,023,390 | Matplotlib logit scale tick number formatting | <p>When using the <code>log</code> scale with <code>matplotlib</code>, we can set globally with (<a href="https://stackoverflow.com/a/72693296/1023390">see this answer</a>)</p>
<pre><code>import matplotlib.pyplot as plt
plt.rcParams['axes.formatter.min_exponent'] = 3
</code></pre>
<p>that ticks on logarithmic axes are ... | <python><matplotlib><xticks> | 2025-04-07 11:07:37 | 1 | 45,824 | Walter |
79,559,664 | 3,840,530 | How to write a string containing binary representation of data to file? | <p>I am trying to write a binary string as binary data to file but my function seems to be having a problem with the int conversion. I am reading a text file and manipulating it which gives me a string representation of the data (say, binary_string below). I want to write this data to file as bits. I found the below fu... | <python><file><io><binary><byte> | 2025-04-07 10:46:48 | 0 | 302 | user3840530 |
79,559,492 | 5,868,293 | Get analytical equation of RF regressor model | <p>I have the following dataset:</p>
<pre><code> X1 X2 X3 y
0 0.548814 0.715189 0.602763 0.264556
1 0.544883 0.423655 0.645894 0.774234
2 0.437587 0.891773 0.963663 0.456150
3 0.383442 0.791725 0.528895 0.568434
4 0.568045 0.925597 0.071036 0.018790
5 0.087129 0.02021... | <python><machine-learning><scikit-learn><regression><random-forest> | 2025-04-07 09:27:58 | 0 | 4,512 | quant |
79,559,259 | 1,228,765 | Why does Ray attempt to install ray wheels from ray-wheels.s3-us-west-2.amazonaws.com? | <p>When submitting a Ray job using a conda runtime env (<code>runtime_env = {"conda": "environment.yml"}</code>), Ray attempts to install the <code>ray</code> wheel from <code>ray-wheels.s3-us-west-2.amazonaws.com</code> even when I configure pip to use a different Python package index (<code>--inde... | <python><conda><pypi><ray> | 2025-04-07 07:03:10 | 0 | 2,351 | Martin Studer |
79,559,164 | 5,959,593 | When is typing.cast required? | <p>Here's the code</p>
<pre class="lang-py prettyprint-override"><code># args: argparse.Namespace
source: str = args.source
...
# subparsers: argparse._SubParsersAction
parser = subparsers.add_parser()
</code></pre>
<p>In the first line of code, <code>: str</code> is enough to tell Pylance that <code>source</code> is... | <python><python-typing><pyright> | 2025-04-07 05:55:20 | 1 | 1,100 | Minh Nghฤฉa |
79,558,939 | 11,084,338 | Using a list of values to select rows from Polars DataFrame | <p>I have a Polars DataFrame below:</p>
<pre><code>import polars as pl
df = pl.DataFrame({"a":[1, 2, 3], "b":[4, 3, 2]})
>>> df
a b
i64 i64
1 4
2 3
3 2
</code></pre>
<p>I can subset based on a specific value:</p>
<pre><code>x = df[df["a"] == 3]
>>> ... | <python><dataframe><list><python-polars><polars> | 2025-04-07 01:38:11 | 1 | 326 | GH KIM |
79,558,911 | 11,084,338 | How to remove a prefix from all column names in a Polars DataFrame? | <p>I have a Polars DataFrame like</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.from_repr("""
โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ
โ #a โ #b โ #c โ #d โ
โ --- โ --- โ --- โ --- โ
โ i64 โ i64 โ i64 โ i64 โ
โโโโโโโชโโโโโโชโโโโโโชโโโโโโก
โ 1 โ 2 โ 3 โ 4 โ
โโโโโโโดโโโโโโดโโโโโโดโ... | <python><dataframe><python-polars> | 2025-04-07 01:04:25 | 3 | 326 | GH KIM |
79,558,863 | 9,951,273 | Set SwaggerUI Access Token on App Startup | <p>I have a FastAPI app below.</p>
<pre><code>from fastapi import Depends, FastAPI, Security
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
async def verify(token: HTTPAuthorizationCredentials | None = Depends(HTTPBearer())):
# VERIFY TOKEN
return token
app = FastAPI(
swagger_ui_par... | <python><fastapi><swagger-ui> | 2025-04-06 23:53:15 | 0 | 1,777 | Matt |
79,558,818 | 11,462,274 | Open a popup in Edge browser using subprocess and fixed text in the window bar name which is originally defined by the value of document.title in html | <p>To open a popup I use subprocess:</p>
<pre class="lang-python prettyprint-override"><code>import subprocess
EDGE_PATCH = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
url = "https://www.google.com/"
subprocess.Popen([EDGE_PATCH, f'--app={url}'])
</code></pre>
<p>But I noticed tha... | <python><html><subprocess> | 2025-04-06 22:31:31 | 0 | 2,222 | Digital Farmer |
79,558,781 | 6,068,294 | ipywidgets widgets not launching | <p>I'm trying to write a python3 program that using widget to get input,</p>
<pre><code>import ipywidgets as widgets
from IPython.display import display, clear_output
def button_clicked(b):
with output:
clear_output()
print("Button clicked!")
button = widgets.Button(description="Cli... | <python><ipywidgets> | 2025-04-06 21:49:47 | 0 | 8,176 | ClimateUnboxed |
79,558,657 | 7,959,614 | Apply 1d-mask on numpy 3d-array | <p>I have the following 3d-<code>numpy.ndarray</code>:</p>
<pre><code>import numpy as np
X = np.array([
[[0.0, 0.4, 0.6, 0.0, 0.0],
[0.6, 0.0, 0.0, 0.0, 0.0],
[0.4, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.6, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.4, 0.0, 1.0]],
[[0.1, 0.5, 0.4, 0.0, 0.0],
[0.6, 0.0, 0.0, 0.... | <python><numpy> | 2025-04-06 19:36:37 | 1 | 406 | HJA24 |
79,558,410 | 5,722,359 | How to prevent ruff from formatting arguments of a function into separate lines? | <p>I have a function like so:</p>
<pre><code>def get_foo(a: object, b: tuple, c: int,) -> dict:
.....
</code></pre>
<p>When I do <code>$ ruff format myfile.py</code>, my function is changed to</p>
<pre><code>def get_foo(
a: object,
b: tuple,
c: int,
) -> dict:
....
</code></pre>
<p>How do I st... | <python><ruff> | 2025-04-06 15:42:15 | 2 | 8,499 | Sun Bear |
79,558,403 | 4,996,797 | How to change the list[str] annotation so that it accepts list[LiteralString] too? | <p>I have a function that takes a list of <code>str</code> as an input</p>
<pre class="lang-py prettyprint-override"><code>def function(names: list[str]) -> None:
for name in names:
print(name)
</code></pre>
<p>If I generate the list using the <code>split()</code> function, I end up with an object of type <cod... | <python><python-typing> | 2025-04-06 15:39:30 | 1 | 408 | Paweล Wรณjcik |
79,558,301 | 1,549,736 | Why does my Python test run fail when invoked via Tox, despite running just fine when invoked manually? | <p>When I invoke my Python package testing in the usual way, via Tox, it's failing:</p>
<pre class="lang-bash prettyprint-override"><code>$ python -I -m tox run -e py310-lin
py310-lin: install_deps> python -I -m pip install pytest pytest-cov pytest-xdist typing_extensions PyAMI/dist/pyibis_ami-7.2.2-py3-none-any.whl... | <python><testing><tox> | 2025-04-06 14:00:15 | 0 | 2,018 | David Banas |
79,558,297 | 10,024,860 | Mock asyncio.sleep to be faster in unittest | <p>I want to mock <code>asyncio.sleep</code> to shorten the delay, e.g. by a factor of 10, to speed up my tests while also trying to surface any possible race conditions or other bugs as a crude sanity check. However I cannot figure out, if <code>sut.py</code> and <code>test.py</code> both use <code>import asyncio</cod... | <python><unit-testing><pytest><python-asyncio><python-unittest> | 2025-04-06 13:58:43 | 1 | 491 | Joe C. |
79,558,159 | 633,001 | Can't exit program - win32gui PumpMessages | <p>I have code that needs to detect when a new media device is attached / detached.</p>
<p>I have copied some code based on pywin32 to do so:</p>
<pre><code>import win32api, win32con, win32gui
from ctypes import *
from threading import Thread
#
# Device change events (WM_DEVICECHANGE wParam)
#
DBT_DEVICEARRIVAL = 0x80... | <python><pywin32> | 2025-04-06 11:52:24 | 0 | 3,519 | SinisterMJ |
79,558,133 | 21,540,734 | How to stop system tray Icons from grouping together | <p>I have a couple different projects that I am using pystray for, and these icons are grouping together when moving them in the system tray.</p>
<p>I've found that this is the case for anything using the WinAPI, Whether it be pywin32 or something coded by hand using ctypes to implement the API like pystray. Any way to... | <python><winapi><system-tray><pystray> | 2025-04-06 11:29:30 | 0 | 425 | phpjunkie |
79,558,107 | 4,483,861 | matplotlib.pyplot slow over SSH in terminal (fast in VS Code Remote-SSH) | <p>I have this script on a server:</p>
<pre><code>import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from time import time
bknd = mpl.get_backend()
x = np.random.random(100)*10
y = np.sin(x)
t0 = time()
plt.plot(x,y,'.')
t1 = time()
print(f"{bknd} {t1-t0:.1f} seconds")
plt.show()
... | <python><matplotlib><visual-studio-code><terminal><x11-forwarding> | 2025-04-06 11:02:18 | 0 | 2,649 | Jonatan รstrรถm |
79,558,025 | 11,062,613 | Efficient and readable way to get N-dimensional index array in C-order using NumPy | <p>When I need to generate an N-dimensional index array in C-order, Iโve tried a few different NumPy approaches.</p>
<p>The fastest for larger arrays but less readable:</p>
<pre><code>np.stack(np.meshgrid(*[np.arange(i, dtype=dtype) for i in sizes], indexing="ij"), axis=-1).reshape(-1, len(sizes))
</code></pr... | <python><arrays><numpy><numba> | 2025-04-06 09:31:27 | 1 | 423 | Olibarer |
79,557,952 | 2,371,765 | pyproject.toml related error while installing spacy library | <p>I get the following error while installing the spacy library in Python 3.13.0. The pip version is 25.0.1. Can someone help? Thank you.</p>
<p>(I made sure to install numpy, scipy, preshed,Pyrebase4 based on responses to similar questions, and upgraded setuptools.)</p>
<pre><code>Preparing metadata (pyproject.toml): ... | <python><spacy> | 2025-04-06 08:13:01 | 1 | 458 | user17144 |
79,557,819 | 16,383,578 | How to efficiently calculate the fraction (valid UTF8 byte sequence of length N)/(total N-byte sequences)? | <p>This will be a long post. And it absolutely has nothing to do with homework, I am just curious, and this won't have immediate practical benefits, but that is like pursuing pure science, you never know what you will get.</p>
<p>I am trying to calculate the value of the total number of valid UTF8 sequences of length N... | <python><algorithm><math><utf-8><combinatorics> | 2025-04-06 05:22:16 | 1 | 3,930 | ฮฮญฮฝฮท ฮฮฎฮนฮฝฮฟฯ |
79,557,769 | 3,057,743 | Wagtail default template field in_preview_panel is fine in dev but fails in production | <p>In the default template from Wagtail even mentioned online <a href="https://docs.wagtail.org/en/stable/tutorial/style_your_site.html" rel="nofollow noreferrer">here</a>, there is a part:</p>
<pre><code>{# Force all links in the live preview panel to be opened in a new tab #}
{% if request.in_preview_panel %}
<bas... | <python><django><wagtail> | 2025-04-06 03:37:26 | 1 | 1,404 | barej |
79,557,694 | 7,822,387 | saving statsmodel to adls blob storage | <p>i currently have a model fit using statsmodel OLS formula and I am trying to save this model to ADLS blob storage. '/mnt/outputs/' is a mount point I have created and I am able to read and write other files from this directory.</p>
<pre><code>import statsmodels.formula.api as smf
fit = smf.ols(formula=f"Pressur... | <python><azure><statsmodels><azure-data-lake-gen2> | 2025-04-06 01:02:55 | 1 | 311 | J. Doe |
79,557,602 | 2,241,653 | Python Azure Function doesn't show functions after importing packages | <p>I have an Azure Function based on Python 3.12 (same issue when I downgrade to Python 3.11). This worked fine until I imported <code>azure.identity</code> and <code>azure.keyvault.secrets</code>. Since I've added them the functions are not shown anymore in my Azure Function. When I remove them the functions will be b... | <python><azure><azure-functions> | 2025-04-05 22:47:58 | 3 | 1,525 | mburm |
79,557,468 | 2,856,552 | xtick labels not showing on python line plot | <p>My Python code of departures vs years, below works fine for a bar plot. I would like to have year tick mark labels on the x-axis. Currently I get the line plot, but no years labelled on the x-axis. For the bar plot the years are labelled alright.</p>
<p>This is not a multi-plot (or subplots), but plotting the line p... | <python><matplotlib> | 2025-04-05 20:04:33 | 1 | 1,594 | Zilore Mumba |
79,557,430 | 11,462,274 | Using the free-proxy library with requests to access general https websites | <p>When basically requesting a proxy, what happens is that it delivers an http that currently seems to me to be unusable because the vast majority of sites use https and this causes the request to be made using my own IP instead of the collected proxy, as we can see here:</p>
<pre class="lang-python prettyprint-overrid... | <python><web-scraping><python-requests><proxy> | 2025-04-05 19:28:48 | 0 | 2,222 | Digital Farmer |
79,557,207 | 89,706 | Python type-hint for attribute or property? | <p>I'm adding type hints for an existing large codebase, and am faced with a situation like:</p>
<pre class="lang-py prettyprint-override"><code>from abc import ABC
class C: ...
class Base(ABC): ...
class Child1(Base):
my_awesome_field: C
class Child2(Base):
@property
def my_awesome_field(self) -> C:... | <python><python-typing><pyright> | 2025-04-05 15:47:59 | 1 | 16,435 | Ofek Shilon |
79,557,068 | 6,038,082 | How to show a better image view using tkinter? | <p>In my Python tkinter gui, I am showing several nodes which are inter-dependent and at various levels. <br>
When I click on each node , it opens a pop-up which is displaying the node which are just at one level up and one level down with respect to the node clicked. <br><br>
However, if the number of nodes are too ma... | <python><tkinter> | 2025-04-05 14:04:22 | 0 | 1,014 | A.G.Progm.Enthusiast |
79,556,969 | 7,483,211 | Pytensor compilation failed during linking stage on macOS | <p>When trying to run a simple PyMC example on ARM macOS 15.4 using a fresh conda-forge conda-environment the run fails with a compilation error: <code>pytensor.link.c.exceptions.CompileError: Compilation failed</code></p>
<pre class="lang-py prettyprint-override"><code>import pymc as pm
with pm.Model() as model:
... | <python><macos><pymc><pytensor> | 2025-04-05 12:43:12 | 1 | 10,272 | Cornelius Roemer |
79,556,867 | 1,581,090 | How can I create a GIF image using Pillow and imageio with Python? | <p>I have the following code that creates 60 frames using Pillow in Pythonย 3.11.10 and that I want to use to create a GIF image (repeating endless), with a duration per frame of 0.1 seconds. The first four frames should show a red square, and the rest of the time (almost six seconds) it should be basically black.</p>
<... | <python><python-imaging-library><gif> | 2025-04-05 11:02:26 | 1 | 45,023 | Alex |
79,556,755 | 465,159 | How to create "dynamic" Literal types from dataclass members | <p>How to do add support for custom smart type completion in Python?</p>
<p>Let's say I have a dataclass:</p>
<pre><code>@dataclass
class MyData:
mine: str
yours: str
def col(self, value: str):
return "The column name is: " + value
</code></pre>
<p>I want the <code>value</code> argument in <code>... | <python><python-typing><python-dataclasses> | 2025-04-05 09:03:32 | 1 | 5,474 | Ant |
79,556,720 | 7,590,783 | Azure functions get multi file uploads | <p>I am trying to count the total no: of files uploaded to Azure Functions (Python). Tried uploading multiple files via postman but the AZ Func always reads only the first file and count is always 1. Why is that? Please help.</p>
<pre><code>for input_file in req.files.values():
filename = input_file.filenam... | <python><azure-functions> | 2025-04-05 08:31:12 | 1 | 639 | Svj |
79,556,656 | 10,440,128 | Get the maximum frequency of an audio spectrum | <p>I want to detect the cutoff frequency of the AAC audio encoder used to compress an M4A audio file.</p>
<p>This cutoff frequency (or maximum frequency) is an indicator of audio quality.
High-quality audio has a cutoff around 20KHz (fullband),
medium-quality audio has a cutoff around 14KHz (superwideband),
low-quality... | <python><audio><ffmpeg><fft><spectrogram> | 2025-04-05 06:58:05 | 1 | 3,764 | milahu |
79,556,594 | 3,967,334 | uv's [project.scripts] won't activate the environment in venv | <p>I have a UV project with the structure</p>
<pre class="lang-ini prettyprint-override"><code>[project]
name = "trapallada"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"pandas&... | <python><pyproject.toml><uv> | 2025-04-05 05:38:28 | 2 | 1,479 | manu |
79,556,592 | 17,729,094 | How to repeat and truncate Polars list elements to a fixed length | <p>I have data that looks like:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
lf = pl.LazyFrame(
{
"points": [
[
[1.0, 2.0],
],
[
[3.0, 4.0],
[5.0, 6.0],
],
[
... | <python><dataframe><list><python-polars> | 2025-04-05 05:34:27 | 1 | 954 | DJDuque |
79,556,482 | 616,728 | How to validate search terms when using embedding to look for objects in images | <p>I have a search on my site that does both tradition full text search and searches using embeddings. So, for example, when you search 'red balloon' I want both the text and image results. The problem is that not all search terms make sense for object detection (like, say 'William' or even like an identifier like a dr... | <python><pytorch><knn><embedding> | 2025-04-05 02:15:16 | 1 | 2,748 | Frank Conry |
79,556,459 | 1,078,556 | Moving elements of a python dictionary to another one under certain condition using less code | <p>OK, so this is more a code "optimization" exercise.</p>
<p>I have to move all elements from a python dictionary to another, under certain condition, while emptying the source dict at the same time. (No matter I find matching elements or not, the source dict must be empty by the end)</p>
<p>Let's have:</p>
... | <python><dictionary><optimization><one-liner> | 2025-04-05 01:39:46 | 1 | 1,529 | danicotra |
79,556,449 | 1,245,659 | Django ModelForm ensuring FK integrity without using it in the form | <p>I have a User Profile model with a Model Form:</p>
<pre><code>class Profile(models.Model):
# Managed fields
user = models.OneToOneField(User, related_name="profile", on_delete=models.CASCADE)
memberId = models.CharField(unique=True, max_length=15, null=False, blank=False, default=GenerateFA... | <python><django> | 2025-04-05 01:22:02 | 1 | 305 | arcee123 |
79,556,360 | 1,609,514 | Pytest fixture is changing the instance returned by another fixture | <p>I'm very baffled and a little concerned to discover the following behaviour where I have two tests and two fixtures.</p>
<pre class="lang-py prettyprint-override"><code>import pytest
@pytest.fixture
def new_object():
return list()
@pytest.fixture
def a_string(new_object):
# Change this instance of the ob... | <python><pytest><fixtures> | 2025-04-04 23:16:13 | 2 | 11,755 | Bill |
79,556,268 | 629,960 | MCP Python SDK. How to authorise a client with Bearer header with SSE? | <p>I am building the MCP server application to connect some services to LLM . I use the MCP Python SDK <a href="https://github.com/modelcontextprotocol/python-sdk" rel="nofollow noreferrer">https://github.com/modelcontextprotocol/python-sdk</a>
One of things i want to implement is authorisation of a user with the token... | <python><fastapi><large-language-model> | 2025-04-04 21:17:58 | 1 | 2,113 | Roman Gelembjuk |
79,556,229 | 16,563,251 | Type hint return type of abstract method to be any instance of parent class | <p>How can I type hint that the return type of a method of some abstract class is some instance of this class?</p>
<p>My intuitive answer is that</p>
<pre><code>@abstractmethod
def mymethod() -> typing.Self:
pass
</code></pre>
<p>should be the correct way (as suggested in <a href="https://stackoverflow.com/quest... | <python><python-typing> | 2025-04-04 20:50:29 | 2 | 573 | 502E532E |
79,556,196 | 6,051,639 | Tried to update conda, now I've ruined my base env | <p>I am using windows 11, Intel(R) Xeon(R) Gold 5215 CPU.</p>
<p>I tried to update fiona in my python 3.12 environment and was told to update conda, but following the conda instructions just resulted in the same prompt to update conda, with the same instructions:</p>
<pre><code>(p312) C:\Users\wesk>conda update fion... | <python><conda> | 2025-04-04 20:30:33 | 0 | 424 | Wesley Kitlasten |
79,556,028 | 8,830,612 | Azure ML Train Test Valid split for image data | <p>I have annotated with bounding boxes couple of hundred pictures in Azure ML Studio from a Labeling Project.</p>
<p>I have exported the annotations as ML Table and COCO JSON format - both are available in Azure ML as Data assets</p>
<p>How to split the data into train, test and valid. I want to use the annotations an... | <python><azure><azure-machine-learning-service> | 2025-04-04 18:16:05 | 1 | 518 | default_settings |
79,556,023 | 24,108 | Have a dataclass extend an ABC with an abstract property | <p>I want to define an abstract base class that has a property on it. I then want to have a dataclass extent that base class and have the abstract property be one of the dataclass' fields.</p>
<pre><code>from abc import ABC, abstractmethod
from dataclasses import dataclass
class Base(ABC):
@property
@abstract... | <python><python-dataclasses><abstract-base-class> | 2025-04-04 18:13:26 | 1 | 15,040 | John Oxley |
79,555,896 | 2,501,622 | Python script locked by thread | <p>I would like this Python 3.10 script (where the <code>pynput</code> code is partially based on <a href="https://stackoverflow.com/a/43106497">this answer</a>) to enter the <code>while</code> loop and at the same time monitor the keys pressed on the keyboard. When <code>q</code> is pressed, I would like it to end.</p... | <python><multithreading><keyboard><python-multithreading><python-3.10> | 2025-04-04 16:50:11 | 1 | 1,544 | BowPark |
79,555,604 | 967,621 | Run Ruff in Emacs | <p>How can I run Ruff in Emacs? I need to enable 2 commands on the current buffer:</p>
<ul>
<li><code>ruff check --select ALL current_buffer</code> โ bind to <code>M-x ruff-check</code></li>
<li><code>ruff check --select ALL --fix current_buffer</code> โ bind to <code>M-x ruff-fix</code></li>
</ul>
<p>I can run each of... | <python><emacs><ruff> | 2025-04-04 14:38:46 | 1 | 12,712 | Timur Shtatland |
79,555,397 | 13,330,435 | Python's analog of xtregar | <p>I'm new in Python. I would like to know wheter there is a package that performs the same thing as Stata's 'xtregar' ou R's 'panelAR'.</p>
<p>I would like to estimate the following regression</p>
<pre><code>Y_{i,t}=\alpha+\beta X_{i,t-1}+\eta_i+\nu_t+u_{i,t}
where u_{i,t}=\rho u_{i,t-1}+\omega_{i,t}
</code></pre>
<p... | <python><linear-regression> | 2025-04-04 13:06:06 | 0 | 317 | jorgep |
79,555,255 | 25,413,271 | Numpy- strange behaviour of __setitem__ of array | <p>Say we have an array:</p>
<pre><code>a = np.array([
[11, 12, 13],
[21, 22, 23],
[31, 32, 33],
[41, 42, 43]
])
a[[1, 3], [0, 2]] = 0
</code></pre>
<p>So we want to set zeros to 0th and 2nd element at both 1st and 3rd rows.
But what we get is:</p>
<pre><code>[[11 12 13]
[ 0 22 23]
[31 32 33]
[41 42... | <python><arrays><numpy> | 2025-04-04 11:59:37 | 2 | 439 | IzaeDA |
79,555,174 | 6,498,753 | Conversion from ECEF (spherical Earth) to geodetic coordinates | <p>ECEF (geocentric) coordinate system is generally referred to an ellipsoid (e.g. WGS84). The conversion to geodetic coordinates is then straightforward in python:</p>
<pre><code>geocentric_crs = {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}
geodetic_crs = {"proj": "... | <python><coordinate-systems><coordinate-transformation><pyproj> | 2025-04-04 11:22:52 | 0 | 461 | Roland |
79,555,053 | 6,029,488 | Group by and apply multiple custom functions on multiple columns in python pandas | <p>Consider the following dataframe example:</p>
<pre><code>id date hrz tenor 1 2 3 4
AAA 16/03/2010 2 6m 0.54 0.54 0.78 0.19
AAA 30/03/2010 2 6m 0.05 0.67 0.20 0.03
AAA 13/04/2010 2 6m 0.64 0.32 0.13 0.20
AAA 27/04/2010 2 6m 0.99 ... | <python><pandas><group-by><apply> | 2025-04-04 10:22:33 | 2 | 479 | Whitebeard13 |
79,554,857 | 18,876,759 | Concrete RTPExtension for Scapy | <p>Scapy defines a RTP packet and a RTPExtension</p>
<p>The RTPExtension is defined as follows:</p>
<pre class="lang-py prettyprint-override"><code>class RTPExtension(Packet):
name = "RTP extension"
fields_desc = [ShortField("header_id", 0),
FieldLenField("header_len&... | <python><scapy> | 2025-04-04 08:42:13 | 0 | 468 | slarag |
79,554,839 | 1,574,952 | Python tab completion triggers attribute access | <p>I'm running into an issue with tab completion in Python. I have two classes, one serving as a backend that is responsible for managing i/o of a large data collection, and a second that serves as a UI for access to that data. The backend implements a lazy-loading approach where expensive i/o operations are delayed un... | <python><lazy-loading><magic-methods><tab-completion> | 2025-04-04 08:30:41 | 1 | 364 | Kyle |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.