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,017,833 | 102,221 | Error installing smbus module with Python 3.10 | <p>I have Ubuntu running on Raspberry Pi and Python 3.10 installed on it.
In my attempt to add <code>smbus</code> library I get next error:</p>
<pre><code>pi@raspberrypi:~$ python3 -m pip install smbus
Defaulting to user installation because normal site-packages is not writeable
Collecting smbus
Using cached smbus-1.... | <python><python-3.x><pip><smbus> | 2023-08-31 16:48:26 | 1 | 1,113 | BaruchLi |
77,017,804 | 5,583,772 | Polars: "ValueError: could not convert value 'Unknown' as a Literal" | <p>I have a line of code in polars that worked prior to my most recent update of the polars package to '0.19.0'. This example ran before:</p>
<pre><code>import polars as pl
df = pl.DataFrame(
{
"a": [5, 6, 7, 8, 9],
"b": [5, 6, 7, 8, 9],
"c": [5, 6, 7, 8, None... | <python><python-polars> | 2023-08-31 16:44:20 | 1 | 556 | Paul Fleming |
77,017,728 | 371,577 | How is Python multithreading efficient with the non-async requests library? | <p>I would just like to understand, I'm using a Python script that sends 3 HTTP GET requests to an URL that I made to wait for 5 seconds.</p>
<p>I am using the requests library and the threading Python module like so:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import time
import request... | <python><multithreading> | 2023-08-31 16:33:42 | 0 | 797 | StefanH |
77,017,686 | 19,130,803 | Change text color of a column of dbc.Table | <p>I am developing a dash application. I have a dataframe coming from backend and in forntend, I am displaying that dataframe using <code>dbc.Table</code> component.</p>
<pre><code>import dash_bootstrap_components as dbc
import pandas as pd
df = pd.DataFrame(
{
"First Name": ["Arthur", ... | <python><pandas><plotly-dash> | 2023-08-31 16:25:21 | 1 | 962 | winter |
77,017,603 | 9,536,103 | Cumulative distinct count in pandas | <p>I have a dataframe with a column called <code>group</code> and another column called <code>country</code>. I want to create a new column that outputs a cumulative count of distinct values in the <code>country</code> column whilst grouping on the <code>group</code> column</p>
<p>Original dataframe:</p>
<pre><code>gro... | <python><pandas> | 2023-08-31 16:10:57 | 2 | 1,151 | Daniel Wyatt |
77,017,536 | 1,958,391 | Swin-Transformer-TF not working with generator | <p>Swin-Transformer-TF from <a href="https://github.com/rishigami/Swin-Transformer-TF/tree/main" rel="nofollow noreferrer">https://github.com/rishigami/Swin-Transformer-TF/tree/main</a>, failed when I use generator for train. I tried many generators, and many output of generators options, lists, Tensor's etc. everythin... | <python><tensorflow><transformer-model><swin-transformer> | 2023-08-31 15:59:31 | 1 | 2,144 | Naomi Fridman |
77,017,429 | 6,385,519 | Folium: How to show a map from a saved html file in ipynb | <p>I have a folium map saved locally as a html file, now I want to read that <code>map.html</code> file to show a map in another ipynb cell/notebook.</p>
<p>Minimum code to generate the local file:</p>
<pre><code>import folium
m = folium.Map(location=[45.5236, -122.6750])
m # to view the map if needed
m.save('map.htm... | <python><folium> | 2023-08-31 15:46:23 | 1 | 2,605 | Suraj Shourie |
77,017,408 | 5,108,149 | Raspberry Pi transmits corrupted data | <p>I have a Raspberry Pi Zero trying to read GPS data.</p>
<p>With this command:</p>
<pre><code>sudo cat /dev/ttyAMA0
</code></pre>
<p>I get the following correct data:</p>
<pre><code>$GPGSV,1,1,0*49
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGLL,,,,,,V,N*64
$GPGSA,A,1,,,,,,,,,,,,,99... | <python><raspberry-pi><raspberry-pi-zero> | 2023-08-31 15:43:51 | 1 | 1,653 | Blendester |
77,017,255 | 104,324 | Attempt to speedup python unzip using isal_zlib fails | <p>I have a long running series of scripts to unpack and analyse a very large dataset. Using pyinstruments I have found out that the ZipFile library is taking up a large amount of time. The files I'm unzipping are actually GLF files - taken from a Tritech Gemini Sonar.</p>
<p>The GLF file itself is actually a zip file ... | <python><performance><zip><compression><zlib> | 2023-08-31 15:25:38 | 1 | 692 | Oni |
77,017,251 | 11,659,920 | Reference a dict from another file in Lambda | <p>I initially had an index.py file with contents like</p>
<pre><code>import boto3
import json
import os
BUCKETNAME = os.environ['bucketname']
PUBLICKEYSBUCKETNAME = os.environ['publickkeysbucketname']
TRANSFERACCESSADMINROLE = os.environ['transferaccessadminrole']
TRANSFERACCESSREADROLE = os.environ['transferaccessre... | <python><aws-lambda><lambda> | 2023-08-31 15:25:22 | 1 | 467 | Jason Stanley |
77,017,062 | 13,494,917 | How to avoid accessing table at same time as another instance? | <p>I have a Log table that I send data to when an event happens. Sometimes there are multiple events that happen at basically the same time. Sometimes this causes duplicates in a value that I'm grabbing and incrementing before sending it back to the table with some other data.
Problem arises when two instances are doin... | <python><sql-server><pandas><sqlalchemy><azure-sql-database> | 2023-08-31 15:03:15 | 0 | 687 | BlakeB9 |
77,016,846 | 816,721 | Poetry script, command not found | <p>I created a project using poetry. My project structure is like this -</p>
<pre><code>/
pyproject.toml
winshift/
__init__.py
cli.py
... more sturf
</code></pre>
<p>My file <code>cli.py</code> includes a function <code>main</code> and in my <em>pyproject.toml</em> I defined -</p>
<pre><code>...
[tools.poetry.scrip... | <python><python-poetry> | 2023-08-31 14:35:01 | 1 | 18,233 | rkmax |
77,016,767 | 6,195,489 | SQLalchemy: how to patch session from context manager and replace with in memory DB session | <p>Say I have an SQLalchemy model like:</p>
<pre><code>from app.data_structures.base import (
Base
class User(Base):
__tablename__ = "users"
user_name: Mapped[str] = mapped_column(primary_key=True, nullable=True)
flag = Column(Boolean)
def __init__(
self,
user_name: str ... | <python><unit-testing><sqlalchemy><mocking><python-unittest> | 2023-08-31 14:25:14 | 0 | 849 | abinitio |
77,016,724 | 10,232,932 | Add a numpy array with one value less to a pandas column | <p>I have a pandas dataframe df:</p>
<pre><code>A B C
1 2 NaN
2 3 NaN
4 5 NaN
</code></pre>
<p>How can I add a numpy array with the shape of 1 element less then the length of the dataframe, in this case, the numpy array:</p>
<pre><code>[10 20]
</code></pre>
<p>And I want to start at the second row and fill the ... | <python><pandas><numpy> | 2023-08-31 14:20:22 | 1 | 6,338 | PV8 |
77,016,618 | 543,087 | Websocket automatically closes after response in Python | <p>The following code is run as a server and browser clients connect.
However after each request the browser is showing that websocket connection is closed. I want to keep connection open in browser clients as reopening is making it slow due to network issues etc.
Earlier with Nodejs websocket servers it never closed t... | <python><python-3.x><websocket> | 2023-08-31 14:06:24 | 0 | 1,241 | user5858 |
77,016,586 | 3,616,293 | np.where comparison between 2 arrays | <p>I have 4 numpy arrays as:</p>
<pre><code>mat_row.shape, mat_col.shape
# ((3000, 2000), (3000, 2000))
nearest_neighb_x.shape, nearest_neighb_y.shape
# (2040,) (2040,)
</code></pre>
<p>The idea is to perform a lookup for unique values of <code>nearest_neighb_x</code> and <code>nearest_neighb_y</code> existing in <cod... | <python><numpy><numpy-ndarray> | 2023-08-31 14:02:34 | 0 | 2,518 | Arun |
77,016,585 | 4,575,197 | multiply and summing same named columns based on name in 2 different DF pandas python | <p>it's easy to multiply 2 columns, but some how my code returns NAN that i don't understand.</p>
<p>so i have these columns in df2 that have the same name also in df1. my goal was to multiply and then sum them together.</p>
<pre><code>df1.columns=['ISIN', 'DSCD', 'GEOGN', 'SIC', 'GEOGC', 'COMMONSHARESOUTSTANDING',
... | <python><pandas> | 2023-08-31 14:02:25 | 1 | 10,490 | Mostafa Bouzari |
77,016,505 | 2,178,942 | Converting pandas to multiple dictionaries | <p>I have a pandas dataset that looks like this:</p>
<pre><code>check_d = pickle.load(a_file)
</code></pre>
<p><a href="https://i.sstatic.net/Mb1jp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Mb1jp.png" alt="enter image description here" /></a></p>
<p>when I type:</p>
<pre><code>check_d["conv2&q... | <python><python-3.x><pandas><dictionary><pickle> | 2023-08-31 13:53:03 | 2 | 1,581 | Kadaj13 |
77,016,386 | 10,232,932 | Running the same function several times for a filtered dataframe in python | <p>I have a pandas dataframe df:</p>
<pre class="lang-none prettyprint-override"><code>TypeA TypeB timepoint value
A AB 1 10
A AB 2 10
A AC 1 5
A AC 2 15
A AC 3 10
...
D DB 1 1
D DB 2 1
</code></pre>
<p>How c... | <python><pandas><dataframe> | 2023-08-31 13:38:25 | 0 | 6,338 | PV8 |
77,016,334 | 2,595,216 | New way of dark mode in PyQt6/PySide6 | <p>There is 'old' way of setting dark mode in PyQt6/Pyside6 answered here: <a href="https://stackoverflow.com/questions/73060080/how-do-i-use-qt6-dark-theme-with-pyside6">How do I use QT6 Dark Theme with PySide6?</a></p>
<p>But I found official Qt blog post <a href="https://www.qt.io/blog/dark-mode-on-windows-11-with-q... | <python><pyside6><pyqt6> | 2023-08-31 13:32:51 | 2 | 553 | emcek |
77,016,167 | 2,641,825 | How to install Jupyter Lab on Debian 12 bookworm? | <ul>
<li><p>In Debian 11 I had installed jupyter lab with pip in my user directory, but on Debian 12 this is not possible anymore since <a href="https://www.debian.org/releases/stable/i386/release-notes/ch-information.en.html#python3-pep-668" rel="nofollow noreferrer">Debian decided to follow pep-668</a> and python pac... | <python><debian><jupyter-lab> | 2023-08-31 13:15:09 | 1 | 11,539 | Paul Rougieux |
77,016,149 | 4,239,879 | Mock a class method before making an object of that class in setUp | <p>How can I use mock to avoid executing the <code>some_thing</code> method of <code>Settings</code> class and make it return some arbitrary string?</p>
<p>My class:</p>
<pre><code>class Settings():
"""
Represents settings. Will read the settings file if available.
If not: will create it with... | <python><mocking><integration-testing> | 2023-08-31 13:13:06 | 1 | 2,360 | Ivan |
77,016,132 | 8,913,316 | Import from another file inside the same module and running from a main.py outside the module throws an import error | <p>Given the following tree:</p>
<pre><code>├── main.py
└── my_module
├── a.py
├── b.py
└── __init__.py
</code></pre>
<p>a.py:</p>
<pre><code>def f():
print('Hello World.')
</code></pre>
<p>b.py:</p>
<pre><code>from a import f
def f2():
f()
if __name__ == '__main__':
f2()
</code></pre>
<p>main... | <python> | 2023-08-31 13:09:43 | 2 | 388 | Keredu |
77,016,079 | 10,909,217 | Construct filtering expression based on lexicographical ordering | <p>I have a dataset with integer columns for <code>'year'</code>, <code>'month'</code> and <code>'day'</code>.</p>
<p>For a given <code>start_date</code> and <code>end_date</code> (pandas Timestamps), I want to build an expression to filter for all the rows between these dates.</p>
<p>I have the following working solut... | <python><pyarrow> | 2023-08-31 13:01:42 | 1 | 1,290 | actual_panda |
77,016,033 | 11,329,736 | Snakemake ignores custom number of threads | <p>For all of my rules in my snakefile, <code>snakemake</code> ignores the number of threads that I set:</p>
<pre><code>rule trim:
input:
r1="reads/{sample}_R1.fastq.gz",
r2="reads/{sample}_R2.fastq.gz",
output:
multiext("trimmed/{sample}",
&quo... | <python><snakemake> | 2023-08-31 12:55:44 | 1 | 1,095 | justinian482 |
77,015,931 | 13,023,647 | Get data from ICMP package | <p>Could you tell me please, get more detailed information about the ICMP packet?
Right now I'm using some code construction:</p>
<pre><code>import scapy.layers.inet
from scapy.all import *
def gettingDataFromICMPTraffic(pkt):
if pkt.haslayer(scapy.layers.inet.ICMP):
type_8 = pkt.getlayer(scapy.layers.ine... | <python><python-3.x><scapy><icmp> | 2023-08-31 12:42:47 | 1 | 374 | Alex Rebell |
77,015,800 | 3,274,630 | Why does Python's rstrip remove more characters than expected? | <p>According to the docs the function will strip that sequence of chars from the right side of the string.<br />
The expression <code>'https://odinultra.ai/api'.rstrip('/api')</code> should result in the string <code>'https://odinultra.ai'</code>.</p>
<p>Instead here is what we get in Python 3:</p>
<pre><code>>>&... | <python><string><strip> | 2023-08-31 12:23:08 | 1 | 448 | Corneliu Maftuleac |
77,015,775 | 8,671,089 | TypeError: 'NoneType' object is not iterable while reading list in python | <p>I am trying to write a function which gets all the elements from list to another list, but sometimes my list can be None. I tried below code with checking if not None.
Does anyone know how to do this? Thanks in advance.</p>
<pre><code>from typing import List
fruits = ["lemon", "pear", "wate... | <python> | 2023-08-31 12:19:58 | 1 | 683 | Panda |
77,015,717 | 4,451,315 | too-many-args for union of callables | <p>If I run mypy on</p>
<pre class="lang-py prettyprint-override"><code>from typing import Callable
a: Callable[[str, str], str] | Callable[[str], str]
a('a', 'b')
</code></pre>
<p>then I get</p>
<pre class="lang-py prettyprint-override"><code>main.py:5: error: Too many arguments [call-arg]
</code></pre>
<p>But, why... | <python><mypy><python-typing> | 2023-08-31 12:11:00 | 0 | 11,062 | ignoring_gravity |
77,015,563 | 5,374,161 | Amazon SES creds working with smtplib but not with boto3 | <p>I'm trying to send emails using <strong>Amazon SES</strong>. Created the roles and API keys and policies and tested it out using Python <code>smtplib</code>. Pasting the snippet below:</p>
<pre><code>import smtplib
fromaddr = "some@email.com"
toaddrs = "other@email.com"
msg = """... | <python><amazon-web-services><boto3><amazon-ses> | 2023-08-31 11:49:24 | 1 | 667 | Krishh |
77,015,464 | 4,461,239 | Adding EXIF GPS data to .jpg files using Python and Piexif | <p>I am trying to write a script that adds EXIF GPS data to images using Python. When running the below script, I am getting an error returned from the <code>piexif.dump()</code> as follows:</p>
<pre><code>(venv) C:\projects\geo-photo>python test2.py
Traceback (most recent call last):
File "C:\projects\geo-ph... | <python><exif><piexif> | 2023-08-31 11:36:26 | 2 | 967 | Mike Resoli |
77,015,435 | 3,595,907 | What is causing this memory usage increase? | <p>I have code that reads in a sensor data file & outputs a series of spectrograms augmented with added noise. The problem I'm running into is that memory usage is increasing on every iteration of the spectrogram generation loop, until eventually I run out of memory.</p>
<p>In the picture below you can clearly see ... | <python><numpy><matplotlib><spectrogram> | 2023-08-31 11:32:30 | 0 | 3,687 | DrBwts |
77,015,204 | 2,223,661 | transform pandas data-frame grouping records on one col and counting frequencies of few other cols and making them as new cols | <p>Let's say we have this data-frame below:</p>
<pre><code>userid concessions reason contact date
1 0 aaa call
1 0 aaa chat
1 1 bbb call 01-01-1990
1 0 ccc mail
1 1 aaa ... | <python><pandas><dataframe> | 2023-08-31 10:59:14 | 3 | 509 | Mariners |
77,014,920 | 3,616,293 | Compute closest neghtbor between 2 numpy arrays - KDTree | <p>I have 2 numpy arrays: a (smaller) array consisting of int values, b (larger) array consisting of float values. The idea is that b contains float values which are close to some int values in a. For example, as a toy example, I have the code below. The arrays aren't sorted like this and I use np.sort() on both a and ... | <python><arrays><numpy><nearest-neighbor> | 2023-08-31 10:16:46 | 1 | 2,518 | Arun |
77,014,641 | 17,082,611 | Is there any difference between this keras script and my python class? | <p>I am wondering whether there is any difference between this Keras script:</p>
<pre><code>latent_dim = 2
latent_inputs = keras.Input(shape=(latent_dim,))
x = layers.Dense(7 * 7 * 64, activation="relu")(latent_inputs)
x = layers.Reshape((7, 7, 64))(x)
x = layers.Conv2DTranspose(64, 3, activation="relu&q... | <python><machine-learning><keras> | 2023-08-31 09:40:55 | 1 | 481 | tail |
77,014,640 | 1,852,526 | Trying to parse xml throws FileNotFoundError | <p>I am new to Python and all I am doing is parsing a simple XML string. But when I do that, it says 'No such file or directory' at Et.parse. I also tried saying <code>Et.parse(Et.fromstring(xmlfile))</code> but still that leads to a slightly different exception.</p>
<p><a href="https://i.sstatic.net/gDTBY.png" rel="no... | <python><xml><elementtree> | 2023-08-31 09:40:51 | 4 | 1,774 | nikhil |
77,014,538 | 1,833,326 | Databricks-Connect: Missing sparkContext | <p>I have issues using the newest version of databricks-connect (13.3.0). I would like to access the sparkContext and tried it as it worked for databricks-connect<13.0:</p>
<pre><code>from databricks.connect import DatabricksSession
spark = DatabricksSession.builder.getOrCreate()
spark.sparkContext
</code></pre>
<p>... | <python><apache-spark><pyspark><databricks><databricks-connect> | 2023-08-31 09:27:56 | 1 | 1,018 | Lazloo Xp |
77,014,471 | 10,353,865 | An indexer that gets should return a copy | <p>In order to decide as to whether some operations return a copy or a view, I consulted the posts to the question: <a href="https://stackoverflow.com/questions/23296282/what-rules-does-pandas-use-to-generate-a-view-vs-a-copy">What rules does Pandas use to generate a view vs a copy?</a></p>
<p>It reads as follows:</p>
... | <python><pandas> | 2023-08-31 09:19:26 | 0 | 702 | P.Jo |
77,014,428 | 7,069,126 | What is the meaning of a `files` key in poetry.lock? | <p>I just installed a newer version of a package in a poetry project. Now, for every package listed in the <code>poetry.lock</code> file, there's an added <code>files</code> key, like this:</p>
<pre class="lang-ini prettyprint-override"><code>[[package]]
name = "..."
version = "..."
files = [
{.... | <python><python-poetry> | 2023-08-31 09:14:09 | 1 | 2,764 | Tobias Feil |
77,014,360 | 2,123,099 | PostgreSQL Procedure using python write dataframe to table | <p>I am developing a PostgreSQL Procedure using the plpython3u extension which let you use python procedural language into PostgreSQL.</p>
<p>With the following code using plpy, I am able to retrive data form table and put it into pandas dataframe.</p>
<pre><code>CREATE OR REPLACE PROCEDURE public.plpy_proc_clas_full(
... | <python><sql><postgresql><procedure><plpython> | 2023-08-31 09:04:02 | 2 | 1,502 | Stavros Koureas |
77,014,292 | 5,437,090 | Merge multiple dictionaries using unique keys | <p>Given three
dictionaries as follows <code>{key: index}</code>:</p>
<pre><code>d1 = {'a':0, 'b':1,'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7, 'i':8, 'j':9, 'k':10, 'l':11, 'm':12, 'n':13, 'o':14}
d2 = {'k':0, 'l':1,'m':2, 'n':3, 'o':4, 'p':5, 'q':6, 'r':7, 's':8, 't':9, 'u':10, 'v':11, 'w':12}
d3 = {'a':0, 'b':1,'c':2,... | <python><performance> | 2023-08-31 08:55:28 | 3 | 1,621 | farid |
77,014,174 | 3,338,256 | Flask OSError: [Errno 5] Input/output error when creating zip of a folder and sending as a response | <p>I have an endpoint in flask application which downloads a folder by creating zip of it and sending it in the response. Here is the code for it</p>
<pre><code>def download_data(zip_file_name):
current_time = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
shutil.make_archive(zip_file_name + current... | <python><flask> | 2023-08-31 08:40:17 | 0 | 566 | Prakash |
77,014,017 | 16,577,671 | Better readable labels in pygal | <p>I would like to visualize data with Pygal for this I have to use a radar, unfortunately the X-axis labels have very long labels, which leads to the fact that it becomes difficult to read and the labels are cut off (see picture). <a href="https://i.sstatic.net/8ddmg.png" rel="nofollow noreferrer"><img src="https://i.... | <python><radar-chart><pygal><spider-chart> | 2023-08-31 08:18:32 | 1 | 1,102 | ChsharpNewbie |
77,013,954 | 4,402,431 | How to write a file and then delete it | <p>I am a C# programmer and need to go for python now. It is my 2nd day so far.
I need to write a file, read it and then delete it.
In C# that's easy peasy.</p>
<pre><code>string strPath = @"C:\temp\test.txt";
using (StreamWriter writer = new StreamWriter(strPath))
{ writer.WriteLine("XYZ");}
strin... | <python><file><readfile><delete-file><writefile> | 2023-08-31 08:09:44 | 3 | 2,623 | Patrick |
77,013,746 | 13,994,829 | How to release memory correctly in streamlit app? | <p>Recently, while developing a Streamlit app, the app frequently crashes and requires manual rebooting.</p>
<p>After spending some time, I identified the issue as <strong>"exceeding RAM"</strong>. The free version of RAM is only 1GB, and my app easily surpasses this limit when multiple users are using it sim... | <python><memory><streamlit><langchain> | 2023-08-31 07:41:10 | 1 | 545 | Xiang |
77,013,491 | 16,383,578 | How to compare a three dimensional array with a two dimensional array in NumPy? | <p>I have a three-dimensional array of shape <code>(height, width, 3)</code>, it represents an BGR image, the values are floats in [0, 1].</p>
<p>After some operation on the pixels I obtain a two-dimensional array of shape <code>(height, width)</code>, the values in the array are the results of some operation performed... | <python><arrays><numpy> | 2023-08-31 07:00:58 | 2 | 3,930 | Ξένη Γήινος |
77,013,454 | 3,179,698 | python cross platform download all the files(not all needed so unwanted) | <p>Hi I want to download linux version package in windows env.(install on offline linux-server)</p>
<p>I used the command:</p>
<pre><code>pip download --only-binary=:all: --platform linux_x86_64 --python-version 36 hyperopt
</code></pre>
<p>to download package hyperopt and its dependencies to install it on linux env of... | <python><pip><python-wheel> | 2023-08-31 06:55:51 | 1 | 1,504 | cloudscomputes |
77,013,434 | 1,354,517 | Trying to run tensorflow graphics home page demo from comamnd line throws an error | <p>I am a bit of a ML / TF / Python noob but have made good progress. i.e. can train basic models and use for inference with TF 2.13 - non gpu version.</p>
<p>While trying to run the example here - <a href="https://www.tensorflow.org/graphics" rel="nofollow noreferrer">TensorFlow Graphics</a> , I am encoutering an erro... | <python><tensorflow><tensorflow2.0> | 2023-08-31 06:51:57 | 0 | 1,117 | Gautam |
77,013,254 | 2,038,089 | Print uid to screen/browser in Python | <p>I'm currently testing mod_wsgi, and trying to print my uid to screen in my browser.</p>
<pre><code>import os
uid = os.getuid()
print("uid being used:", uid)
def application(environ, start_response):
status = '200 OK'
output = b'Hello World!'
response_headers = [('Content-type', 'text/plain'... | <python><apache><mod-wsgi> | 2023-08-31 06:18:49 | 1 | 382 | Ahmad Bilal |
77,013,226 | 4,958,156 | Using Python multiprocessing Process and Queue to abort function | <p>I have a function called <code>some_function(a,b)</code> which takes in two parameters a and b, and does something intensive, and then stores a Spark dataframe as an output. I want to put a timeout on some_function -> if it takes longer than 5 mins (300 seconds), I want to abort, and move to the next 'i' in the m... | <python><apache-spark><multiprocessing><python-multiprocessing> | 2023-08-31 06:13:46 | 1 | 1,294 | Programmer |
77,013,196 | 5,561,472 | Error: DocumentSnapshot.get() got an unexpected keyword argument 'transaction' | <p>I need to update the documents in collection. But I would like to run transaction for every document:</p>
<pre class="lang-py prettyprint-override"><code>async def example():
@google.cloud.firestore.async_transactional
async def update_in_transaction(transaction, city_ref, data):
snapshot = await cit... | <python><asynchronous><google-cloud-firestore> | 2023-08-31 06:09:41 | 1 | 6,639 | Andrey |
77,013,101 | 6,729,591 | Going through model's each layer individually gives other result than using forward | <p>I want to tinker with some intermediate layer result from a pretrained resnet. I noticed a drop in accuracy when just iterating over the layers of a specific block. Upon further inspection I saw that the intermediate results change if i iterate or use the builtin forward function.</p>
<pre class="lang-py prettyprint... | <python><machine-learning><deep-learning><pytorch> | 2023-08-31 05:44:09 | 1 | 1,404 | Dr. Prof. Patrick |
77,012,862 | 16,220,410 | why are even numbers retained in list x? | <p>i found this code and i am just confused why are the even numbers retained in <strong>list x</strong> when the remove method is at the top of the for loop, i tried to print the list for each iteration and it shows the first iteration is 1, gets removed from x then appended to y, but the next iteration of i is now 3 ... | <python><for-loop> | 2023-08-31 04:32:52 | 1 | 1,277 | k1dr0ck |
77,012,845 | 2,954,547 | Select and/or deselect tests that use a particular fixture? | <p>I see that there are some questions about conditionally <em>skipping</em> tests with certain fixtures: <a href="https://stackoverflow.com/q/46852934/2954547">Is there a way to skip a pytest fixture?</a> and <a href="https://stackoverflow.com/q/70956586/2954547">Skip tests using a particular pytest fixture</a>.</p>
<... | <python><pytest> | 2023-08-31 04:25:09 | 2 | 14,083 | shadowtalker |
77,012,820 | 4,156,036 | Multithreaded i += 1 has different behavior between Windows and Linux? | <pre><code>import threading
BASE = 1000000
i = 0
def test():
global i
for x in range(BASE):
i += 1
threads = [threading.Thread(target=test) for t in range(10)]
for t in threads:
t.start()
for t in threads:
t.join()
assert i == BASE*10, (BASE*10, i)
</code></pre>
<p>The code above can alway... | <python><multithreading> | 2023-08-31 04:19:31 | 1 | 695 | Lane |
77,012,813 | 5,046,887 | Recursive tracing issue when using opentelemetry-instrumentation-psycopg2 with psycopg2 | <h3>Problem Description</h3>
<p>When I used the <code>opentelemetry-instrumentation-psycopg2</code> library with <code>psycopg2's ThreadedConnectionPool</code>, I encountered a recursion issue. This problem seems to occur with some probability when concurrency is involved, so I decide the reproduce this issue.
<a href=... | <python><concurrency><psycopg2><trace><open-telemetry> | 2023-08-31 04:15:34 | 1 | 1,417 | Changemyminds |
77,012,451 | 4,362,655 | How can I have callbacks for Plotly Dash in different directories while using flask | <p>I have done flask integration with Dash (credit to <a href="https://github.com/jimmybow/Flask_template_auth_with_Dash" rel="nofollow noreferrer">source</a>) with file structure as below...</p>
<pre><code>/<main_app>
|
|
- <app>
| |-----__init__.py
|
- <dashboard>
... | <python><flask><plotly><plotly-dash> | 2023-08-31 02:04:02 | 1 | 1,575 | LuckyStarr |
77,012,324 | 22,474,322 | django-avatar // not enough values to unpack (expected 2, got 1) | <p><a href="https://django-avatar.readthedocs.io/en/latest/" rel="nofollow noreferrer">https://django-avatar.readthedocs.io/en/latest/</a></p>
<p>Django returns "not enough values to unpack (Expected 2, got 1) when trying to open this html template:</p>
<pre><code>{% extends 'base.html' %}
{% load account %} {% lo... | <python><html><django><django-templates> | 2023-08-31 01:11:27 | 1 | 325 | Pedro Santos |
77,012,307 | 17,653,423 | How to convert a pd.Series of dict to pd.Series of string? | <p>How to convert the Series of dictionary below to a Series of strings.</p>
<pre><code>import pandas as pd
dicts = {1: [{"id1":"result1", "name1":"result1"}], 2: [{"id2":"result2", "name2":"result2"}]}
# create test dataframe
df = pd.Data... | <python><pandas><dataframe> | 2023-08-31 01:03:40 | 2 | 391 | Luiz |
77,012,192 | 9,554,172 | How to put an enrich policy in elasticsearch when python package doesn't match documentation | <p>I'm trying to place a simple enrich policy onto elasticsearch before its corresponding ingest pipelines. The issue I have is when I execute:</p>
<pre><code> if enrich_policies:
for i, (name, body) in enumerate(enrich_policies.items()):
result = es.enrich.get_policy(name=name)
... | <python><elasticsearch> | 2023-08-31 00:15:56 | 1 | 881 | Lacrosse343 |
77,012,106 | 22,474,322 | Django Allauth - ModuleNotFoundError: No module named 'allauth.account.middleware' even when django-allauth is properly installed | <p>"ModuleNotFoundError: No module named 'allauth.account.middleware'"</p>
<p>I keep getting this error in my django project even when django-allauth is all installed and setup???</p>
<p>I tried even reinstalling and changing my python to python3 but didn't change anything, can't figure out why all other impo... | <python><python-3.x><django><django-allauth><django-settings> | 2023-08-30 23:39:49 | 3 | 325 | Pedro Santos |
77,012,002 | 8,171,079 | Unexpected behaviour when using put with multidimensional Numpy array | <p>I have an array <code>A</code> defined as:</p>
<pre><code>[[0, 0],
[0, 0]]
</code></pre>
<p>I have a list <code>I</code> containing indices of <code>A</code>, for example <code>[(0, 1), (1, 0), (1, 1)]</code>, and a list <code>v</code> with as many values as in <code>I</code>, for example <code>[1, 2, 3]</code>. I ... | <python><numpy> | 2023-08-30 23:04:05 | 3 | 377 | user8171079 |
77,011,837 | 10,789,707 | How to get all the values of 2nd loop output into the 3rd loop end_idx variable? | <p>This question may have been already answered but after much time searching SO and the net I did not find a suitable answer.</p>
<p>I have 3 consecutive loops as follows:</p>
<pre><code> w = my_text0.get(1.0, END).split()
data = []
# get & set the matching dict keys and values
for i in w:
... | <python><python-3.x><for-loop><tkinter><nested-loops> | 2023-08-30 22:16:44 | 1 | 797 | Lod |
77,011,809 | 14,509,604 | Debian 11 : pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available | <p>I've installed Python 3.11 in Debian 11 but after installing when I want to use <code>pip3.11</code> with any package it throws the warning: <code>pip is configured with locations that require TLS/SSL, however the SSL module in Python is not available</code> and fails to download.</p>
<p>I've done</p>
<pre><code>cd ... | <python><ssl><installation><pip><pyenv> | 2023-08-30 22:11:25 | 0 | 329 | juanmac |
77,011,769 | 880,783 | Can I @override the following @overloaded Python function? | <p>The PySide6 function <code>QComboBox.addItem</code> is type-hinted, in <code>QtWidgets.pyi</code>, like this:</p>
<pre class="lang-py prettyprint-override"><code>@overload
def addItem(self, icon: Union[PySide6.QtGui.QIcon, PySide6.QtGui.QPixmap], text: str, userData: Any = ...) -> None: ...
@overload
def addItem(... | <python><overriding><overloading><mypy><typing> | 2023-08-30 22:02:36 | 1 | 6,279 | bers |
77,011,731 | 1,113,159 | python3 plotly timeline gant diagram customdata for every bar | <p>I am trying to use dash + plotly to create a horizontal time line diagram.
Several actors are working on shared resources in some time slots.
I would like to visualize with horizontal bars work process of every actor.
But in the hover on each horizontal bar I would like to see the resource that this actor is working... | <python><plotly><visualization> | 2023-08-30 21:53:17 | 1 | 645 | user1113159 |
77,011,713 | 217,332 | Is there any way to decorate a class such that the resulting class's supertypes are known to the typechecker? | <p>I'd like to be able to write a class decorator that returns classes of a given base type <code>B</code> regardless of the input class, such that I can then use the decorated classes as objects of type <code>B</code>.</p>
<p>I've done something like this:</p>
<pre><code>T = TypeVar("T")
class Base:
pas... | <python><python-3.8><python-typing> | 2023-08-30 21:50:24 | 0 | 83,780 | danben |
77,011,692 | 12,311,071 | Override the usage of calling an enum class in Python | <p>I have what is probably a very obscure problem.
My python script is intended to be ran from the command line with some command line arguments.
Each argument needs to be parsed into a type more useful than a string. I am doing the following:</p>
<pre class="lang-py prettyprint-override"><code>typed_arguments = []
for... | <python><enums><command-line-arguments> | 2023-08-30 21:46:05 | 0 | 314 | Harry |
77,011,575 | 1,028,560 | Deploying python docker images on AKS gives "exec /usr/bin/sh: exec format error" | <p>I'm trying to deploy a docker container with a python app to Azure Kubernetes Service. After deploying and looking at the logs on the new pod, I see this error:</p>
<blockquote>
<p>exec /usr/bin/sh: exec format error</p>
</blockquote>
<p>I'm building the container on a mac using the following docker buildx command:<... | <python><azure><docker><kubernetes> | 2023-08-30 21:19:32 | 1 | 1,595 | Sanjeev |
77,011,529 | 9,415,280 | TensorFlow Probability inference error input type | <p>I train a model using tensorflow_probability and distributions.</p>
<p>To train it I format my data like this (2 heads model so 2 inputs set):</p>
<pre><code>input_1 = tf.data.Dataset.from_tensor_slices(Xdata)
input_2 = tf.data.Dataset.from_tensor_slices(Xphysio)
output = tf.data.Dataset.from_tensor_slices(yobs)
com... | <python><tensorflow><machine-learning><tensorflow-datasets><tensorflow-probability> | 2023-08-30 21:08:53 | 1 | 451 | Jonathan Roy |
77,011,490 | 2,223,106 | Loop through module and run inspect.getdoc() on each method | <p>I can print a list of all the builtins:</p>
<pre><code>for i, b in __builtins__.__dict__:
print(i, b)
__name__
__doc__
__package__
__loader__
__spec__
__build_class__
__import__
abs
all
any
ascii
...
</code></pre>
<p>Then <code>import inspect</code> and <code>inspect.getdoc(<some_module>)</code>.</p>
<p>F... | <python><python-3.x><introspection> | 2023-08-30 21:00:51 | 1 | 6,610 | MikeiLL |
77,011,448 | 1,506,763 | Why is Jitted Numba function slower than original function? | <p>I've written a function to create uniformly spaced points on a disk and since it's run quite often and on relatively large array I figured the application of <code>numba</code> would increase the speed significantly. However, upon running a quick test I've found that the <code>numba</code> function is more than twic... | <python><numpy><performance><numba> | 2023-08-30 20:51:23 | 1 | 676 | jpmorr |
77,011,313 | 5,431,734 | how to build a package and include dependencies conditional on os | <p>I am trying to build a package that depending on the os of the target machine will include an extra package. More specifically my application depends on <code>redis</code> however when the machine where the package is going to be deployed to runs linux, I would like to have <code>redis-server</code> as an extra depe... | <python><redis><setuptools> | 2023-08-30 20:22:41 | 0 | 3,725 | Aenaon |
77,011,280 | 2,318,409 | python installation moved, pip stopped working | <p>I had Python 3.6 on my Windows machine under "C:\Program Files"
I wanted to upgrade it to 3.11.
Installer completed successfully, but new version was installed not in program files, but in "C:\Users\myname\AppData\Local\Programs\Python\Python311".</p>
<p>I moved Python311 directory to the "C... | <python><pip> | 2023-08-30 20:16:55 | 1 | 596 | Gary Greenberg |
77,011,220 | 4,865,723 | Text in QLabel do not increase the QDialog | <p>This problem is an example to improve the understanding of layout and size policy.
In this example code I do set the width of a <code>QDialog</code> to a minimum and maximum. This works. I don't touch the height of the dialog.</p>
<p>The problem is that the text in a <code>QLabel</code> is to much to fit into the di... | <python><qt><pyqt> | 2023-08-30 20:03:29 | 1 | 12,450 | buhtz |
77,011,196 | 5,240,684 | Random selection from list avoiding a given element (negative sampling) | <p>I have a list of item pairs, where each item is indexed by a numeric id.</p>
<p>E.g.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>item_1</th>
<th>item_2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
... | <python><pandas><numpy> | 2023-08-30 19:58:57 | 3 | 1,057 | Lukas Hestermeyer |
77,011,176 | 3,973,175 | How to extend plot area to keep text inside of plot area without clipping | <p>I have a plot with a long text string that was inserted (string not determined by me, so I can't shorten it):</p>
<pre><code>import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
lines = [[(0, 1), (1, 1)], [(2, 3), (3, 3)], [(1, 2), (1, 3)]]
z = [1, 2, 3]
lc = LineCollection(lines, arra... | <python><matplotlib><plot-annotations> | 2023-08-30 19:55:17 | 0 | 6,227 | con |
77,011,152 | 5,305,242 | Python regex ignores first occurrence | <p>Attempting to ignore first and third occurrence of match and replace all date information. Here is trails which is not working.</p>
<pre><code>Input = '''
Captured on: 08-29-2023 09:43:26
Start Time: 08-28-2023 11:11:57
1St Cycle Time: 08-28-2023 11:12:06
Channel-00 Cycles Completed: 4404
Channel-00 Triggered Tim... | <python><regex> | 2023-08-30 19:50:58 | 3 | 458 | OO7 |
77,010,734 | 843,458 | python append list creates list of lists instead of one list | <p>I want to get a list of all images files.</p>
<pre><code>imageExtensionList = ['jpg', '.arw', '.tif', 'mp4']
fileList = []
for extension in imageExtensionList:
searchStr = str(importPath) + '/**/*.' + extension
files = glob.glob(searchStr, recursive=True)
fileList.append(files)
</code></pre>
<p>This howe... | <python><list> | 2023-08-30 18:42:04 | 1 | 3,516 | Matthias Pospiech |
77,010,717 | 1,115,833 | How to convert a string list of unquoted string entries to a list in Python? | <p>I have a bizzare problem where I am reading a csv file with entries like so:</p>
<pre><code>4,[the mentalist, dodgeball, meet the fockers]
5,[godfather, the heat, friends]
...
</code></pre>
<p>I read this python using the csv module, and normally Id do:</p>
<pre><code>import ast
x=ast.literal_eval(row[1])
</code></p... | <python><python-3.x><csv> | 2023-08-30 18:39:00 | 1 | 7,096 | JohnJ |
77,010,712 | 820,088 | Group Range of Rows in Excel uisng Python Win32com | <p>I am attempting to group a range of rows in Excel using the win32com python api for Excel Objects. I can't seem to get it to work. My code is as follows:</p>
<pre class="lang-py prettyprint-override"><code> excel = win32com.client.gencache.EnsureDispatch("Excel.Application")
excel.Workbooks.Open(r&q... | <python><excel><win32com><group> | 2023-08-30 18:38:30 | 2 | 4,435 | Mike |
77,010,708 | 1,015,703 | SQLAlchemy 2.0 - Error when using "stringified" forward reference to models in separate files | <p>I want to put each of my SQLAlchemy models in a separate file, in a "models" package. Because of circular reference problems, I am trying to use the "stringified" forward reference trick.</p>
<p>Here's the code in the "models" package:</p>
<pre class="lang-py prettyprint-override"><cod... | <python><sqlalchemy> | 2023-08-30 18:37:11 | 0 | 1,625 | David H |
77,010,396 | 2,153,235 | Getting pyreadline3.Readline's history working with Python 3.9 | <p>I am following <a href="https://stackoverflow.com/a/7008316/2153235">this
Q&A</a>'s procedure for
accessing Python's REPL command history -- specifically at the Conda
prompt, not in an IDE.</p>
<p>I am using Python 3.9 installed under Anaconda on Windows 10. Version
3.9 needed for backward compatibility with co... | <python><read-eval-print-loop><command-history> | 2023-08-30 17:46:00 | 1 | 1,265 | user2153235 |
77,010,245 | 10,237,558 | Batch names and send HTTP request using panda.Series and Spark UDF | <p>I have a column "names" and I want to create an HTTP POST request using these names in the payload.</p>
<pre><code># Create a Spark session
spark = SparkSession.builder.appName('SparkByExamples.com').getOrCreate()
bearerToken = 'abc'
records = []
def insert(names):
for name in names:
fields =... | <python><pandas><dataframe><apache-spark><pyspark> | 2023-08-30 17:22:59 | 1 | 632 | Navidk |
77,010,064 | 10,285,400 | How to get all content related to file attachment by hitting an Get API in Python | <p>I am trying to get all the information such as name, content of the file downloaded when I hit a GET API programmatically.</p>
<p><strong>Context :</strong></p>
<p>I have a GET API, whenever I hit that API from browser it automatically downloads the file into the system, I can see that file in filesystem. I would li... | <python><salesforce> | 2023-08-30 16:53:16 | 1 | 615 | Jakka rohith |
77,010,000 | 4,537,160 | Python, __init__ method of abstract class implicitly being called? | <p>I'm not too familiar with the use of abstract classes, so I'm trying to understand what is happening in some code I'm using at the moment.</p>
<p>In the code, I have a base dataset class, and some implementations of datasets inheriting from the main one, something like:</p>
<pre><code>class dataset(metaclass=abc.ABC... | <python><oop><abstract-class><abc> | 2023-08-30 16:44:24 | 1 | 1,630 | Carlo |
77,009,906 | 3,380,902 | pass a tuple as parameter to sql query | <pre><code>at_lst = ['131','132','133']
at_tup = (*at_lst,)
print(at_tup)
('131','132','133')
</code></pre>
<p>In my sql query, i am trying to pass this on a parameter, however, it doesn't work.</p>
<pre><code>%%sql
select * from main.schema.tbl
where code IN ( '{{ at_tup }}' )
</code></pre>
<p>This return no result... | <python><sql><jupyter-notebook><databricks> | 2023-08-30 16:30:09 | 1 | 2,022 | kms |
77,009,878 | 19,003,861 | Overriding LOGIN_REDIRECT_URL = "page-name" for a specific function in Django | <p>I have a base.py file that states a default redirection page when the user registers and gets logged in.</p>
<p><strong>base.py</strong></p>
<pre><code>LOGIN_REDIRECT_URL = "index"
</code></pre>
<p>I want to create to possibility for a user that connects from a specific page <code>page_1</code> to signup/l... | <python><django><django-views> | 2023-08-30 16:26:27 | 1 | 415 | PhilM |
77,009,864 | 1,028,270 | Is there any way to specify a parametrized test id inside the param set itself instead of as a separate array? | <p>We can use <code>ids=[]</code> to name the param sets:</p>
<pre><code>@pytest.mark.parametrize(
'a, b',
[
(1, {'Two Scoops of Django': '1.8'}),
(True, 'Into the Brambles'),
('Jason likes cookies', [1, 2, 3]),
(PYTEST_PLUGIN, 'plugin_template'),
], ids=[
'int and di... | <python><pytest> | 2023-08-30 16:24:11 | 1 | 32,280 | red888 |
77,009,843 | 13,371,454 | How to limit resources for airflow task or prevent execution of tasks which start spark jobs locally | <p>We administer Airflow cluster and different teams launch their DAGs on that cluster. These DAGs have to start very heavy spark jobs on many cores with hundreds Tb of RAM. Time-to-time someone launch these jobs in local mode on airflow node and it causes airflow go out of service. Is there any way to prevent launch o... | <python><apache-spark><airflow> | 2023-08-30 16:21:31 | 2 | 376 | Vladimir Shadrin |
77,009,691 | 18,125,313 | How to maximize the cache hit rate of the 2-element combinations? | <p>My question is simple, but I find it difficult to get the point straight, so please allow me to explain step by step.</p>
<p>Suppose I have <code>N</code> items and <code>N</code> corresponding indices.
Each item can be loaded using the corresponding index.</p>
<pre class="lang-py prettyprint-override"><code>def loa... | <python><algorithm><caching><combinations> | 2023-08-30 15:58:43 | 5 | 3,446 | ken |
77,009,676 | 8,434,663 | Why is a property on a subclass, that returns a type consistent with the same attribute on the superclass disallowed | <pre class="lang-py prettyprint-override"><code>class Foo:
bar: str
class Bat(Foo):
@property
def bar(self) -> str:
...
</code></pre>
<p>Given the above code, my typechecker (mypy) raises the following complaint:</p>
<pre><code>error: Signature of "bar" incompatible with supertype &quo... | <python><inheritance><python-typing><mypy> | 2023-08-30 15:56:51 | 1 | 1,657 | Josh |
77,009,539 | 3,406,455 | best format for saving images to disk so that the loading speed is fastest | <p>What is the best format to save images to disk so that the loading speed is fastest ?
I am guessing that <code>.JPG</code> format might be suboptimal, maybe some other format works better ?</p>
<p><em>my case:</em> I have some 9k <code>.JPG</code> images (large 8000x8000 images) and am loading them (using PIL for th... | <python><pytorch><python-imaging-library> | 2023-08-30 15:39:20 | 0 | 1,007 | AnarKi |
77,009,536 | 11,578,996 | Efficiently bin data in python | <p>I am trying to summarise a database of activity times by user id to give an array of event count per timeslot to show a summary of weekly behaviour. I have approx. 35k ids over 3M events covering 2y of time in a pandas dataframe. I have two event time columns and I want to combine them into the same output array.</... | <python><pandas><performance><loops><group-by> | 2023-08-30 15:38:59 | 1 | 389 | ciaran haines |
77,009,489 | 10,093,190 | How to convert a lists of integers to a string of the individual bytes? | <p>I'm trying to print a list of bytes to a file in hex (or decimal, doesn't really make a difference for the sake of the question I believe). I'm baffled by how hard this appears to be in Python?</p>
<p>Based on what I found <a href="https://stackoverflow.com/questions/19210414/byte-array-to-hex-string">here</a> (and ... | <python><python-3.x><string><list><hex> | 2023-08-30 15:32:21 | 5 | 501 | Opifex |
77,009,394 | 139,692 | Python -m Loading Site Package | <p>I have two packages installed via pip which are com.ziath.acacus and com.ziath.driver which install in 'dotted' packages. If I then write a module that imports these:</p>
<pre><code>from com.ziath.acacus.reader import GiSReader
from com.ziath.driver.Zebra2707 import Zebra2707
</code></pre>
<p>When I execute these u... | <python><setuptools> | 2023-08-30 15:21:56 | 0 | 946 | Neil Benn |
77,009,377 | 7,295,599 | How to reduce size of PyInstaller RDKit executable? | <p>In order to find duplicate chemical structures, I was writing a little Python script using RDKit (Win10, Python3.11.3, without (Ana)Conda).
The script seems to work, however, since I want to pass this script to someone who has no Python installation, I'm using <code>pyinstaller --onefile CheckSMILESduplicates.py</co... | <python><windows><pyinstaller><exe><rdkit> | 2023-08-30 15:19:47 | 0 | 27,030 | theozh |
77,009,361 | 217,332 | Type hints for classes with known supertype | <p>Using Python 3.8. I have the following stripped-down example that I haven't fully gotten to typecheck:</p>
<pre><code>class A(ABC):
property: str
def implemented(self, arg: str) -> None:
self.property = arg
@abstractmethod
def not_implemented(self, another_arg: int) -> int:
pass
def method... | <python><python-3.x><types><python-3.8> | 2023-08-30 15:17:53 | 1 | 83,780 | danben |
77,009,305 | 4,267,439 | pcolormesh quadrilateral alignment | <p>Looking at the <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.pcolormesh.html" rel="nofollow noreferrer">documentation</a>, <code>quadrilateral</code> should have X, Y coordinates on the lower-left corner, but I get them with X,Y as center point. How can I fix it? Everything seems to be shif... | <python><matplotlib> | 2023-08-30 15:11:50 | 2 | 2,825 | rok |
77,009,295 | 12,297,666 | Different DTW Distance in FastDTW and dtaidistance | <p>I just started reading about DTW, and decided to try two Python packages, <a href="https://github.com/slaypni/fastdtw" rel="nofollow noreferrer">fastdtw</a> and <a href="https://dtaidistance.readthedocs.io/en/latest/" rel="nofollow noreferrer">dtaidistance</a>.</p>
<p>Consider the case of a multiclass timeseries cla... | <python><dtw> | 2023-08-30 15:10:07 | 1 | 679 | Murilo |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.