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 ⌀ |
|---|---|---|---|---|---|---|---|---|
75,617,260 | 4,939,167 | How to wait till the job status api reaches to status = success in python based pytest test automation framework | <p>I have a problem statement as below -
I have a job status api which accepts <code>job_id</code> and start checking the status of the job.</p>
<p>The job statuses are as follows:</p>
<ol>
<li>In Queue.</li>
<li>In Progress.</li>
<li>Going to next queue.</li>
<li>Success in queue 2.</li>
<li>Job is completed successfu... | <python><python-requests><pytest> | 2023-03-02 15:02:24 | 1 | 352 | Ashu123 |
75,617,192 | 8,539,389 | List and manage Azure Resource Locks with Python SDK | <p>I am trying to list and loop through Azure Resource Locks of a resource group by using Python SDK.</p>
<pre><code> from azure.mgmt.resource.locks.v2016_09_01.aio import ManagementLockClient
management_lock_client = ManagementLockClient(credential, subscription.subscription_id)
locks = management_lock_clie... | <python><azure><for-loop><azure-resource-lock> | 2023-03-02 14:57:17 | 1 | 2,526 | MoonHorse |
75,617,107 | 10,270,590 | How to get a joined volume Python Virtual environment to Airflow Docker working with external_python_task? | <h1>GOAL</h1>
<ul>
<li>Have a local python environemnt that I can swap up and install things to it</li>
<li>withouth needing to build a new image -> stopping the runing container -> starting new container</li>
</ul>
<h1>DONE</h1>
<ul>
<li>I use the docker version of airflow 2.4.1</li>
<li>I have succesfully joine... | <python><docker><airflow><airflow-2.x> | 2023-03-02 14:48:51 | 0 | 3,146 | sogu |
75,616,989 | 17,696,880 | How to use re.sub(), or similar, to do replacements and generate raw strings without the metacharacters causing problems with the regex engine? | <pre class="lang-py prettyprint-override"><code>import re
personal_pronoun = "se les" #example 1
personal_pronoun = "se le" #example 2
personal_pronoun = "se le" #example 3
personal_pronoun = "les" #example 4
personal_pronoun = "le" #example 5
#re.m... | <python><python-3.x><regex><string><regex-negation> | 2023-03-02 14:40:17 | 0 | 875 | Matt095 |
75,616,893 | 5,688,175 | Reshaping a 3D array of shape (K, M, N) to 2D array of shape (n_rows * M, n_cols * N) with Numpy | <p>I was trying to reshape a 3D array/tensor <code>arr</code> of shape (K, M, N) in <code>numpy</code> (where each (M, N) subarray could be an image for instance) to a 2D of shape (n_rows * M, n_cols * N).</p>
<p>Obviously, I ensure <code>K = n_rows * n_cols</code> beforehand.</p>
<p>I tried all the possible permutatio... | <python><numpy><multidimensional-array><einops> | 2023-03-02 14:32:56 | 1 | 2,351 | floflo29 |
75,616,850 | 11,922,765 | VOLTTRON: `python3 bootstrap.py` Does not install all packages | <p>I am in the process of installing VOLTTRON on my raspberry Pi. I came across this <a href="https://www.youtube.com/watch?v=0zHG1p76GNs&list=TLGG8TyZC8fiYxMwMTAzMjAyMw&t=4s&ab_channel=PNNLUnplugged" rel="nofollow noreferrer">VOLTTON installation video</a> and followed the same steps. But my installation i... | <python><raspberry-pi><raspberry-pi4><volttron> | 2023-03-02 14:29:16 | 2 | 4,702 | Mainland |
75,616,740 | 4,950,019 | Upload Conversion Value Rules (Google Ads API) via python sdk / script? | <p>The (relatively) new Google Ads API offers <a href="https://developers.google.com/google-ads/api/docs/conversions/conversion-value-rules" rel="nofollow noreferrer">Conversion Value Rules</a> - but I am looking for some examples, resources, pointers ... of uploading them via the <a href="https://github.com/googleads/... | <python><google-ads-api><google-api-python-client> | 2023-03-02 14:21:57 | 0 | 581 | davidski |
75,616,635 | 1,014,217 | How to use Label Encoder in a dataframe which is nested in another dataframe | <p>My dataset is:</p>
<p><a href="https://www.kaggle.com/datasets/angeredsquid/brewers-friend-beer-recipes" rel="nofollow noreferrer">https://www.kaggle.com/datasets/angeredsquid/brewers-friend-beer-recipes</a></p>
<p>I loaded like this:</p>
<pre><code>import json
filename = 'recipes_full copy.json'
with open(filenam... | <python><pandas> | 2023-03-02 14:13:37 | 1 | 34,314 | Luis Valencia |
75,616,542 | 3,668,129 | How to set whisper.DecodingOptions language? | <p>I'm trying to run whisper and I want to set the <code>DecodingOptions</code>.language with France (instead of using it's language detection).</p>
<p>I have tried to write:</p>
<pre><code>options = whisper.DecodingOptions()
options.language = "fr"
</code></pre>
<p>but I'm getting error:</p>
<pre><code>Froze... | <python><deep-learning><openai-whisper> | 2023-03-02 14:05:31 | 1 | 4,880 | user3668129 |
75,616,325 | 12,913,047 | Calculating the number of '1's in a df | <p>I have the following df, illustrated as the matrix in the image, and I would like to count the number of 'correlated' squares which are equal to 1, and 'non correlated' which are equal to 0.</p>
<p>I have tried to use the df.count() function but it doesn't return the result I want, as in the totals of 1s and 0s.</p>... | <python><pandas> | 2023-03-02 13:48:51 | 3 | 506 | JamesArthur |
75,616,311 | 12,945,785 | Plotly add legend in hover graph | <p>i am doing a graph with Plotly library and I would like to add the name of the legend inside the hovertemplate. How can I do ?</p>
<pre><code>data = [go.Bar(name=col,
x=aum_annuel_classe.index.year,
y=aum_annuel_classe[col],
xhoverformat="%Y",
... | <python><plotly> | 2023-03-02 13:47:55 | 1 | 315 | Jacques Tebeka |
75,616,210 | 2,896,292 | Scipy FFT reduce bin count | <p>I have a waveform <code>sig</code> that I'd like to run an FFT on. The data is sampled at 40 kHz and I want to analyze a window of 25mS or 1000 points. Using <code>scipy.fft.rfft(sig)</code> I get a resulting waveform that has 500 values. I understand these values to be magnitudes that correspond to 500 frequency bi... | <python><python-3.x><numpy><scipy><fft> | 2023-03-02 13:39:34 | 1 | 315 | eh_whatever |
75,616,056 | 3,802,177 | What is the proper way to return data using HTTP-API(v2) + Lambda + DynamoDB as a JSON response? | <p>I used to use the REST API, but since v2 I find myself using it more.
Is there a proper way to return data "neatly" other than manipulating the database response before returning?
I used to use the model feature with REST (v1). What's the recommended way to do the same here?</p>
<p>Here's an example of wha... | <python><aws-lambda><amazon-dynamodb><aws-http-api><aws-api-gateway-v2> | 2023-03-02 13:26:11 | 1 | 5,946 | Imnotapotato |
75,615,836 | 120,457 | find one or more element in strings array in another strings array | <pre><code>first_array = ['aaa', 'eee']
second_array = ['aaa', 'bbb', 'ccc', 'ddd', 'eee']
</code></pre>
<p>In Python, I want to determine whether any of the elements from the first array (one or more) are present in the second array.</p>
<p>I attempted using subset and union, but it wasn't very effective. I dont want... | <python><python-3.x> | 2023-03-02 13:07:42 | 4 | 35,235 | joe |
75,615,690 | 7,797,210 | What's the syntax for web REST fastAPI GET function, and the request.get function where one of the input variable is List, or Numpy Array | <p>been driving me crazy with the syntax for the past week, so hopefully an enlightened one can point me out! I've traced these posts, but somehow I couldn't get them to work</p>
<p>I am looking to have an input variable where it is a list, and a numpy array; for feeding into a fastAPI get function, and then calling it... | <python><numpy><fastapi> | 2023-03-02 12:54:18 | 1 | 571 | Kiann |
75,615,599 | 3,191,747 | Django filter for ManyToMany items which exist only in a specified list | <p>I have the following:</p>
<pre><code>class Category():
category_group = models.ManyToManyField("CategoryGroup", blank=True, related_name="category_group")
class CategoryGroup():
label = models.TextField(null=True, blank=True)
categories = Category.objects.exclude(category_group__label_... | <python><django><postgresql> | 2023-03-02 12:46:24 | 1 | 506 | KvnH |
75,615,469 | 1,873,108 | Python & Visual studio code 2022 CMAKE ignored python search path | <p>I'm trying to compile some python cmake project but I hit a wall...
This is my example ></p>
<pre><code>set(PY_VERSION 37)
set(PY_EXE "C:/Program Files/Python37")
set(Python3_ROOT_DIR "C:/Program Files/Python37")
set(Python3_FIND_ABI "ON" "3" "7")
set(PYTHON_EXECU... | <python><c++><visual-studio><cmake> | 2023-03-02 12:32:47 | 0 | 1,076 | Dariusz |
75,615,438 | 9,077,457 | In python Is there a way to test if an object is in an enumerable, but in the sense of the "is" operator instead of the "==" operator? | <p>I'm displaying a data structure which is supposed to be a tree, but there might be some risks of infinite recursion if my tree if in reality a graph with cycles (That shouldn't happen, but I'm playing paranoid).</p>
<p>For this reason, I have created list of encountered nodes and I want to check if the current visit... | <python><operators><identity> | 2023-03-02 12:29:55 | 2 | 1,394 | Camion |
75,615,302 | 20,051,041 | Scrapy shell fetch response.css returns [] | <p>I am learning to scrape using scrapy. I would like to get some information about this medicine: <a href="https://www.apotheken-umschau.de/medikamente/beipackzettel/azithromycin-al-250-mg-filmtabletten-1805007.html" rel="nofollow noreferrer">https://www.apotheken-umschau.de/medikamente/beipackzettel/azithromycin-al-2... | <python><scrapy> | 2023-03-02 12:18:06 | 2 | 580 | Mr.Slow |
75,615,287 | 13,916,049 | Retain separate dataframe structure after feature selection on list of dataframes | <p>The <code>df</code> is a list of dataframes; <code>y</code> represents each dataframe. After feature selection, I want to retain the features in each dataframe <code>mut_fs</code>, <code>mirna_fs</code> as separate output.</p>
<pre><code>dfs = [mut, mirna, mrna_exp, meth, protein]
df = pd.concat(dfs)
dummies = pd.... | <python><pandas> | 2023-03-02 12:15:58 | 1 | 1,545 | Anon |
75,615,203 | 5,661,316 | Create a list of values from an existing list if values are nearby | <p>I have a list of dictionaries</p>
<pre><code>[{"Name": 'A', "Area": 10000, "Price": 100},
{"Name": 'B', "Area": 9500, "Price": 99},
{"Name": 'C', "Area": 11000, "Price": 101},
{"Name": 'D', "Area": 12000, &... | <python><list><loops><dictionary> | 2023-03-02 12:06:56 | 1 | 373 | sailestim |
75,614,858 | 14,594,208 | Is it possible to assign a Series to a DataFrame and use the Series' name as column name? | <p>Given a Series <code>s</code> like this:</p>
<pre class="lang-py prettyprint-override"><code>0 6
1 0
2 0
3 8
4 8
5 10
6 10
7 9
Name: my_series, dtype: int64
</code></pre>
<p>and given a <code>df</code>, would it be possible to assign the series to the <code>df</code> without having
to s... | <python><pandas> | 2023-03-02 11:31:51 | 3 | 1,066 | theodosis |
75,614,820 | 6,930,340 | Nested enums in Python | <p>I am trying to implement some kind of nested <code>Enum</code>.</p>
<pre><code>from dataclasses import dataclass
from enum import Enum
class VendorA(Enum):
"""Define price fields for VENDOR_A."""
OPEN: str = "px_open"
HIGH: str = "px_high"
LOW: str... | <python><enums> | 2023-03-02 11:28:48 | 1 | 5,167 | Andi |
75,614,728 | 21,117,172 | Cuda 12 + tf-nightly 2.12: Could not find cuda drivers on your machine, GPU will not be used, while every checking is fine and in torch it works | <ul>
<li><strong>tf-nightly version</strong> = 2.12.0-dev2023203</li>
<li><strong>Python version</strong> = 3.10.6</li>
<li><strong>CUDA drivers version</strong> = 525.85.12</li>
<li><strong>CUDA version</strong> = 12.0</li>
<li><strong>Cudnn version</strong> = 8.5.0</li>
<li>I am using <strong>Linux</strong> (x86_64, ... | <python><tensorflow><gpu> | 2023-03-02 11:19:35 | 11 | 592 | JaimeCorton |
75,614,708 | 8,900,445 | How to improve text similarity/classification performance when classes are semantically similar? | <p>I have an NLP classification problem whereby I want to match an input string (a question) to the most suitable string from a list of reference strings (FAQs), or abstain if confidence in a classification is low.</p>
<p>I have an existing function that uses <code>distilbert-base-uncased</code> embeddings and cosine s... | <python><nlp><huggingface-transformers><similarity><text-classification> | 2023-03-02 11:17:07 | 0 | 895 | cookie1986 |
75,614,647 | 3,348,261 | How to generate all pxq matrices with n values "1" with no columns or lines having two "1" (chess n-towers problem) | <p>I'm looking for a way to generate all matrices (p,q) having exactly n "1" value with no column or line having more than one "1" value (a kind of chess n towers problem).</p>
<p>Here is a simple example in python for p=4, q=4 and n=2:</p>
<pre><code>for i1 in range(4*4):
x1, y1 = i1//4, i1%4
... | <python><numpy> | 2023-03-02 11:12:23 | 1 | 712 | Nicolas Rougier |
75,614,430 | 11,130,088 | Override DOM style for Tabs, header level | <p>I have been trying to custom my Tab widget with css_class overriding with it with a style.css as I used to do without previous bokeh versions, although since the 3.0. the same approach does not work. I tried to use css_classes, styles, stylesheet and the only one that worked well was styles which I can pass a dictio... | <python><css><tabs><bokeh> | 2023-03-02 10:50:19 | 1 | 572 | ReinholdN |
75,614,405 | 1,935,611 | mypy indexing pd.DataFrame with an Enum raises no overload variant error | <h4>The issue</h4>
<p>Mypy gives no overload variant of <code>__getitem__</code> of "DataFrame" matches argument type "MyEnum" error. In this case the argument type is an Enum but the issue would occur for any other custom type. Here is the signature of <code>__get_item__</code> below.</p>
<pre><cod... | <python><pandas><mypy> | 2023-03-02 10:48:09 | 1 | 2,027 | anilbey |
75,614,368 | 3,668,129 | How to get the chunk times from pydub split_on_silence? | <p>I'm using <code>split_on_silence</code> to split a mp3 file to multiple segments:</p>
<pre><code>sound = AudioSegment.from_mp3(TEST_FILE)
audio_chunks = split_on_silence(sound, min_silence_len=300, keep_silence=50, silence_thresh=-40 )
</code></pre>
<p>Is it possible (How can I do it) to get the origin start-... | <python><pydub> | 2023-03-02 10:45:25 | 1 | 4,880 | user3668129 |
75,614,143 | 8,747,828 | 500: internal server error with Jupyter Notebook (nbconvert updated) | <p>I am getting a pretty well-documented error when trying to run a Jupyter Notebook from my Mac Monterey 12.3.1, the 500 internal server error.</p>
<p>This appears to be the problem:</p>
<p><code>ImportError: cannot import name 'contextfilter' from 'jinja2' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python... | <python><jupyter-notebook><nbconvert> | 2023-03-02 10:26:21 | 1 | 565 | hmnoidk |
75,614,029 | 2,036,464 | How to run Python code in the background of my web/html pages, directly on internet? | <p>is it possible to run Python code in the background of my web/html pages, directly on internet?</p>
<p>Suppose I made a code with shuffle words (mix words), and I want to make an html page that have that python code in the background, to run that page as an application. Everytime someone will access that page, Pytho... | <python><html><python-3.x> | 2023-03-02 10:15:51 | 1 | 1,065 | Just Me |
75,614,021 | 9,021,547 | Pandas dataframe mutability with loc method | <p>I am trying to understand the inticacies of using <code>loc</code> on a dataframe. Suppose we have the following:</p>
<pre><code>df = pd.DataFrame({'a':[1,2,3], 'b':[4,5,6]})
df2 = df.loc[:,'a']
df2.loc[0] = 10
print(df)
print(df2)
a b
0 10 4
1 2 5
2 3 6
0 10
1 2
2 3
Name: a, dtype: int64
... | <python><pandas><mutable> | 2023-03-02 10:14:53 | 1 | 421 | Serge Kashlik |
75,613,902 | 6,854,595 | How to implement a base method that performs validation based on the child generic type in Python | <p>I have a base Python (3.8) abstract base class, with two classes inheriting from it:</p>
<pre class="lang-py prettyprint-override"><code>BoundedModel = TypeVar("BoundedModel", bound=CustomBaseModel)
class BaseDataStore(ABC, Generic[BoundedModel]):
def __init__(self, resource_name: str) -> None:
... | <python><mypy><pydantic> | 2023-03-02 10:04:10 | 2 | 540 | alexcs |
75,613,896 | 4,576,519 | How to get the gradients of network parameters for a derivative-based loss? | <p>I have a network <code>y(x)</code> for which I have a given dataset <code>dy(x)</code>. That is, I know the derivative of <code>y</code> for a certain <code>x</code> but I do not know <code>y</code> itself. A minimal example of this is:</p>
<pre class="lang-py prettyprint-override"><code>import torch
# Define netwo... | <python><pytorch><gradient><backpropagation><automatic-differentiation> | 2023-03-02 10:03:46 | 1 | 6,829 | Thomas Wagenaar |
75,613,857 | 3,146,304 | Colab 'ascii' codec can't decode byte: ordinal not in range(128) with encoding="utf-8" | <p>I am struggling with an issue that I have only on Colab and not on my machine.
I am reading some JSON files and it throws a <code>UnicodeDecodeError</code>:</p>
<p><code>UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 418: ordinal not in range(128)</code></p>
<p>which is not totally surprising s... | <python><character-encoding><google-colaboratory> | 2023-03-02 09:59:49 | 1 | 389 | Vitto |
75,613,691 | 102,957 | Given a Flask app object, how can I obtain the templates folder absolute path? | <p>After initializing the app, I would like to determine the absolute path of the 'templates' folder (to read a yaml file located inside it).</p>
<pre><code>app = Flask(__name__)
</code></pre>
<p>for example, I'm looking for something like this:</p>
<pre><code>templates_path = app.get_absolute_path_to_templates()
</cod... | <python><flask> | 2023-03-02 09:45:58 | 1 | 8,855 | DanC |
75,613,534 | 380,111 | is there a python way of listing all the properties | <p>I'm really new to python so I'm not 100% sure about the terminology. Tried googling but none of the answers i found work for my use case.</p>
<p>I've made some code to list out all my emails</p>
<pre class="lang-py prettyprint-override"><code>import win32com.client
import pandas as pd
outlook = win32com.client.Disp... | <python><python-3.x> | 2023-03-02 09:31:30 | 1 | 1,565 | Nathaniel Saxe |
75,613,521 | 7,865,686 | Get data to labelbox via cloud function | <p>I want to write a Google Cloud Function to retrieve data from a bucket and upload it to Labelbox. Here's the function code:</p>
<pre><code>import labelbox
from labelbox import Client, Dataset
import os
import uuid
import logging
# Add your API key below
LABELBOX_API_KEY = "my api key"
client = Client(api_... | <python><google-cloud-functions> | 2023-03-02 09:30:13 | 1 | 479 | ishan weerakoon |
75,613,492 | 14,720,380 | Difference between C++ remainder and NumPy/Python remainder | <p>In C++, the following code:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <math.h>
#include <iostream>
int main() {
std::cout << remainder(-177.14024960054252, 360) << std::endl;
}
</code></pre>
<p>Compiled with x86-64 GCC 12.2 (<a href="https://godbolt.org/z/43MzbE1ve" r... | <python><c++><numpy> | 2023-03-02 09:27:04 | 1 | 6,623 | Tom McLean |
75,613,490 | 9,471,909 | Downloading a file via Requests.get(url) raises socket.error: [Errno 10013] | <p>I need to download a file from a Python program using <code>requests</code> module.</p>
<p>If run the following :</p>
<pre><code>self.proxy = {"http_proxy": "...", "https_proxy": "..."}
request = requests.get(
file_url,
allow_redirects=True,
... | <python><python-requests> | 2023-03-02 09:27:01 | 1 | 1,471 | user17911 |
75,613,421 | 2,998,077 | Python Pandas GroupBy to plot a line chart and bar chart side by side (in 1 image) | <p>A dataframe of different columns that I want to plot them (from GroupBy) into a line chart and bar chart side by side (in 1 image).</p>
<p>With below lines that produces 2 separate charts, I tried but still not able to get them into a side-side-side 1 image.</p>
<pre><code>import matplotlib
import matplotlib.pyplot ... | <python><pandas><matplotlib><plot><charts> | 2023-03-02 09:20:43 | 1 | 9,496 | Mark K |
75,613,303 | 11,408,460 | python/ Django values_list is not returning all values | <p>I have this bit of ugly code that is producing what I want. It's working but only necessary because what I would like to do with <code>values_list</code> is not working.</p>
<pre class="lang-py prettyprint-override"><code>member_channels = Channel.objects.filter(Q(members=request.user) | Q(owner=request.user)).prefe... | <python><django><django-models><django-views><django-queryset> | 2023-03-02 09:07:44 | 2 | 680 | 1ManStartup |
75,613,299 | 9,757,174 | Datetime issue with the streamlit dataframe display | <p>I am building a streamlit application and I am uploading an excel file to the Streamlit. However, when the data is displayed in a datetime format using <code>st.dataframe()</code>, it changes format and I am not able to fix it in dsiplay.</p>
<p>As you can see here, the interval column has these numbers and the Date... | <python><python-3.x><datetime><streamlit> | 2023-03-02 09:07:34 | 0 | 1,086 | Prakhar Rathi |
75,613,273 | 2,717,424 | Argparse: Passing multiple arguments via optional parameters when there is also a positional argument | <p>When I have an <code>argparse</code> interface that only supports optional parameters, e.g.</p>
<pre><code>parser.add_argument('-p', '--ports', nargs='+' type=int)
</code></pre>
<p>I can pass values to this parameter as follows</p>
<pre><code>$ python3 myFunc.py -p 80
</code></pre>
<p>or even</p>
<pre><code>$ pytho... | <python><argparse> | 2023-03-02 09:04:19 | 1 | 1,029 | Sebastian Dine |
75,613,212 | 7,089,239 | Pyflink fails converting datetime when executing and collecting SQL timestamp | <p>I'd like to test some streams I've created with <code>execute_and_collect</code> instead of a JDBC sink. The sink succeeds in converting a <code>Row</code> to insert data into a DB, but <code>execute_and_collect</code> fails with:</p>
<blockquote>
<p>AttributeError: 'bytearray' object has no attribute 'timestamp'</p... | <python><apache-flink><flink-streaming><pyflink> | 2023-03-02 08:59:24 | 0 | 2,688 | Felix |
75,613,159 | 3,861,965 | Writing regex to capture string with optional lookahead | <p>I am trying to write a regex which, given these:</p>
<pre><code>cache_realm_report__hourly_0.json
filters_0000.json
how_we_feel_emotions.csv
</code></pre>
<p>returns the respective matches</p>
<pre><code>cache_realm_report__hourly
filters
how_we_feel_emotions
</code></pre>
<p>I have tried a few different patterns bu... | <python><regex> | 2023-03-02 08:52:52 | 1 | 2,174 | mcansado |
75,613,145 | 6,387,095 | Traceback - can't get the exception text? | <p>I am trying to use a try/except block:</p>
<pre><code>try:
raise ValueError
except Exception as e:
# Get error data
stack = traceback.extract_stack()
(filename, line, procname, text) = stack[-1]
# create sendable error data
error_data = {
"error_msg": f&quo... | <python><python-3.x> | 2023-03-02 08:51:36 | 2 | 4,075 | Sid |
75,613,129 | 12,913,047 | Indexing issue after Transposing dataframe | <p>I have the following code below, to produce the heatmap in the image. However, as there are many 'Indicators' - I would like the heat map to be long horizontal and not tall. I.e., the Indicators on the X axis, and the Criteria (robustness...etc) along the left side of the y axis.</p>
<pre><code>import numpy as np
im... | <python><pandas> | 2023-03-02 08:50:15 | 1 | 506 | JamesArthur |
75,613,063 | 179,014 | How to access the output of gcloud build steps in python? | <p>I'm following the tutorial at <a href="https://cloud.google.com/blog/topics/developers-practitioners/orchestrating-pytorch-ml-workflows-vertex-ai-pipelines?hl=en" rel="nofollow noreferrer">https://cloud.google.com/blog/topics/developers-practitioners/orchestrating-pytorch-ml-workflows-vertex-ai-pipelines?hl=en</a> .... | <python><google-cloud-platform><gcloud> | 2023-03-02 08:44:38 | 2 | 11,858 | asmaier |
75,613,040 | 972,647 | python unittest: relative paths to files - pycharm vs cli | <p>I have unittests that require access to files. this is due to the nature of the project that generates files as output and I want to compare to the expected output.</p>
<p>Currently my directory structure is:</p>
<p><code>project root/tests/files</code></p>
<p>In the test setup I have the following:</p>
<pre><code> ... | <python><unit-testing><relative-path> | 2023-03-02 08:40:34 | 1 | 7,652 | beginner_ |
75,612,634 | 91,799 | Copy files using Server Side Copy/Clone in Python? | <p>Protocols like <a href="https://wiki.samba.org/index.php/Server-Side_Copy" rel="nofollow noreferrer">Samba</a> and AFP support server side copy of files. The BTRFS file system even supports instant server side clone operations that don't take up space.</p>
<ul>
<li>Windows Explorer, Robocopy and MacOS Finder already... | <python><performance><filesystems><file-copying><btrfs> | 2023-03-02 07:55:39 | 1 | 2,579 | Patrick Wolf |
75,612,505 | 17,473,587 | Using different classes (one imported and one defined) with the same name in a module | <pre><code>from .models import User, AuctionListing, Comment, Bids, Category, Watchlist, Activities, Winners
</code></pre>
<p>and</p>
<pre><code>class Comment(forms.Form):
comment = forms.CharField(label="", widget=forms.Textarea(attrs={
'placeholder': 'Comment', 'class': 'listing_textarera'
}... | <python><python-import> | 2023-03-02 07:40:05 | 1 | 360 | parmer_110 |
75,612,494 | 12,883,297 | Select the dataframe based on multiple conditions on a group like all values in a column are 0 and value = x in another column in pandas | <p>I have a dataframe</p>
<pre><code>df = pd.DataFrame([["A",0,"ret"],["C",2,"rem"],["B",1,"ret"],["A",0,"rem"],["B",0,"rem"],["D",0,"rem"],["C",2,"rem"],["D",0,"rem... | <python><python-3.x><pandas><dataframe> | 2023-03-02 07:38:53 | 4 | 611 | Chethan |
75,612,441 | 6,133,593 | how can I get the count of non zero at each row in pandas? | <p>I'm using pandas</p>
<p>dataframe is like</p>
<pre><code>name data1 data2 data3
kim 0 1 1
yu 0 1 1
min 2 0 0
</code></pre>
<p>I want to filter, if there are more than 2 data values greater than 0 for each row (filter kim, yu)</p>
<p>Is it possible to do this with pandas?</p>
| <python><pandas><filter> | 2023-03-02 07:32:23 | 2 | 427 | Shale |
75,612,400 | 10,200,497 | add a column of bins by sum of a number | <p>This is my dataframe:</p>
<pre><code>df = pd.DataFrame({'a': range(100, 111)})
</code></pre>
<p>I want to add a column to this dataframe. My desired output looks like this:</p>
<pre><code> a b
0 100 NaN
1 101 NaN
2 102 NaN
3 103 1
4 104 1
5 105 1
6 106 2
7 107 2
8 108 2
9 109 3
10 110 3
</co... | <python><pandas> | 2023-03-02 07:27:02 | 2 | 2,679 | AmirX |
75,612,088 | 7,054,640 | Reading ZIP file from Url generates Bad Zip File error | <p>I am trying to download crypto historical data from <a href="http://www.data.binance.vision" rel="nofollow noreferrer">www.data.binance.vision</a> using python. I try to read the zip files into pandas using pd.read_csv method. This used to work a few months back but now an error pops up saying zipfile.badzipfile: fi... | <python><pandas><binance> | 2023-03-02 06:48:41 | 1 | 355 | Jodhvir Singh |
75,612,018 | 10,829,044 | pandas - create customer movement matrix | <p>I have a dataframe that looks like below</p>
<pre><code>customer_id,month,Group,category,days_ago
A1,Jan,Premium,saf,13
A1,Jan,Premium,ewf,54
A2,Jan,Lost,ds,32
A3,Jan,Lost,dfs,78
A4,Jan,Lost,sdfg,94
A5,Jan,Loyal,sa,14
A6,Jan,Need Attention,ewf,13
A1,Mar,Premium,efWCC,78
A2,Mar,Need Attention,POI
A3,Mar,Lost,QWE
A4,... | <python><pandas><dataframe><matrix><group-by> | 2023-03-02 06:37:56 | 2 | 7,793 | The Great |
75,612,015 | 10,341,232 | Scrapy spider crawl 0 page from Books to scrape website | <p>I have a basic and straightforward <code>Scrapy</code> spider to crawl<code>https://books.toscrape.com/</code>.</p>
<p>No parse function has been implemented yet, and I want to see if the spider can crawl the website.</p>
<pre class="lang-py prettyprint-override"><code>from scrapy.spiders import CrawlSpider, Rule
fr... | <python><web-scraping><scrapy><web-crawler> | 2023-03-02 06:37:51 | 2 | 419 | Talkhak1313 |
75,611,996 | 1,806,566 | Is there a way to specify to pip the #! line for any installed executable scripts? | <p>If I have a python package that contains an executable script and setup.py mentions it in its scripts field, it gets installed into the bin directory.</p>
<p>When it does that, however, it rewrites any #! line in that script to point to the path of the python being used. I would like to specify my own #! line.</p>
... | <python><pip> | 2023-03-02 06:35:07 | 0 | 1,241 | user1806566 |
75,611,948 | 19,106,705 | Why does PyTorch's max pooling layer store input tensors? | <p>I made a simple model like below. It seems weird but it has one convolutional layer and two maxpooling layer.</p>
<pre class="lang-py prettyprint-override"><code>class simple_model(nn.Module):
def __init__(self):
super(simple_model, self).__init__()
self.maxpool2D = nn.MaxPool2d(kernel_size=2,... | <python><deep-learning><pytorch><backpropagation> | 2023-03-02 06:25:50 | 0 | 870 | core_not_dumped |
75,611,661 | 6,727,914 | Is there any logical reason not to reuse a deleted slot immediately in Hash Tables? | <p>I have seen several implementations of dynamic tables with open addressing using linear probing that does not use deleted slots before resizing. Here is one example: <a href="https://gist.github.com/EntilZha/5397c02dc6be389c85d8" rel="nofollow noreferrer">https://gist.github.com/EntilZha/5397c02dc6be389c85d8</a></p>... | <python><algorithm><data-structures><time-complexity><hashtable> | 2023-03-02 05:37:15 | 2 | 21,427 | TSR |
75,611,475 | 1,165,477 | When using Anaconda, where does Python's Idle GUI create output files when calling 'file.open(...)'? | <p>I recently installed Anaconda, and am using it to run Idle.</p>
<p>I'm trying to figure out file I/O. I have a file created -</p>
<pre><code>file = file.open('output.txt', 'w')
</code></pre>
<p>I wrote to the file like so -</p>
<pre><code>file.write('test')
</code></pre>
<p>Idle spit out '4' (1 for each character, I... | <python><python-3.x><file-io><anaconda3> | 2023-03-02 04:58:43 | 0 | 3,615 | Will |
75,611,338 | 13,215,988 | How do I pass an array of strings to a FastAPI post request function? | <p>I have this code for a FastAPI app. Right now it's just supposed to take in an array of strings and return them.</p>
<pre><code>from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: list[str]
app = FastAPI()
@app.post("/")
async def root(item: Item):
list_names ... | <python><post><fastapi><uvicorn><insomnia> | 2023-03-02 04:29:24 | 1 | 1,212 | ChristianOConnor |
75,611,184 | 13,575,728 | Python constructor that initialize its parameters based on values from another python file | <p>I have a class <code>A</code> and its constructor takes many variables. In my project, these variables are identified from another python file, <code>B</code>.</p>
<p>file <code>B</code> looks like this:</p>
<pre><code>p1 = 4
p2 = 1
...
pN = 'dd'
#and a bunch of other variables.
</code></pre>
<p>Class <code>A</code>... | <python><python-3.x><design-patterns> | 2023-03-02 03:57:03 | 1 | 377 | rando |
75,611,161 | 3,127,828 | How to read_csv correctly for dataFrame with Int64 Array? | <p>The following is a simplied version of the issue.</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(data={'key': [1,1,2,2], 'val': [3,4,5,5]})
df['val'] = df['val'].astype('Int64') # read_csv can't read Int64 array properly by default
df = df.groupby('key')['val'].agg(['unique'])
display(df)
df.t... | <python><pandas><dataframe> | 2023-03-02 03:50:27 | 0 | 4,871 | lzl124631x |
75,610,981 | 16,009,435 | Make string a valid file name that can later be viewed as original string | <p>Say I have a string</p>
<pre><code>"this is | test"
</code></pre>
<p>and I want to use that string as a file name but it is not valid to have the <code>|</code> character inside a file name. What is the best way to replace all characters that are not valid as a file name with characters that are valid but ... | <python> | 2023-03-02 03:07:19 | 1 | 1,387 | seriously |
75,610,911 | 9,475,509 | How to use Mermaid diagram in Jupyter Notebook with mermaid.ink through proxy | <p>Previously to use <a href="https://mermaid.js.org/" rel="noreferrer">Mermaid</a> in a Jupyter Notebook file, <a href="https://pypi.org/project/nb-mermaid/" rel="noreferrer"><code>nb-mermaid</code></a> should be installed using <code>pip</code> and then it called using built-in magic commands <code>%%javascript</code... | <python><jupyter-notebook><proxy><mermaid> | 2023-03-02 02:52:37 | 2 | 789 | dudung |
75,610,687 | 17,274,113 | skimage segmetation extracting labels filtered by properties | <p>I would like to extract skimage identified "labels" or segments which meet thresholds of parameters. My binary image was successfully split into segments, which skimage seems to call "labels", as the following:</p>
<pre><code>labels = measure.label(classified, connectivity = image.ndim)
#symobli... | <python><vectorization><image-segmentation><scikit-image><feature-extraction> | 2023-03-02 01:58:21 | 1 | 429 | Max Duso |
75,610,648 | 8,803,234 | Plotly Bar Chart Not Reflecting Values in Call | <p>This is driving me nutz.</p>
<p>I have a Polars dataframe named <code>totals</code> that stores counts by year:</p>
<p><a href="https://i.sstatic.net/hCke1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hCke1.png" alt="dataframe screen shot" /></a></p>
<p>I'm making a very simple bar chat in plotly w... | <python><plotly><python-polars> | 2023-03-02 01:47:21 | 0 | 4,236 | Adam |
75,610,328 | 654,187 | RXPY semaphore filter | <p>I'm looking to execute a batch of processes in parallel, but process each batch in series using RXPY (we're using v3 right now). Each process is kicked off, then I use RXPY to wait for a set amount of time before ending the process. Here's a basic version:</p>
<pre><code>def start_task(value):
print(f"Sta... | <python><rx-py> | 2023-03-02 00:28:48 | 1 | 11,153 | John Ericksen |
75,610,232 | 8,713,442 | Issues while running pyspark UDF with AWS glue | <p>I am trying to call UDF in AWS glue job but getting error . Code and error are given below</p>
<pre><code>import sys,os
import concurrent.futures
from concurrent.futures import *
import boto3
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from ... | <python><apache-spark><pyspark> | 2023-03-02 00:07:53 | 1 | 464 | pbh |
75,610,213 | 7,706,917 | How do I debug a FastAPI Azure Function App in VSCode? | <p><strong>The problem</strong></p>
<p>I have created an application which utilizes FastAPI and Azure Function Apps by following the guide <a href="https://learn.microsoft.com/en-us/samples/azure-samples/fastapi-on-azure-functions/azure-functions-python-create-fastapi-app/" rel="nofollow noreferrer">https://learn.micro... | <python><python-3.x><azure-functions><fastapi> | 2023-03-02 00:04:44 | 1 | 349 | patyx |
75,610,200 | 8,838,303 | Python: How to generate a random array only consisting of a specific number of -1, 0, 1? | <p>Is there a standard way in Python to generate an array (of size 15), where precisely three 1s and four -1s are placed randomly and the remaining array entries are 0?</p>
<p>An example for such an array would be</p>
<pre><code>0 0 0 0 1 1 0 -1 1 -1 -1 0 0 0 -1
</code></pre>
| <python><arrays><random> | 2023-03-02 00:02:40 | 2 | 475 | 3nondatur |
75,610,165 | 14,471,688 | Combine multiple identical nested dictionaries of a list by merging the value | <p>I want to combine multiple identical nested dictionaries of a list by merging the value and store them in a list.</p>
<p>Suppose I have a dictionary like this:</p>
<pre><code>ex = {'tran': { 'precision': 0.6666666666666666,
'recall': 0.6486486486486487,
'f1_score': 0.6575342465753425}... | <python><list><dictionary><merge> | 2023-03-01 23:53:46 | 2 | 381 | Erwin |
75,610,162 | 8,481,155 | Apache Beam pass list as argument - Python SDK | <p>I have an Apache Beam pipeline which would take a list as arguments and use it in the Filter and Map function. Since these would be available as string I had converted using ast.literal_eval on them. Is there any other better way to do the same thing?</p>
<pre><code>import argparse
import ast
import apache_beam as b... | <python><python-3.x><google-cloud-dataflow><apache-beam> | 2023-03-01 23:53:34 | 1 | 701 | Ashok KS |
75,610,023 | 16,009,435 | Get the new URL after getting redirected to a new page | <p>When I load this website <code>https://yewtu.be/latest_version?id=E51gsi_r3HY&itag=137</code> it reads the URL and redirects me to a new URL which is a video feed. Is there any way I can get the new URL with python without using something like selenium? Thanks in advance.</p>
| <python> | 2023-03-01 23:27:25 | 1 | 1,387 | seriously |
75,609,785 | 3,713,236 | Equivalent of the "Unique" row in Describe() for int/float variables? | <p>When I have a dataframe with <strong>strings</strong> and do a <code>describe()</code>, I get a very nice dataframe that looks like the below, whereupon you can see the number of unique values in each column and sort upon it:</p>
<p><a href="https://i.sstatic.net/oUycO.png" rel="nofollow noreferrer"><img src="https:... | <python><pandas><dataframe> | 2023-03-01 22:51:39 | 2 | 9,075 | Katsu |
75,609,733 | 4,429,617 | What is the meaning of "multiple" parameter in Seaborn's kdeplot? | <p>I am trying to understand the meaning of <code>multiple</code> parameter in Seaborn's <a href="https://seaborn.pydata.org/generated/seaborn.kdeplot.html" rel="nofollow noreferrer"><code>kdeplot</code></a>. Below is taken from its documentation,</p>
<blockquote>
<p>multiple{{“layer”, “stack”, “fill”}}</p>
<p>Method f... | <python><pandas><matplotlib><seaborn><kdeplot> | 2023-03-01 22:44:27 | 1 | 468 | Melike |
75,609,716 | 10,634,126 | Python pickling SSLContext TypeError when using tqdm | <p>I have a generic method for handling parallelization using <code>p_tqdm</code> (similar to <code>tqdm</code>) and <code>functools.partial</code> to handle multiple input args, like:</p>
<pre><code>from functools import partial
from p_tqdm import p_umap
def thread_multi(function, non_iterable_args: tuple, iterable_... | <python><parallel-processing><pickle><partial><tqdm> | 2023-03-01 22:41:18 | 0 | 909 | OJT |
75,609,704 | 850,781 | Matplotlib animation shows only a part of each figure | <p>I create a chain of figures and save them into an animation.</p>
<p>My problem is that the image of the figure that I see on the screen is <em>different</em> from what is saved by <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html" rel="nofollow noreferrer"><code>savefig</code></a>.
Th... | <python><matplotlib><animation> | 2023-03-01 22:40:00 | 0 | 60,468 | sds |
75,609,557 | 2,828,287 | Reference type variable from enclosing scope in type annotation | <p>I have two nested classes and the outer one is generic.</p>
<p>The inner one has a reference to the outer one.</p>
<p>How can I annotate the reference that the inner one has to the outer one, so that the <code>reveal_type</code> at the bottom of the code snippet below works properly?</p>
<pre class="lang-py prettypr... | <python><mypy><python-typing> | 2023-03-01 22:17:37 | 1 | 981 | RGS |
75,609,384 | 6,734,243 | Is it possible to configure voila to shutdown when the tab is closed? | <h2>Context</h2>
<p>I try to execute voila dashboards in a <code>nox</code> isolated environment to facilitate development iterations and sharing. the problem is once the <code>nox</code> session is launching voila, it never finishes as voila is not closing itself when I close the tab.</p>
<h1>Question</h1>
<p><strong>... | <python><jupyter><ipython><voila> | 2023-03-01 21:54:32 | 0 | 2,670 | Pierrick Rambaud |
75,609,276 | 1,014,217 | How to convert complex JSON object to pandas dataframe for machine learning | <p>I have some json like this:</p>
<pre><code>{"0": {"name": "Vanilla Cream Ale", "url": "/homebrew/recipe/view/1633/vanilla-cream-ale", "method": "All Grain", "style": "Cream Ale", "batch": 21.8, "og": 1.055, ... | <python><pandas> | 2023-03-01 21:38:31 | 1 | 34,314 | Luis Valencia |
75,609,266 | 2,908,017 | How to set min/max dimensions of a Form in a Python FMX GUI App? | <p>I've made a <code>Form</code> using the <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI Library for Python</a> and it's working perfectly fine, but I want to set a minimum and maximum size for the Form to make sure the window can't resize below or above that amount.<... | <python><user-interface><resize><firemonkey><window-resize> | 2023-03-01 21:38:16 | 1 | 4,263 | Shaun Roselt |
75,609,236 | 5,072,010 | Pulp optimization model not giving reasonable result? | <p>I am trying to get an optimization model to decide on an optimal commitment rate. The general problem structure, in its simplest form, is as follows:</p>
<p>A known number of instances of known types is running for each hour over 10 hours. The number of each type running hour to hour is arbitrary, but known. For eac... | <python><optimization><pulp> | 2023-03-01 21:34:14 | 1 | 1,459 | Runeaway3 |
75,609,188 | 9,390,633 | add to a string variable without deleting last assignment | <pre><code>strings = None
def test(a)
strings = str(strings) + f"{a} \n"
</code></pre>
<p>when this function is called multiple times</p>
<pre><code>test("hello")
test("world")
</code></pre>
<p>how do I allow strings to be equal to</p>
<pre><code>"hello" \n
"world&q... | <python><python-3.x><string> | 2023-03-01 21:29:21 | 1 | 363 | lunbox |
75,609,166 | 4,602,726 | How do I debug a function enqueued with rq? | <p>I am currently attempting to debug a function that's enqueued inside a <code>rq</code> queue in VS Code.
However <code>rq</code> forks the process to produce its workers, which I think is why it is impossible to intercept the breakpoint.</p>
<p>I use the <code>debugpy</code> as a debugging library and I am able to b... | <python><visual-studio-code><python-rq> | 2023-03-01 21:26:23 | 1 | 791 | TommyD |
75,609,157 | 9,609,901 | OpenAI Whisper API error: "AttributeError: module 'openai' has no attribute 'Audio'" | <p>ChatGPT API is announced with Speech-to-text Whisper api and i was so excited to give it a try. <a href="https://platform.openai.com/docs/guides/speech-to-text" rel="nofollow noreferrer">Here's the link</a></p>
<p>I have tried their sample code</p>
<pre><code># Note: you need to be using OpenAI Python v0.27.0 for th... | <python><openai-api><openai-whisper> | 2023-03-01 21:25:04 | 2 | 568 | Don Coder |
75,609,144 | 2,908,017 | How to add placeholder text to Edit in a Python FMX GUI App? | <p>I have made a <code>Form</code> with an <code>Edit</code> component using the <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI Library for Python</a> and I'm trying to add a placeholder text to the Edit component, but I'm not sure how. I've tried doing <code>self.myEd... | <python><user-interface><firemonkey><property-placeholder> | 2023-03-01 21:23:52 | 1 | 4,263 | Shaun Roselt |
75,609,138 | 4,530,214 | sympy : compute simple expected value takes a lot of time | <p>I am trying to compute an expected value from a simple model based on random variables.
I use <code>Normal</code> distribution only because I don't know another way to define a random variable (without specifying the underlying distribution). Basically the '_m' symbols represent the mean of the random distributions.... | <python><sympy> | 2023-03-01 21:23:23 | 0 | 546 | mocquin |
75,609,057 | 2,908,017 | How to get Mouse Cursor Position on Form in a Python FMX GUI App? | <p>I've built a simple <code>Form</code> using the <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI Library for Python</a>. The Form has a <code>MouseMove</code> event attached to it.</p>
<p>What I basically want is the <code>X</code> and <code>Y</code> coordinates of th... | <python><user-interface><firemonkey><mousemove><onmousemove> | 2023-03-01 21:13:22 | 2 | 4,263 | Shaun Roselt |
75,609,000 | 8,876,025 | Access to XMLHttpRequest at 'localhost:5000' from origin 'localhost:3000' has been blocked | <p>My ReactJS app cannot successfully send form data to Python flask backend, even with a CORS statement in the backend.</p>
<p>This is the error message:</p>
<blockquote>
<p>Access to XMLHttpRequest at 'http://localhost:5000/' from origin
'http://localhost:3000' has been blocked by CORS policy: Response to
preflight r... | <python><reactjs><flask><cors> | 2023-03-01 21:05:09 | 1 | 2,033 | Makoto Miyazaki |
75,608,846 | 8,194,364 | How to use string variable instead of literal string with double quotes inside a python function? | <p>I have a function in Python:</p>
<pre><code>def clickButtonViaText():
url = 'https://finance.yahoo.com/quote/AAPL/balance-sheet?p=AAPL'
options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get(ur... | <python><string> | 2023-03-01 20:47:17 | 1 | 359 | AJ Goudel |
75,608,782 | 1,187,968 | Python @patch.dict vs @patch.object | <p>I have the following file:</p>
<pre><code># dummy.py
import os
from requests import get
def my_func():
name = os.environ.get('name')
response = get('http://www.google.com')
return name, response.content
</code></pre>
<p>and the following test file</p>
<pre><code>import unittest
import os
import request... | <python> | 2023-03-01 20:41:42 | 2 | 8,146 | user1187968 |
75,608,729 | 6,032,221 | Tensorflow: External calculation of dice coef on validation set different than my Unet's validation dice coef with same data set | <p>So I am training a variation of a Unet style network in Tensorflow for a problem I am trying to solve. I have noticed an interesting pattern / error that I am unable to comprehend or fix.</p>
<p>As I have been training this network, on tensorboard the training loss is greater than validation loss, but the metric for... | <python><tensorflow><keras><conv-neural-network><metrics> | 2023-03-01 20:35:42 | 1 | 323 | zhilothebest |
75,608,494 | 4,688,639 | Are nested ifs equals to and logic? | <p>I wonder whether these two Python codes are <strong>always</strong> the same or not.</p>
<pre><code>if condition_1:
if condition_2:
some_process
</code></pre>
<p>and</p>
<pre><code>if condition_1 and condition_2:
some_process
</code></pre>
<p>I searched but did not find any specific answer to this qu... | <python><if-statement><nested><logic> | 2023-03-01 20:09:30 | 1 | 468 | Soroosh Noorzad |
75,608,409 | 4,772,565 | How to type hint a particular dict type but allow empty dict in Python 3? | <p>I want to transfer data between different python-files. I create a new type so that different py-files all know what kind of data can be expected.</p>
<p>I used the following code.</p>
<pre class="lang-py prettyprint-override"><code>from typing import NewType
MyDataType = NewType("MyDataType", dict[str, d... | <python><python-typing> | 2023-03-01 20:01:53 | 1 | 539 | aura |
75,608,323 | 17,532,318 | How do I solve "error: externally-managed-environment" every time I use pip 3? | <p>When I run <code>pip install xyz</code> on a Linux machine (using <a href="https://en.wikipedia.org/wiki/Debian" rel="noreferrer">Debian</a> or <a href="https://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29" rel="noreferrer">Ubuntu</a> or a derived Linux distribution), I get this error:</p>
<blockquote>
<pre c... | <python><pip><debian><failed-installation> | 2023-03-01 19:52:19 | 44 | 10,005 | Apoliticalboy |
75,608,196 | 1,187,968 | Understanding where to patch | <p>In <a href="https://docs.python.org/3.6/library/unittest.mock.html#where-to-patch" rel="nofollow noreferrer">the docs</a>, it explains why patching at at the function definition level doesn't work:</p>
<blockquote>
<p>Imagine we have a project that we want to test with the following
structure:</p>
<pre><code>a.py
... | <python><python-unittest.mock> | 2023-03-01 19:37:46 | 2 | 8,146 | user1187968 |
75,608,149 | 5,632,058 | Python CSV to dataclass | <p>I want to load a CSV into a Dataclass in Python. The dataclass consists of strings and enums, and I want to parse it accordingly. I now that there is a python library that does it, but it does not allow to skip malformed rows, which unfortunately exist.</p>
<p>I have created a method for this, that can read a file a... | <python><csv> | 2023-03-01 19:31:36 | 2 | 941 | Syrius |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.