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,689,081 | 12,596,824 | using np.exp() to convert column in pandas DF | <p>I have the following dataframe:</p>
<pre><code>id val
1 10
1 2012
1 65
</code></pre>
<p>i want to convert the val column to create values that add up to 1</p>
<pre><code>df['val'] = np.exp(df.val)/sum(np.exp(df.val))
</code></pre>
<p>but i get the following</p>
<pre><code>id val
1 0.0
1 NaN
1 0.0
</cod... | <python><pandas> | 2023-03-09 19:14:45 | 0 | 1,937 | Eisen |
75,689,070 | 6,467,567 | Indexing on ndarrays result in wrong shape | <p>The following snippet</p>
<pre><code>x = np.ones((10,10,10))
x = x[2,:,[2,3,7]]
print(x.shape)
</code></pre>
<p>results in <code>x.shape = (3,10)</code> instead of <code>(10,3)</code>. How do I use a list to index the 3rd dimension to get a shape <code>(10,3)</code>?</p>
| <python><numpy> | 2023-03-09 19:12:58 | 2 | 2,438 | Kong |
75,689,061 | 4,796,942 | Using package to perform a rolling window function with a group by | <p>Could you use a window function on groups, something in <a href="https://readthedocs.org/projects/feature-engine/downloads/pdf/latest/" rel="nofollow noreferrer">feature engine</a>? I have been reading the <a href="https://readthedocs.org/projects/feature-engine/downloads/pdf/latest/" rel="nofollow noreferrer">docs<... | <python><pandas><group-by><feature-engineering><sktime> | 2023-03-09 19:11:03 | 1 | 1,587 | user4933 |
75,689,011 | 2,828,064 | Why does coverage.py not report a for loop where the body is not skipped when running it with --branch? | <p>Consider the following example file <code>test.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>def fun(l):
for i in l:
a = 1
print(a)
if __name__ == '__main__':
fun([1])
</code></pre>
<p>Testing branch coverage with</p>
<pre class="lang-bash prettyprint-override"><code>coverage er... | <python><code-coverage><coverage.py> | 2023-03-09 19:05:18 | 1 | 674 | jakun |
75,689,005 | 1,744,194 | Celery Groups: How to create a group of already running tasks? | <p>I have a set of long running tasks I need to coordinate in group. The challenge is the tasks must be fired as soon as they can be created, not after all tasks are defined (as shown below).</p>
<p>The problem is <code>group(...)</code> does not accept <code>AsyncTask</code> and calling <code>apply_async</code> on the... | <python><asynchronous><celery><scheduling><group> | 2023-03-09 19:04:34 | 1 | 827 | X_Trust |
75,688,943 | 18,806,499 | My POST method can't receive data (flask api) | <p>I'm working on my flask app. I've successfully implemented the rest APIs and now I want to add views to my app. Here is post method:</p>
<pre><code>from flask_restful import Resource
from flask import abort, request
from flask_apispec import marshal_with, use_kwargs
from flask_apispec.views import MethodResource
fr... | <python><flask> | 2023-03-09 18:57:55 | 1 | 305 | Diana |
75,688,938 | 10,093,190 | How to compare two files byte per byte, but also account for missing bytes? | <p>I have two files containing random bytes. An original, and one that was sent back and forth to a remote target.</p>
<p>I need to check if both files are identical. Let's take this table as an example:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Byte #</th>
<th>File1</th>
<th>File2</t... | <python> | 2023-03-09 18:57:18 | 0 | 501 | Opifex |
75,688,738 | 817,659 | requests doesn't seem to connect and return data from a service but browser does | <p>Both the <code>service</code> and the <code>program</code> are running under <code>Ubuntu</code>.</p>
<p>I have an application that calls a <code>service</code> that returns a <code>json pandas dataframe</code>. The service prints out the data to the screen before serving the data.</p>
<p>I have tested the service u... | <python><python-requests> | 2023-03-09 18:35:33 | 0 | 7,836 | Ivan |
75,688,651 | 12,981,397 | Compare dictionaries to check if they are equal or if they go from empty to having a value | <p>I have two dataframes where I am looping through each row and creating a dictionary for the rows that I am looking at to compare against each other.</p>
<p>I've done this by doing:</p>
<pre><code>ids = []
for row in range(len(df1)-1):
df1_row = dict(df1.iloc[row])
df2_row = dict(df2.iloc[row])
if df1_row... | <python><pandas><dataframe><dictionary><comparison> | 2023-03-09 18:26:02 | 1 | 333 | Angie |
75,688,480 | 8,713,442 | Create group having Percentage diff <=30% | <p>I am calculating % difference among all values and then creating group . As an output I am getting combinations of 2 values but I want combine all values in one group which are less than 30% of each other.</p>
<p>Working code is given below</p>
<pre><code>
from itertools import combinations
def pctDiff(A,B):
... | <python><python-3.x><data-science> | 2023-03-09 18:07:25 | 5 | 464 | pbh |
75,688,389 | 1,711,271 | Fast way to select all the elements of a list of strings, which contain at least a substring from another list | <p>I have a list of strings like this:</p>
<pre><code>samples = ['2345_234_1.0_1.35_001', '0345_123_2.09_1.3_003', ...]
</code></pre>
<p>The list can be quite long (up to 10^6 elements in the worst case). I have another list containing some substrings:</p>
<pre><code>matches = ['7895_001', '3458_669', '0345_123', ...]
... | <python><pandas><regex><list><list-comprehension> | 2023-03-09 17:58:12 | 2 | 5,726 | DeltaIV |
75,688,321 | 16,414,611 | Unable to get data from Scrapy API | <p>I'm facing some unexpected issues while trying to get data from an API request. I found that it is throwing a "500" error and also this error message. I'm trying to scrape this URL "https://www.machinerytrader.com/listings/for-sale/excavators/1031" but I have no idea what I actually missing here.... | <python><python-3.x><web-scraping><scrapy> | 2023-03-09 17:51:21 | 1 | 329 | Raisul Islam |
75,688,238 | 496,289 | pyspark log4j2: How to log full exception stack trace? | <p>I tried</p>
<ul>
<li><code>logger.error('err', e)</code></li>
<li><code>logger.error('err', exc_info=e) # syntax for python's logging</code></li>
</ul>
<pre><code>>>>
>>> logger = spark.sparkContext._jvm.org.apache.log4j.LogManager.getLogger('my-logger')
>>>
>>> try: 1/0
... exc... | <python><exception><logging><pyspark><log4j> | 2023-03-09 17:43:13 | 1 | 17,945 | Kashyap |
75,688,222 | 8,972,915 | Polars - Failed to read delta config: Validation failed - Unknown unit 'days' | <p>I am having some delta tables created in my azure data lake using azure databricks. I am trying to follow the below instruction, and to read them using polars.</p>
<p><a href="https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.read_delta.html" rel="nofollow noreferrer">https://pola-rs.github.io/pol... | <python><azure-databricks><delta-lake><python-polars> | 2023-03-09 17:41:26 | 0 | 405 | Grevioos |
75,688,216 | 719,689 | Debugpy won't attach to anything | <p>I've tried everything except what works. Nothing gets my vscode debugger to attach to any breakpoint.</p>
<p>Here is my launch.json:</p>
<pre><code>{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsof... | <python><django><vscode-debugger><debugpy> | 2023-03-09 17:40:59 | 1 | 3,258 | AlxVallejo |
75,688,185 | 11,001,493 | How to transform row values into column based on specific values from multiple columns? | <p>This is an example of bigger data.</p>
<p>I have a dataframe like this:</p>
<pre><code>df = pd.DataFrame({"Year":[2023, 2023, 2023, 2024, 2024, 2024],
"Value":[0, 2, 3, 1, 5, 2],
"Field":["A", "A", "B", "A", &... | <python><pandas><pivot> | 2023-03-09 17:38:13 | 1 | 702 | user026 |
75,687,761 | 3,434,388 | How to enforce Protocol class definitions? | <p>Python 3.8 recently introduced Protocol classes, super helpful for defining class method signatures. I'm using them as part of a factory method, something like:</p>
<pre><code>class Thing(Protocol):
@abstractmethod
def do_thing(self, thing_id: int, action: str, monitor: bool = True) -> None:
raise... | <python><python-3.x><python-typing> | 2023-03-09 17:00:15 | 0 | 3,700 | Danielle M. |
75,687,698 | 265,629 | AsyncMock coroutines never actually yield control? | <p>I'm trying to test some asynchronous code I wrote. The structure is:</p>
<ul>
<li>A worker object is responsible for receiving a task and asynchronously executing it, often <code>await</code>ing on some asynchronous IO call</li>
<li>Sitting above each worker object is a loop that reads from a shared queue, passing t... | <python><unit-testing><mocking><python-unittest> | 2023-03-09 16:54:42 | 1 | 28,482 | alexgolec |
75,687,489 | 374,458 | Circular dendrogram with Altair | <p>I'm trying to build a circular dendrogram with <strong>Python</strong>.</p>
<p>This example from Vega is perfect: <a href="https://vega.github.io/vega/examples/radial-tree-layout/" rel="nofollow noreferrer">https://vega.github.io/vega/examples/radial-tree-layout/</a></p>
<p>But after several days, I've been unable t... | <python><visualization><altair><vega><dendrogram> | 2023-03-09 16:33:00 | 0 | 1,870 | Nicolas |
75,687,409 | 3,116,231 | Issue with creation of nested data classes | <p>I'm trying to create nested data classes:</p>
<pre><code>from dataclasses import dataclass, field
import datetime
from typing import List
@dataclass
class LineItem:
displayName: str
compareAtPrice: float
discountedPrice: float
pricing: str = field(init=False)
def __post_init__(self):
s... | <python><python-dataclasses> | 2023-03-09 16:26:26 | 1 | 1,704 | Zin Yosrim |
75,687,386 | 386,861 | How to upgrade pandas 2.0rc in VSCode | <p>Trying to upgrade to pandas 2.0rc in VSCode using the jupyter notebook extension.</p>
<pre><code>! python -m pip install --upgrade pip
! pip install --pre pandas==2.0.0rc0
import pandas as pd
pd.__version__
</code></pre>
<p>The result is:
After the installation stuff...</p>
<pre><code>Successfully installed pandas-... | <python><pandas><visual-studio-code> | 2023-03-09 16:25:03 | 1 | 7,882 | elksie5000 |
75,687,278 | 5,510,540 | Python: Sankey plot chart with complex data | <p>I have the following dataset:</p>
<pre><code>data = {
'1': ['A', 'B', 'C', 'NAN', 'A', 'C', 'NAN', 'C', 'B', 'A'],
'2': ['B', 'NAN', 'A', 'B', 'C', 'A', 'B', 'NAN', 'A', 'C'],
'3': ['NAN', 'A', 'B', 'C', 'NAN', 'B', 'A', 'B', 'C', 'A'],
'4': ['C', 'B', 'NAN', 'A', 'B', 'NAN', 'C', 'A', 'NAN', 'B']
}
... | <python><sankey-diagram> | 2023-03-09 16:16:12 | 1 | 1,642 | Economist_Ayahuasca |
75,687,150 | 292,344 | How do you convert a dark matplotlib plot to a light grayscale for printing on a printer? | <p>I need to print a matplotlib plot on a printer using pyton 3 and PyQt5. My problem is that the plot has a dark background and colored traces and labels.That will take a lot of ink. I need to print the plot in black and white or gray scale and invert the dark colors to white or gray scale etc. What is the best way to... | <python><matplotlib><printing> | 2023-03-09 16:04:16 | 1 | 361 | user292344 |
75,687,112 | 12,285,101 | Python - check if a two specific words are exists in different items in list | <p>I have many lists that are more or less similar to this:</p>
<pre><code>
['my_name:Ruth','my_age:23','hobbies:everything']
</code></pre>
<p>I want to verify that all the list contains "my_age" and my_name", so if list has only "my_name" but doesn't have "my_age", or opposite, or, ... | <python><string> | 2023-03-09 16:01:07 | 1 | 1,592 | Reut |
75,686,954 | 12,596,824 | How does np.random.binomial work in numpy python | <p>I have the following code but I'm unsure how it works even after reading documentation..</p>
<pre><code>print(np.random.binomial(n = 1, [0.1,0.9]))
</code></pre>
<p>I want to produce either 0 or 1 values with probability 10% being 1 and 90% being 0. Is the code above how you would do it?</p>
<p>What if I changed the... | <python><numpy> | 2023-03-09 15:48:00 | 1 | 1,937 | Eisen |
75,686,933 | 8,713,442 | Creating new Dictionary based on key values in list | <p>I have dictionary D1 and list l1 .I want to create new dictionary D2 picking key values from List .
Is there any direct way of doing this or I need to apply through for loop on list .</p>
<pre><code>
def main():
dict ={'acct_number':'10202','acct_name':'abc','v1_rev':'30000','v2_rev':'4444',
'v3_rev':'... | <python> | 2023-03-09 15:45:26 | 1 | 464 | pbh |
75,686,858 | 14,037,283 | getenv()s return None when using Pycharm's Play button | <p>I am using:</p>
<pre><code>from dotenv import load_dotenv
from os import getenv
load_dotenv("config/.env")
</code></pre>
<p>in a project which uses the <code>pytest</code> & <code>selenium</code> package.</p>
<p>I use <code>getenv("example_string")</code> at various points in this file which ... | <python><pycharm><python-dotenv> | 2023-03-09 15:39:44 | 0 | 2,460 | tonitone120 |
75,686,842 | 244,297 | What's the time complexity of this algorithm for solving an interview question? | <p>The <a href="https://leetcode.com/discuss/interview-question/924141/google-phone-screen-new-grad" rel="nofollow noreferrer">problem</a> goes as follows:</p>
<blockquote>
<p>You have a stream of RPC requests coming in which is being logged. Each log entry is of the form
<code>{rpc_id, timestamp, type (start or end)}<... | <python><algorithm><dictionary> | 2023-03-09 15:38:21 | 0 | 151,764 | Eugene Yarmash |
75,686,755 | 15,452,168 | reading multi-index header based excel file using pandas | <p>I have an excel file where first 3 rows have header names, I want to read it in pandas but facing difficulty in the multi-index header.</p>
<pre><code> PLAN 2023
Traffic per channel Traffic Share per Channel
month week ... | <python><excel><pandas><openpyxl><multi-index> | 2023-03-09 15:30:46 | 1 | 570 | sdave |
75,686,662 | 12,248,220 | python triply nested for loop code optimization | <p>I have written a code which has its bottleneck in a triply-nested for-loop which goes through the 3-dimensional Physical space (r, theta, phi).</p>
<p>[The code has to work on each of the datapoints from this 3D space, so there is no clever way to re-design the logic in order to avoid the triply-nested for loop.]</... | <python><numpy><performance><loops><optimization> | 2023-03-09 15:22:50 | 0 | 576 | velenos14 |
75,686,570 | 11,261,546 | Is there a numpy object containing all types? | <p>I'm writting a unit test of a function that only accepts numpy arrays of type <code>numpy.uint8</code> and I wanted to test that I get the right exception from <strong>all</strong> the other types.</p>
<p>So I did a set like this:</p>
<pre><code>self.supported_types = {np.uint8}
self.not_supported_types = {np.bool_,... | <python><numpy> | 2023-03-09 15:16:21 | 1 | 1,551 | Ivan |
75,686,310 | 7,544,724 | Automating a Script with ClearML | <p>I am using ClearML to automate a script. I'm new to the tool and I haven't found any tutorials for this. The goal I'm trying to accomplish is automate several python scripts so that a server is spun up and torn down as necessary to run them using clearml. Can anyone point me to documentation or explain to me how to ... | <python><clearml> | 2023-03-09 14:57:53 | 1 | 450 | bballboy8 |
75,686,137 | 14,269,252 | My Y axis doesnt show all the dates on Y axis while plotting heatmap in plotly | <p>I know how to make a good heatmap in seaborn, but I would like to use the Plotly package. I used the code below, but my Y axis doesn't show all the dates, how can I show all the the dates on my y axis?</p>
<p>I want background color be white and each category have different custom color too, how should I modify the ... | <python><plotly><heatmap> | 2023-03-09 14:44:20 | 1 | 450 | user14269252 |
75,686,071 | 3,357,270 | Why are path variable keys being read as values in my Django application? | <p>I am using Django Rest Framework to build an api. This is my first time working with DRF, but have experience working with Laravel/NestJs so the concept of routing isn't too unfamiliar.</p>
<p>In my DRF application, my url config looks something like this:</p>
<pre><code>// urls.py
urlpatterns = [
path('api/v1/... | <python><django><django-rest-framework> | 2023-03-09 14:40:07 | 0 | 4,544 | Damon |
75,686,001 | 5,861,153 | How can I position my kivy app window in the right bottom corner | <p>I have a kivy desktop app and want to start it in the corner at the right.
Currently, i can only apply the position from the left, top...</p>
<pre><code>from kivy.config import Config
Config.set('graphics','position','custom')
Config.set('graphics','resizable',0)
Config.set('graphics','left',20)
Config.set('graphics... | <python><kivy> | 2023-03-09 14:34:22 | 2 | 418 | Medera |
75,685,860 | 8,176,763 | airflow webserver showing next run as start of data interval | <p>I have a dag like that:</p>
<pre><code>@dag(
dag_id = "data-sync",
schedule_interval = '*/30 * * * *',
start_date=pendulum.datetime(2023, 3, 9, tz="Asia/Hong_Kong"),
catchup=False,
dagrun_timeout=timedelta(minutes=20),
)
</code></pre>
<p>So it runs every 30 minutes , starting today in my timezone... | <python><airflow> | 2023-03-09 14:21:52 | 1 | 2,459 | moth |
75,684,994 | 11,710,304 | Detect rows where uniqueness is not given in polars | <p>Currently I have the following problem. I have to check if there is an infringement if the column values <code>ID</code>, <code>table</code> and <code>value_a</code> are not unique.</p>
<pre><code> df = pl.DataFrame(
{
"ID": ["1", "1", "1", "1", &q... | <python><python-polars> | 2023-03-09 13:01:30 | 1 | 437 | Horseman |
75,684,971 | 1,576,254 | pytest fails on github action with no output, error code 1 | <p>I'm running pytest on a self-hosted windows runner (windows server 2019), but it fails with no output, just says <code>exit code 1</code>. No output also despite using debug mode on the runner.</p>
<p>I get python via <code>actions/setup-python@v4</code>. Dependencies are installed with <code>python -m pip install -... | <python><pytest><github-actions> | 2023-03-09 12:59:48 | 1 | 3,573 | ikamen |
75,684,738 | 18,049,757 | Not able to run FastAPI server, ValueError: source code string cannot contain null bytes | <p>Learning FastAPI, however, an error occurs whenever I'm trying to run it.</p>
<p>Error:</p>
<pre><code>PS C:\Users\obunga\OneDrive\Desktop\py\fastfast> uvicorn main:app --reload
INFO: Will watch for changes in these directories: ['C:\\Users\\obunga\\OneDrive\\Desktop\\py\\fastfast']
INFO: Uvicorn running ... | <python><python-3.x><webserver><fastapi> | 2023-03-09 12:38:42 | 1 | 375 | sohdata |
75,684,557 | 10,722,752 | how to perform multiprocessing inside Azure API run function | <p>I am trying to reduce the execution time of an API call by using multiprocessing:</p>
<p>My original requirement is actually on generating and displaying ML explainability using LIME. For simplicity, let's assume I have below data:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import pandas ... | <python><pandas><multiprocessing> | 2023-03-09 12:22:15 | 1 | 11,560 | Karthik S |
75,684,328 | 18,657,095 | Strange behaviour of the program after modifying the dictionary of local variables | <p>I find some strange behavior in my program after modifying the dictionary of local variables, and it makes me confused. If we execute the code below, we will get the result as the image I attached. <strong>And now I know I shouldn't modify the local variables using locals().</strong></p>
<pre><code>i=0
locals()[f'nu... | <python><local-variables><pdb> | 2023-03-09 12:01:17 | 1 | 632 | x pie |
75,684,222 | 17,834,402 | Merge two DataFrames based on containing string without iterator | <p>I have two csv files imported as dataframes <code>A</code> and <code>C</code>. I want to match the strings of column <code>content</code> with the entry in <code>data.data</code> that contains the string from <code>A</code>.</p>
<pre><code>A time_a content C time_c data.data
100 f00 400 other... | <python><pandas> | 2023-03-09 11:51:25 | 2 | 409 | Paul Smith |
75,684,073 | 5,695,336 | call_soon_threadsafe never call the function if it is inside an async function | <p>I am working with a third party library that will call a function I gave it from another thread at some random time. It can be modelled as a delayed function call in another thread.</p>
<p>The function I want it to call is an async function. The library does not have a special interface for async function, also I do... | <python><multithreading><asynchronous><python-asyncio> | 2023-03-09 11:37:35 | 1 | 2,017 | Jeffrey Chen |
75,684,031 | 7,762,646 | How to get all the nodes and edges connected to a certain node in networkx? | <p>I have created a simple undirected graph in Python networkx library:</p>
<pre><code>import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_nodes_from(["A", "B", "C", "D", "E"])
G.add_edges_from([("A","C"), ("B","... | <python><python-3.x><networkx> | 2023-03-09 11:33:17 | 1 | 1,541 | G. Macia |
75,684,005 | 5,075,502 | Wrong shape output with conv1D layer | <p>I'm trying some experiments with a small autoencoder defined like this:</p>
<pre><code>input_layer = Input(shape=input_shape)
x = Conv1D(8, kernel_size=5, activation='relu', padding='same')(input_layer)
x = BatchNormalization()(x)
encoded = Conv1D(4, kernel_size=5, activation='relu', padding='same')(x)
x = Conv1D(... | <python><tensorflow><keras><autoencoder> | 2023-03-09 11:30:36 | 1 | 2,945 | snoob dogg |
75,683,944 | 1,029,433 | Pass custom parameters in locust | <p>Actually, I am in a case study and I would like to use Locust for load testing.</p>
<p>As an input, I have a csv file that contains as columns the datetime, number of users and other variable parameters that should be used for each post request as query parameters:</p>
<pre><code>datetime,rps,param1,param2
2022-09-1... | <python><load-testing><locust> | 2023-03-09 11:24:34 | 2 | 3,096 | kaissun |
75,683,934 | 13,372,881 | 'float' object has no attribute 'rint' | <p>All the cells of DataFrame are of float type but still it is not able to round off.</p>
<p><strong>DataFrame</strong></p>
<p><a href="https://i.sstatic.net/CbaeX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CbaeX.png" alt="enter image description here" /></a></p>
<p><strong>Dtype</strong>
<a href="... | <python><pandas><dataframe><rounding> | 2023-03-09 11:23:37 | 2 | 1,027 | Mridul Bagla |
75,683,863 | 16,389,095 | Bleak - Python Bluetooth library: RuntimeError asyncio.run() cannot be called from a running event loop | <p>I'm trying to use <em>Bleak</em> , a Python library for Bluetooth devices management. Starting from an <a href="https://pypi.org/project/bleak/#description" rel="nofollow noreferrer">example</a> of use to find active Bluetooth devices</p>
<pre><code>import asyncio
from bleak import BleakScanner
async def main():
... | <python><python-3.x><bluetooth-lowenergy><python-asyncio><spyder> | 2023-03-09 11:17:18 | 0 | 421 | eljamba |
75,683,849 | 5,016,028 | Compute time differences in Pandas dataframe with respect to first value | <p>I have a question that looks somewhat similar to [this one][1], however I don't know how to modify the answer given there to fit my problem.</p>
<p>I have a dataframe that looks like this:</p>
<pre><code>Date user
2012-12-05 09:30:00 0
2012-12-05 09:35:00 1
2012-12-05 09:40:00 2
2012-12-05... | <python><python-3.x><pandas><dataframe><group-by> | 2023-03-09 11:16:06 | 2 | 4,373 | Qubix |
75,683,804 | 2,693,551 | How many calendar days elapsed since given date? | <p>I need to find how many calendar days elapsed sice given date. When I use the following, it gives me -1 even when the date is today:</p>
<pre><code>>>> from datetime import datetime
>>> t = datetime.fromisoformat('2023-03-09 08:55:11')
>>> (t - datetime.today()).days
-1
</code></pre>
<p>Wh... | <python> | 2023-03-09 11:11:08 | 3 | 587 | Martin Vegter |
75,683,654 | 7,800,760 | Assign unique ID to mixed list of strings and substrings | <p>I have a list of dictionaries of strings (eg people names) which are either complete or just fragments:</p>
<pre><code>names = [
{"text": "Alice"},
{"text": "Bob"},
{"text": "Bob Ross"},
{"text": "Twain"},
{"text... | <python> | 2023-03-09 10:57:51 | 0 | 1,231 | Robert Alexander |
75,683,607 | 21,244,591 | Multiple object returns from method not acting as expected | <p>While playing around with <code>pyautogui</code> I decided to make a method to limit the position of my cursor depending on the size of my monitor, since I was moving my cursor randomy.</p>
<p>This is what my first attempt looked like.</p>
<pre><code>max_x = 10
max_y = 40
def limitXandY(x_arg, y_arg):
# expected... | <python><methods><conditional-operator><pyautogui><multiple-return-values> | 2023-03-09 10:53:00 | 2 | 366 | Olivier Neve |
75,683,529 | 1,137,043 | major gridlines with LogLocator behave incorrectly? | <p>I am trying to mark the major gridlines of a <code>semilogx</code> plot with thicker lines. However, the code below (SSCCE) only highlights every second gridline.</p>
<pre><code>import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator, LogLocator)
# configuration
xValues = [0.1, 1, 10, 100, 1e... | <python><matplotlib><plot><gridlines> | 2023-03-09 10:45:56 | 1 | 9,562 | brimborium |
75,683,479 | 8,176,763 | airflow best way to handle async function as task | <p>I have a dag like this:</p>
<pre><code>from datetime import timedelta
import pendulum
from airflow.decorators import dag
from stage import stage_data
from table_async_pg import merge_data
@dag(
dag_id = "data-sync",
schedule_interval = "1 * * * *",
start_date=pendulum.datetime(2023, 3, 8, tz=&qu... | <python><airflow> | 2023-03-09 10:41:36 | 1 | 2,459 | moth |
75,683,474 | 2,258,600 | In python, why does select.select require that I sleep in a loop? | <p>I was writing a socket server. In the while loop,</p>
<pre class="lang-python prettyprint-override"><code>while True:
rlist, wlist, _ = select.select([sock], [sock], [])
for rsock in rlist:
new_data = rsock.recv(RCV_SIZE)
for wsock in wlist:
wsock.send(other_data + TERMI... | <python><sockets><event-loop> | 2023-03-09 10:41:18 | 0 | 546 | possumkeys |
75,683,386 | 6,498,757 | Python sys.argv and argparser conflict | <p>I'm trying to mixed-use both argument handlers but failed. Python doesn't allow me to do so or do there exist some ways to handle mixed usage?</p>
<pre class="lang-py prettyprint-override"><code>import argparse
import sys
# Define an argparse parser
parser = argparse.ArgumentParser()
parser.add_argument('--foo', hel... | <python><python-3.x> | 2023-03-09 10:33:39 | 1 | 351 | Yiffany |
75,683,345 | 5,994,014 | scikit-learn documentation example: 'got an unexpected keyword argument' | <p>When running <a href="https://scikit-learn.org/stable/modules/clustering.html#homogeneity-completeness-and-v-measure" rel="nofollow noreferrer">this example</a> from the scikit-learn documentation, I get the error <code>v_measure_score() got an unexpected keyword argument 'beta'</code>:</p>
<pre><code>from sklearn i... | <python><scikit-learn><unsupervised-learning> | 2023-03-09 10:30:04 | 1 | 598 | NRLP |
75,683,306 | 2,135,504 | Why does tf.train.FloatList have rounding errors? | <p>The following code shows that when converting a python float to a <code>tf.train.FloatList</code>, then we lose precision. My understanding was that both native python <a href="https://www.tensorflow.org/tutorials/load_data/tfrecord#setup" rel="nofollow noreferrer">and tensorflow</a> store it as float64. So why the ... | <python><tensorflow><tfrecord> | 2023-03-09 10:26:44 | 1 | 2,749 | gebbissimo |
75,683,209 | 5,510,540 | python: sorting time interval data into two days chucks based on index event | <p>I have the following data:</p>
<pre><code>df =
id date_medication medication index_date
1 2000-01-01 A 2000-01-04
1 2000-01-02 A 2000-01-04
1 2000-01-05 B 2000-01-04
1 2000-01-06 B 2000-01-04
2 2000-01-01 A 2000-01-05
2 2000-01-03 B ... | <python><pandas> | 2023-03-09 10:17:19 | 2 | 1,642 | Economist_Ayahuasca |
75,683,133 | 3,386,779 | Read the content of the file A and match with another file Example.html in given folder and rename the it with Example.html | <p>I have the folder A and Folder B and want to compare the file content in folder A with Folder B files .If the topictitle1 matches rename it with matching file name which is in Folder B.I have the output folder which I created manually to dump the renamed files</p>
<p>Folder A
01.html
02.html
03.html</p>
<p>Folder B... | <python><html><file> | 2023-03-09 10:10:45 | 0 | 7,263 | user3386779 |
75,683,130 | 1,652,954 | How to run .sh file from console | <p>I would like to know why I can not run the <code>.sh</code> file via <code>./launch.sh</code>
please have a look at the below posted screen-shot</p>
<p><strong>image</strong></p>
<p><a href="https://i.sstatic.net/KiGPE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KiGPE.png" alt="enter image descrip... | <python><powershell><shell> | 2023-03-09 10:10:10 | 3 | 11,564 | Amrmsmb |
75,682,987 | 12,023,442 | Why does sys.getsizeof fail on a pandas series or data frame when they hold a type | <p>Python getsizeof fails on a series which holds a type as data , I have function in which I need to calculate the size of any given argument which I do with getsizeof. But this is an issue as getsizeof fails unexpectedly for these kind of dataframes. Is there a way to avoid this failure in <code>getSizeof</code></p>... | <python><python-3.x><pandas><sizeof> | 2023-03-09 09:58:49 | 2 | 2,254 | ArunJose |
75,682,803 | 13,994,829 | How to fix Excel COM error cause by Python xlwings? | <p>The first time I use xlwing, I can get result successfully.</p>
<p>But when choose different <code>.xlsx</code> file, I get error.</p>
<p>I have try to shut down <code>EXCEL.EXE</code> in <code>taskman</code>, but not work still.</p>
<h3>Code</h3>
<pre class="lang-py prettyprint-override"><code>from PIL import Image... | <python><excel><windows><com><xlwings> | 2023-03-09 09:43:55 | 0 | 545 | Xiang |
75,682,800 | 17,220,672 | Python Protocol error: Incompatible types in "yield" (actual type "Type[Foo]", expected type "FooProtocol") | <p>Lets say I have a class "Foo" and class "Database". "Database" class provides connection engine, sessions and other related db stuff. Foo class intantiates this class (and some other attributes). "Foo" acts like some context class for entire application, but that does not matt... | <python><pytest><protocols><python-typing> | 2023-03-09 09:43:52 | 1 | 419 | mehekek |
75,682,481 | 13,443,954 | Expect value of a dropdown select based on option text | <p>We have a dropdown select</p>
<pre><code><select id="favorite-colors" multiple>
<option value="R">Red</option>
<option value="G">Green</option>
<option value="B">Blue</option>
</select>
</code></pre>
<p>In playwright we can... | <python><pytest><playwright><playwright-python> | 2023-03-09 09:10:18 | 2 | 333 | M András |
75,682,411 | 3,560,215 | How to write multi-line Python script block in GitLab pipeline using a YAML file | <p>The following script block works perfectly for me when run as a simple Python script from VSCode.</p>
<pre><code> d = {'A':123, 'B':456, 'C':789, 'D':222}
for key, value in d.items():
print(f'{key} {value}')
</code></pre>
<p>However, I'm desperate to replicate this in a GitLab pipeline and considered whet... | <python><gitlab-ci><codeblocks><gitlab-ci.yml> | 2023-03-09 09:04:04 | 0 | 971 | hitman126 |
75,682,388 | 13,174,189 | How to merge two data frames and keep not all matches? | <p>there are 2 dataframes:
d1:</p>
<pre><code>id city position
1 NY manager
2 NY manager
3 NY manager
4 NY Engineer
5 LA Engineer
6 LA Designer
</code></pre>
<p>d2:</p>
<pre><code>team city position
a NY manager
a NY... | <python><python-3.x><dataframe><merge> | 2023-03-09 09:02:00 | 2 | 1,199 | french_fries |
75,682,376 | 8,309,065 | scrapy run thousands of instance of the same spider | <p>I have the following task:
in the DB we have ~2k URLs.
for each URL we need to run spider until all URLs will be processed.
I was running spider for a bunch of URLs (10 in one run)</p>
<p>I have used the following code:</p>
<pre class="lang-py prettyprint-override"><code>from scrapy.crawler import CrawlerProcess
fro... | <python><scrapy><twisted> | 2023-03-09 09:01:14 | 1 | 1,943 | Roman |
75,682,363 | 12,536,540 | Using numpy in sklearn FunctionTransformer inside pipeline | <p>I'm training a regression model and inside my pipeline I have something like this:</p>
<pre><code>best_pipeline = Pipeline(
steps=[
(
"features",
ColumnTransformer(
transformers=[
(
"area",
... | <python><numpy><scikit-learn><dill> | 2023-03-09 09:00:10 | 2 | 992 | sergiomahi |
75,682,355 | 6,550,894 | Pandas: combination with highest coverage | <p>In a supermarket I selected 30 products on which we want to run an analysis. I want to see which 12 of them give me the widest coverage of clients (on a specific date, no time involved).</p>
<p>This means that I have 30!/(12!(30-12)!) = 86493225 combinations of products</p>
<p>My pandas dataframe of clients purchase... | <python><pandas> | 2023-03-09 08:59:32 | 1 | 417 | lorenzo |
75,682,154 | 1,920,368 | How to hint a custom overload decorator correctly? | <p>is there anyone knows how to overload hint like the default <code>overload.decorator</code> do?</p>
<p>I have a custom working overload decorator, but <strong>cannot hint correctly</strong>.</p>
<p>* the way to custom overload decorator for example</p>
<ul>
<li><a href="https://stackoverflow.com/questions/11371309/m... | <python><overloading><decorator><python-decorators> | 2023-03-09 08:40:00 | 1 | 4,570 | Micah |
75,681,976 | 376,929 | Call downstream assets or ops in parallel with Dagster | <p>I build a data pipeline with Dagster using the <code>asset</code> API.</p>
<p>I am looking for a way to explicitly call/execute an <code>asset</code> (or <code>op</code>) for a list of items. While <code>assets</code> are executed in parallel if they are independent, I did not find a way to include iteration.</p>
<p... | <python><dagster> | 2023-03-09 08:20:00 | 0 | 9,369 | Martin Preusse |
75,681,743 | 5,575,597 | How to plot selected columns of a Pandas dataframe using Bokeh 2.4.3 | <p><strong>For future visitors: My original question was closed as a duplicate, but the old 'multiline' function in the linked answer is depreciated years ago.</strong></p>
<p>I would like to plot a selection of pandas columns using bokeh, i.e. multiple lines in one chart. Code showing one column/line works:</p>
<pre><... | <python><pandas><bokeh> | 2023-03-09 07:50:43 | 1 | 863 | cJc |
75,681,677 | 8,176,763 | Airflow AttributeError: 'coroutine' object has no attribute 'update_relative' | <p>I have my dag as such:</p>
<pre><code>from datetime import timedelta
import pendulum
from airflow.decorators import dag
from stage import stage_data
from table_async_pg import main
@dag(
dag_id = "data-sync",
schedule_interval = "1 * * * *",
start_date=pendulum.datetime(2023, 3, 8, tz="Asia... | <python><airflow> | 2023-03-09 07:42:43 | 2 | 2,459 | moth |
75,681,570 | 17,580,381 | Am I misunderstanding the Python documentation? | <p>Although not absolutely necessary, I thought it would be nice to have a multiprocessing Queue that I could use in the style of a Work Manager.</p>
<p>This is what I wrote:</p>
<pre><code>from multiprocessing import Queue
class WMQueue(Queue):
def __init__(self):
super().__init__()
def __enter__(self... | <python> | 2023-03-09 07:29:37 | 1 | 28,997 | Ramrab |
75,681,549 | 1,061,155 | Use a pool of coroutine workers or one coroutine per task with Semaphore | <p>Suppose I have one million web pages to download. Should I use a fixed number of coroutine workers to download them, or create a coroutine per url and use <code>asyncio.Semaphore</code> to limit the numbers of coroutines.</p>
<p>First option, fixed workers:</p>
<pre class="lang-py prettyprint-override"><code>async d... | <python><python-asyncio> | 2023-03-09 07:27:29 | 1 | 10,551 | ospider |
75,681,345 | 12,135,668 | Mark the end of the file in apache beam/dataflow streaming pipeline and ReadAllFromText | <p>Is there any option to achieve in apache beam/dataflow streaming mode (Python SDK) something like this:</p>
<ul>
<li>read from PubSub. Message will contain path to GCS file [Easy to do].</li>
<li>read this file in parallel manner (ReadAllFromText) [Easy to do].</li>
<li>Some DoFn transformation operating on single r... | <python><streaming><google-cloud-dataflow><apache-beam> | 2023-03-09 06:58:42 | 0 | 919 | Pav3k |
75,680,861 | 10,437,110 | python equivalent for MATLABS vratiotest | <p>I am following the book <code>Algorithmic Trading</code> and I am on <code>Chapter 2: The Basics of Mean Reversion</code>.</p>
<p>I have a few pairs and their close prices and I want to check the spread of which pair is mean-reverting.</p>
<p>The book uses MATLAB for all its programming and I am using Python.</p>
<... | <python><matlab> | 2023-03-09 05:50:04 | 1 | 397 | Ash |
75,680,658 | 10,466,809 | Where to put a small utility function that I would like to use across multiple packages/projects that I develop? | <p>Right now I have <em>one</em> function that would be useful in a number of distinct packages that I work on. The function is only a handful of lines. But I would like to be able to use this code in a number of packages/projects that I work on and are deployed, I would like this code to be version controlled etc. The... | <python><utility-method><requirements-management> | 2023-03-09 05:12:56 | 1 | 1,125 | Jagerber48 |
75,680,624 | 8,176,763 | webserver ui shows dag import errors but dag still runs fine | <p>My webserver web UI shows import error messages:</p>
<p><a href="https://i.sstatic.net/C0o3b.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/C0o3b.png" alt="enter image description here" /></a></p>
<p>However my dags are running fine without error. What could be wrong here ??</p>
<p><code>airflow info... | <python><airflow> | 2023-03-09 05:06:05 | 1 | 2,459 | moth |
75,680,488 | 10,339,757 | Set variable column values to nan based on row condition | <p>I want to be able to variably change a column value based on the value of the first column.</p>
<p>Say I have a dataframe as follows:</p>
<pre><code>col_ind col_1 col_2 col_3
3 a b c
2 d e f
1 g h i
</code></pre>
<p>I effectively want to do</p... | <python><python-3.x><pandas><slice> | 2023-03-09 04:38:29 | 4 | 371 | thefrollickingnerd |
75,680,358 | 7,238,787 | PyTorch data/wieght type mismatch event after calling tensor.to(torch.float) | <p>As title, how to solve the issue?
OS: Ubuntu 16.04
Python version: 3.8
torch version: 1.10.1</p>
<pre><code># Instantiate the neural network and optimizer
net = InceptionNetModel()
net.to(device)
optimizer = optim.Adam(net.parameters(), lr=0.01)
criterion = nn.BCELoss()
# Train the neural network
for epoch in range... | <python><pytorch> | 2023-03-09 04:07:38 | 0 | 521 | jabberwoo |
75,680,338 | 800,735 | In Python ProcessPoolExecutor, do you need call shutdown after getting a BrokenProcessPool exception? | <p>In Python ProcessPoolExecutor, do you need call shutdown after getting a BrokenProcessPool exception?</p>
<p>Say I have something like this:</p>
<pre><code>pool = ProcessPoolExecutor(max_workers=1)
try:
return pool.submit(
do_something,
).result()
except concurrent.futures.process.BrokenProc... | <python><multiprocessing><python-multiprocessing><process-pool> | 2023-03-09 04:04:15 | 1 | 965 | cozos |
75,680,321 | 13,710,421 | In python/selenium, how to get Amazon web page item ratings information | <p>In python/selenium, I want to get the item star in Amazon web page, but failed .Anyone can help ? Thanks!</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('excludeS... | <python><selenium-webdriver><web-scraping><css-selectors><webdriverwait> | 2023-03-09 04:01:28 | 1 | 2,547 | anderwyang |
75,680,119 | 2,320,476 | Validate data sent as a request in json | <p>I am working on a lambda code for an API in AWS. I am passing a json data within my body which is
shown like this when I print my event within the lambda.</p>
<pre><code> 'body': '{\r\n "STTN": "415263",\r\n "Account": "22568758"\r\n}\r\n',
</code></pre>
<p>Here is how I... | <python><json> | 2023-03-09 03:13:27 | 2 | 2,247 | Baba |
75,680,056 | 7,995,293 | Decorator causing my function to not accept positional argument? | <p>I am learning how to use decorators. Inspired by tqdm library (progress bars), I have cobbled together a decorator, heavily inspired by <a href="https://github.com/tqdm/tqdm/issues/458" rel="nofollow noreferrer">this</a> code. The goal is to use multithreading to have a progress indicator blink/spin/count in stdout ... | <python><typeerror><decorator><python-decorators> | 2023-03-09 02:59:52 | 2 | 399 | skytwosea |
75,679,882 | 4,688,190 | Python print every unique combination of list items | <p>What is the cleanest (most "pythonic") way of printing every unique combination of three items in the following list?</p>
<pre><code>strats = ["1","2","3","4"]
</code></pre>
<p>The solution needs to avoid duplicates:</p>
<pre><code>1 and 1 and 1 No (not unique)
1 and... | <python><scipy> | 2023-03-09 02:17:40 | 1 | 678 | Ned Hulton |
75,679,869 | 1,610,626 | Microsoft Tick time to Python Datetime | <p>There's a lot of answers to my question but mine is a little different in that I'm not entirely sure if its Microsoft's tick time. The situation is I'm receiving the following from my firms API and they've told me its tick time but it doesn't match with what I'm getting after using methods from SO to convert.</p>
<p... | <python><c#><.net> | 2023-03-09 02:15:35 | 1 | 23,747 | user1234440 |
75,679,839 | 19,425,874 | Printing to local printer using Python but printer cannot be found | <p>I'm completely stuck trying to figure out why this code isn't working. I'm ultimately trying to print to the printer named "Label Printer'. I can't seem to figure out why I cannot do it in Python, I've tested it out of Python and it's definitely connected and working.</p>
<p>Does it need to be defined differen... | <python><tkinter><printing><pywin32> | 2023-03-09 02:10:00 | 0 | 393 | Anthony Madle |
75,679,799 | 7,479,675 | Finding an element within iframes on a webpage, py + undetected_chromedriver | <p>I want to write a method that can help me locate an element on a webpage that contains multiple iframes. Currently, I have to manually search through these iframes every time I need to find a specific element. I want to automate this process so that I only need to know the name of the element I am looking for.</p>
<... | <python><selenium-webdriver><undetected-chromedriver> | 2023-03-09 02:01:11 | 1 | 392 | Oleksandr Myronchuk |
75,679,667 | 5,212,614 | How can I do a cumulative count of IDs, sorted, in a dataframe? | <p>I have a dataframe that looks like this.</p>
<pre><code>import pandas as pd
data = {'ID':[29951,29952,29953,29951,29951],'DESCRIPTION':['IPHONE 15','SAMSUNG S40','MOTOROLA G1000','IPHONE 15','IPHONE 15'],'PRICE_PROVIDER1':[1000.00,1200.00,1100.00,1000.00,1000.00]}
df = pd.DataFrame(data)
df
</code></pre>
<p><a hre... | <python><python-3.x><pandas><dataframe> | 2023-03-09 01:31:18 | 2 | 20,492 | ASH |
75,679,636 | 7,794,924 | How to add escape characters to a filename to be consumed later by a shell command? | <p>I am trying to find out which of my video files are corrupted. I loop through a directory, grab each video file, and check if it is corrupt/healthy. If the filename has no spaces nor special characters, it will work. Unfortunately, many of my files have spaces or parenthesis in the name, and this causes my shell com... | <python><bash><macos><ffmpeg> | 2023-03-09 01:25:44 | 1 | 812 | nhershy |
75,679,635 | 13,730,432 | Integrity error with Django models (NOT NULL constraint failed) | <p>can someone please help with the below error? I get the error when I am trying to update my models database.</p>
<p>IntegrityError at /configuration/solarwinds/
NOT NULL constraint failed: pages_cityname.name
Django Version: 3.2.5
Exception Type: IntegrityError
Exception Value:<br />
NOT NULL constraint failed: page... | <python><django> | 2023-03-09 01:25:43 | 1 | 701 | xis10z |
75,679,599 | 2,903,532 | Python context manager to handle multiple exceptions in a series | <p>I am wanting to use a context manager to catch not just one Exception, like in <a href="https://stackoverflow.com/a/60367552/2903532">this answer</a>, but an arbitrary number of Exceptions in series, so that the following code will perform custom code to handle the <code>ModuleNotFoundError</code> three times:</p>
<... | <python><error-handling><try-except><contextmanager> | 2023-03-09 01:18:40 | 1 | 1,285 | reynoldsnlp |
75,679,596 | 1,012,542 | Partitioning a graph by the min cut given the `MaximumFlowResult` from `scipy.sparse.csgraph.maximum_flow` | <p>SciPy provides an implementation of a max flow algorithm: <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.maximum_flow.html" rel="nofollow noreferrer">https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.maximum_flow.html</a></p>
<p>I would like to partition th... | <python><graph><scipy><max-flow> | 2023-03-09 01:18:30 | 1 | 665 | Daniel |
75,679,547 | 4,064,166 | Why is there a discrepancy in Chebyshev coefficients? | <p>I am trying to calculate Chebyshev nodes to approximate the cos function in the interval <code>[-1,1]</code> with a polynomial of degree <code>4</code>. In <code>Python3</code>, I used <code>chebyfit</code> from <code>mpmath</code> and <code>chebyshev</code> from <code>numpy</code>.</p>
<p>While I am getting accurat... | <python><numpy><curve-fitting><mpmath><polynomial-approximations> | 2023-03-09 01:04:32 | 0 | 577 | Devharsh Trivedi |
75,679,449 | 1,368,195 | Built an app with wxPython to send requests to REST API using Windows auth, but the app gets stuck at requests.post when compiled | <p>I tried to build an app (see a simplified version below) using wxPython that sends requests to a REST API endpoint using the <code>requests</code> package and the <code>requests_negotiate_sspi</code> package for Windows authentication. When I run the script in the command line without compiling it with <code>pyinsta... | <python><rest><python-requests><wxpython><pyinstaller> | 2023-03-09 00:39:33 | 0 | 4,180 | Alex |
75,679,369 | 1,330,719 | Picking a Python Interpreter in VS Code when using Docker and poetry | <p>I open a monorepo folder within VS Code where the top folders are different services. One of the services is a python service using poetry to install dependencies.</p>
<p>I am using poetry's <code>in-project=true</code> <code>virtualenv</code> setting so that all dependencies are actually stored in <code>./python-se... | <python><docker><visual-studio-code><python-poetry> | 2023-03-09 00:19:37 | 1 | 1,269 | rbhalla |
75,679,120 | 10,964,685 | Include figure parameters as a callback option - Dash | <p>I've got a callback function that changes a figure to various spatial maps. When hexbin is selected, I'm aiming to include parameters to alter the figure.</p>
<p>Is it possible to only insert these parameters when the <code>hexbin</code> option is selected?</p>
<pre><code>import dash
from dash import dcc
from dash i... | <python><plotly><plotly-dash> | 2023-03-08 23:25:29 | 1 | 392 | jonboy |
75,679,077 | 14,088,919 | Plot many PartialDependencePlot lines in one plot for multiclass classification | <p>Kind of a broad question but I need to plot many <code>PartialDependencePlot</code> lines in the same plot - one line for each target in the multiclass classification, for each variable in the dataset. So for variable <code>age</code> I'd have one plot with the many PDP lines, one for each target (I have 10), and so... | <python><matplotlib><scikit-learn><xgboost> | 2023-03-08 23:16:57 | 1 | 612 | amestrian |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.