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,996,280 | 4,865,723 | Problems with lookahead in RegEx | <p>I still have problems with regex lookahead. In this example here I'm not sure if I misunderstand the intention of lookahead or of I just use the wrong syntax.</p>
<h1>Initial situation</h1>
<p>The input lines can look like this, where <code>one</code> and <code>two</code> should be the result.</p>
<ol>
<li><code>[[o... | <python><regex> | 2023-04-12 13:51:29 | 1 | 12,450 | buhtz |
75,996,117 | 9,758,922 | Numpy mean giving slightly different results based on row order | <p>In a test case we are using <code>np.testing.assert_allclose</code> to determine whether two data sources agree with each other on the mean. But despite having the same the data in a different the order, the computed means are slightly different. Here is a the shortest working example:</p>
<pre class="lang-py pretty... | <python><arrays><numpy><mean> | 2023-04-12 13:36:00 | 1 | 11,275 | nuric |
75,996,083 | 10,232,932 | AttributeError: module 'pytorch_lightning.utilities.distributed' has no attribute 'log' | <p>I am working with visual studio code in a personal / local enviornment for Visual Studio and Python:</p>
<pre><code>c:\Users\Mister\Documents\Visual Studio 2017\Forecasts\src\Test_Run.py
c:\Users\Mister\AppData\Local\Programs\Python\Python311\Lib\site-packages\...
</code></pre>
<p>somehow when I try to run:</p>
<pre... | <python><pytorch-lightning> | 2023-04-12 13:31:48 | 1 | 6,338 | PV8 |
75,996,003 | 9,905,185 | regexp. Find sub string in string | <p>I have strings like:</p>
<blockquote>
<p>q.0.0.0.1-1111, q.0.0.0.1.tt_0-1111, tes-00000000-1111, q.00.00.000.0.xx_0-1111</p>
</blockquote>
<p>I have next regexp:</p>
<blockquote>
<p>(?:(?<=[^-\s]{4}.\d{3})|(?<=[^-\s]{7}))[^-]+(?=-)|(?<=-)[^-\s]+-</p>
</blockquote>
<p>It work well with all cases except q.00.... | <python><regex> | 2023-04-12 13:22:33 | 1 | 766 | MrOldSir |
75,995,974 | 1,338,877 | Run CDK inside lambda execution | <p>I have to update CloudWatch Dashboards often.</p>
<p>I'm trying to run CDK from a lambda execution to get the Cloudformation template.</p>
<p>When it is executing the constructor <code>app = cdk.App(outdir="./tmp")</code> it throws an exception</p>
<pre><code>[ERROR] FileNotFoundError: [Errno 2] No such fi... | <python><aws-lambda><aws-cdk> | 2023-04-12 13:20:10 | 1 | 650 | Renato Ramos Nascimento |
75,995,689 | 18,108,367 | Pipeline, watch() and multi() in redis. How do they really work? | <p>I'm trying to understand the correct use of commands <code>multi</code> and <code>watch</code> for the access to a database Redis.</p>
<h3>The context</h3>
<p>I'm using:</p>
<ul>
<li>the Python Client for Redis <a href="https://pypi.org/project/redis/3.5.3/" rel="nofollow noreferrer">redis-py version 3.5.3</a>.</li>... | <python><redis><transactions><watch><redis-py> | 2023-04-12 12:53:26 | 2 | 2,658 | User051209 |
75,995,450 | 9,488,023 | Pandas apply a function to specific rows in a column based on values in a separate column | <p>So what I have is a Pandas dataframe with two columns, one with strings and one with a boolean. What I want to do is to apply a function on the cells in the first column but only on the rows where the value is False in the second column to create a new column. I am unsure how to do this and my attempts have not work... | <python><pandas><dataframe><conditional-statements><boolean> | 2023-04-12 12:28:00 | 2 | 423 | Marcus K. |
75,995,342 | 6,357,916 | One rest endpoint works just fine, other gives CORs error | <p>I have a react client app and django server app. React app is running on port <code>9997</code> and server API is available on port <code>9763</code>. Frontend is able to access some APIs while some APIs are failing with error:</p>
<p><a href="https://i.sstatic.net/jPjSJ.png" rel="nofollow noreferrer"><img src="http... | <javascript><python><reactjs><django><cors> | 2023-04-12 12:15:51 | 1 | 3,029 | MsA |
75,995,306 | 241,515 | Pandas groupby: add suffix to elements which are identical across groups | <p>I have a dataframe like this:</p>
<pre><code> peakID cytoband start end length 10.388_116 10.193_156 10.401_184 10.214_385
0 Amp_2q37.3_chr2:237990001-242193529 2q37.3 237990001 242193529 4203528 1 0 0 0
1 Del_2q37.3_ch... | <python><pandas><group-by> | 2023-04-12 12:12:35 | 1 | 4,973 | Einar |
75,995,195 | 12,361,700 | Is Tensorflow positional encoding wrong? | <p>I was checking this guide <a href="https://www.tensorflow.org/text/tutorials/transformer#the_embedding_and_positional_encoding_layer" rel="nofollow noreferrer">https://www.tensorflow.org/text/tutorials/transformer#the_embedding_and_positional_encoding_layer</a> and I saw this positional encoding function:</p>
<pre><... | <python><numpy><tensorflow> | 2023-04-12 11:58:24 | 1 | 13,109 | Alberto |
75,995,160 | 3,482,266 | How to optimize this python pandas code using .to_dict? | <p>When I run locally, in my laptop (using python 3.10 and pandas 1.3.5), the following code, I get 0.031s approximately (ball parking it):</p>
<pre><code>profile_data = (
profiles_df[data_cols]
.loc[profile_ids]
.rename(columns=new_cols)
.to_dict("re... | <python><pandas><kubernetes> | 2023-04-12 11:53:28 | 1 | 1,608 | An old man in the sea. |
75,994,951 | 12,234,535 | Python+xarray: Displaying datasets | <p>I have a dataset, which I am to interpolate.</p>
<p><a href="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?dir=%2Fgfs.20230411%2F00%2Fatmos&file=gfs.t00z.pgrb2.0p25.f000&var_TMP=on&lev_2_m_above_ground=on&subregion=&toplat=51&leftlon=1&rightlon=4&bottomlat=47" rel="nofol... | <python><dataset><coordinates><interpolation><python-xarray> | 2023-04-12 11:29:17 | 1 | 379 | Outlaw |
75,994,909 | 6,528,055 | Can I use numpy.ndarray and pandas.core.series as two inputs to sklearn accuracy_score? | <p>My <code>sklearn</code> <code>accuracy_score</code> function takes two following inputs:</p>
<pre><code>accuracy_score(y_test, y_pred_class)
</code></pre>
<p><code>y_test</code> is of <code>pandas.core.series</code> and <code>y_pred_class</code> is of <code>numpy.ndarray</code>. <strong>So do two different inputs pr... | <python><pandas><numpy><scikit-learn> | 2023-04-12 11:24:22 | 1 | 969 | Debbie |
75,994,898 | 9,827,719 | Python and PostgreSQL running on Google Cloud Functions 2nd generation gives "FileNotFoundError: [Errno 2] No such file or directory /engine/base.py" | <p>I am using Google Cloud Functions 2nd generation in order deploy and run my applications.</p>
<p><strong>I deploy my application using the following command:</strong></p>
<pre><code>gcloud functions deploy postgresql-python-examples
--gen2
--runtime=python311
--region=europe-west1
--source=.
--entry-point=main ... | <python><google-cloud-functions> | 2023-04-12 11:23:38 | 0 | 1,400 | Europa |
75,994,788 | 18,215,498 | can every async/await expression is asynchronous in python? | <p>I have some basic understanding about asyncio concepts in python, but yesterday I played around with it a little bit and now I am confused:</p>
<p>First snippet is obviously asynchronous:</p>
<pre class="lang-py prettyprint-override"><code>#snippet 1
import asyncio
async def one():
asyncio.create_task(two())
... | <python><asynchronous><python-asyncio> | 2023-04-12 11:11:07 | 1 | 533 | mcdominik |
75,994,533 | 1,516,331 | How to extract the data from a Highcharts trend plot on a webpage? | <p>I'm not familiar with front end techniques.So I'm not sure if this can actually works. Here is a web page about the residential vacancy rate of a suburb 2000: <a href="https://sqmresearch.com.au/graph_vacancy.php?postcode=2000" rel="nofollow noreferrer">https://sqmresearch.com.au/graph_vacancy.php?postcode=2000</a>.... | <javascript><python><html><highcharts><web-crawler> | 2023-04-12 10:43:27 | 2 | 3,190 | CyberPlayerOne |
75,994,336 | 6,389,268 | Creating successful combination of sets of from combination table | <p>Good day,</p>
<p>I wish to select two control subjects for each of my selected subjects. I got beginning data like thus:</p>
<pre><code>Cohort Controls
#a #1
#a #2
#a #3
#a #4
#b #1
#b #2
#c #5
#c #6
#c #1
#c #2
</code></pre>
<p>I want result table with unique Con... | <python><pandas><set> | 2023-04-12 10:18:44 | 1 | 1,394 | pinegulf |
75,994,227 | 8,746,466 | How to remove text and make the corresponding element an empty tag using `lxml`? | <p>I wanted to make my XML document more data-centric.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: right;"></th>
<th style="text-align: left;"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: right;">original input</td>
<td style="text-align: left;"><code><... | <python><lxml> | 2023-04-12 10:07:50 | 1 | 581 | Bálint Sass |
75,993,940 | 638,048 | Python: chmod is NOT preventing file from being deleted | <p>I'm setting the mode on a file to try to prevent it being deletable, but nothing seems to work.
Example:</p>
<pre><code>import os
from stat import S_IRUSR, S_IRGRP, S_IROTH
with tempfile.TemporaryDirectory() as local_dir:
local_file = os.path.join(local_dir, 'a.txt')
with open(local_file, 'wt') as f:
... | <python><chmod> | 2023-04-12 09:33:43 | 1 | 936 | Richard Whitehead |
75,993,918 | 12,148,704 | How to properly annotate dataclasses with attributes that are not initialized? | <p>Given the following code:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Self
from dataclasses import dataclass, field
@dataclass
class MyClass:
var: float = field(init=False)
def __post_init__(self: Self) -> None:
self.var = True
</code></pre>
<p>My expection is that th... | <python><python-typing><mypy> | 2023-04-12 09:30:35 | 1 | 550 | tschmelz |
75,993,823 | 2,550,406 | What is the difference between typing.Callable and callable? | <p>In vscode, when I have not performed <code>from typing import Callable</code>, it suggests to use <code>callable</code>.</p>
<p><code>typing.Callable</code> is <a href="https://docs.python.org/3/library/typing.html#typing.Callable" rel="nofollow noreferrer">documented here</a> as an annotation used for type-hinting ... | <python> | 2023-04-12 09:19:35 | 1 | 6,524 | lucidbrot |
75,993,765 | 17,596,179 | duckdb (0.7.0) not supporting PEP 517 builds | <p>I'm trying to dockerize my backend so I can upload it on AWS lambda but I'm encountering this error constantly.
<code>Note: This error originates from the build backend, and is likely not a problem with poetry but with duckdb (0.7.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep5... | <python><docker><dockerfile><python-poetry><duckdb> | 2023-04-12 09:13:42 | 0 | 437 | david backx |
75,993,763 | 5,250,620 | How to change bar chart color when using Holoview with Plotly backend? | <p>I am using example in this <a href="https://holoviews.org/reference/elements/plotly/Bars.html" rel="nofollow noreferrer">documentation</a></p>
<p>This is code to plot Bar chart but change default blue color to red, using Bokeh backend.</p>
<pre><code>import holoviews as hv
hv.extension('bokeh')
data = [('one',8),('... | <python><plotly><bar-chart><holoviews> | 2023-04-12 09:13:31 | 0 | 5,576 | Haha TTpro |
75,993,650 | 9,374,372 | Good Patterns to pass down data in deep OOP composition? | <p>This is a general open question about best practices and scalability in Python using OOP.</p>
<p>Overtime, I have been using in several projects Class inheritance and composition. This pattern has helped me abstracting and encapsulating a lot of the code. However, as the codebase increases, I have been trapped in a ... | <python><oop><design-patterns> | 2023-04-12 09:00:40 | 1 | 505 | Fernando Jesus Garcia Hipola |
75,993,532 | 188,331 | AttributeError: 'Seq2SeqTrainer' object has no attribute 'push_in_progress' | <p>I'm using HuggingFace's <code>Seq2SeqTrainer</code> and I successfully trained a model. When I try to execute (where trainer is an instance of <code>Seq2SeqTrainer</code>):</p>
<pre><code>trainer.push_to_hub()
</code></pre>
<p>It returns error:</p>
<blockquote>
<p>AttributeError: 'Seq2SeqTrainer' object has no attri... | <python><huggingface> | 2023-04-12 08:45:54 | 1 | 54,395 | Raptor |
75,993,493 | 5,091,467 | How to find permutation importance using sparse matrix X? | <p>I have a sparse matrix X (<code>csr_matrix</code>), since a dense version does not fit into RAM.</p>
<p>I want to find permutation importance for my estimator using the sparse matrix X.</p>
<p>When I run the following code, I receive an error <code>TypeError: A sparse matrix was passed, but dense data is required.</... | <python><scikit-learn><sparse-matrix> | 2023-04-12 08:41:13 | 1 | 714 | Dudelstein |
75,993,380 | 6,400,443 | Memory usage skyrocketting while reading Parquet file from S3 with Polars | <p>I try to read multiple Parquet files from S3. I read using Polars and Pyarrow with the following command :</p>
<pre><code>pl.scan_pyarrow_dataset(ds.dataset(f"my_bucket/myfiles/",filesystem=s3)).collect()
</code></pre>
<p>There is 4 files in the folder, with the following sizes : 120MB, 102MB, 85MB, 75MB</... | <python><docker><amazon-s3><parquet><python-polars> | 2023-04-12 08:25:39 | 1 | 737 | FairPluto |
75,993,306 | 9,097,114 | Unable to select value from dropdown python selenium | <p>I am trying to pass/ select city name/station in Wunderground website, but unable select the city name from the dropdown list. From the below picture how to select "New York City,NY". Here is my code</p>
<p><a href="https://i.sstatic.net/Pjx1N.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/... | <python><selenium-webdriver><xpath><selenium-chromedriver><webdriverwait> | 2023-04-12 08:15:34 | 1 | 523 | san1 |
75,993,187 | 2,924,334 | pygal: How do I specify a different stroke width for different lines? | <p>I would like to have different line thickness for the different lines. I tried specifying <code>width</code> using the <code>stroke_style</code> but it does not seem to help.</p>
<pre><code>import pygal
chart = pygal.XY()
chart.add(**{'title': 'Line A', 'values': [(1, 1), (10, 10)]})
chart.add(**{'title': 'Line B',... | <python><pygal> | 2023-04-12 07:58:40 | 0 | 587 | tikka |
75,992,698 | 20,051,041 | How do I click on clickable element with Selenium in shadow-root (closed)? | <p>An "Agree with the terms" button appears on <a href="https://www.sreality.cz/hledani/prodej/domy" rel="nofollow noreferrer">https://www.sreality.cz/hledani/prodej/domy</a> I am trying to go through that with a .click() using Selenium and Python.
The button element is:</p>
<pre><code><button data-testid=... | <python><selenium-webdriver><web-scraping> | 2023-04-12 06:55:25 | 3 | 580 | Mr.Slow |
75,992,580 | 10,395,139 | Python request function won't download entire file | <p>I'm creating a python function to download a .zip file from Kaggle (I don't want to use the Kaggle API) with the request library. However the .zip file don't have a <code>content-length</code> header, so I can't check the size of the kaggle .zip file before downloading it.</p>
<p>So now my function looks like this, ... | <python><python-requests> | 2023-04-12 06:39:39 | 0 | 579 | Krullmizter |
75,992,526 | 1,506,850 | Typical reasons why model training on GPU not faster as expected | <p>I built a model on CPU.
The model is getting large.
When I try to move to GPU for training, I don't see the expected 10x-30x speed increase.
My net is a multi-layer convolution with FC at the end.</p>
<p>What are common reasons why GPU training can be as slow as CPU training?</p>
| <python><deep-learning><pytorch><gpu><cpu> | 2023-04-12 06:30:12 | 0 | 5,397 | 00__00__00 |
75,992,409 | 13,396,497 | Panda combine multiple rows into one row with different column names not in one column | <p>I have a csv file -</p>
<p>CSV A-</p>
<pre><code> Date/Time Num
2023/04/10 14:13:18 6122
2023/04/10 14:14:24 6005
2023/04/10 14:14:59 6004
</code></pre>
<p>There will be 3 rows max or less then that, also Num=6122 will be there always. The other two numbers(6005 & 6004) rows may or ... | <python><pandas><dataframe> | 2023-04-12 06:13:14 | 2 | 347 | RKIDEV |
75,992,360 | 15,632,586 | What should I do to build wheel for Tokenizers (with 2023 version of Rust)? | <p>I am trying to install the required Python packages for a Python project in Python 3.11 (for Windows), using <code>pip install -r requirements.txt</code>. My libraries that I need to download are:</p>
<pre><code> numpy
transformers==v3.1.0
tqdm
torch
scikit-learn
spacy
torchtext
pandas
nltk
sentence_transformers
... | <python><rust><pip><python-wheel><huggingface-tokenizers> | 2023-04-12 06:04:16 | 0 | 451 | Hoang Cuong Nguyen |
75,992,129 | 1,440,565 | Generate media url from file path in Django | <p>Let's say I have a function that writes a file to <code>MEDIA_ROOT</code>:</p>
<pre><code>def write_file():
with open(settings.MEDIA_ROOT / 'myfile.txt') as file:
file.write('foobar')
</code></pre>
<p>Now I want the absolute URL for this file as it is served from <code>MEDIA_URL</code>. Does Django have ... | <python><django> | 2023-04-12 05:18:51 | 1 | 83,954 | Code-Apprentice |
75,992,036 | 10,437,110 | Python code for this algorithm to identify outliers in k-means clustering | <p>The have an <code>input_df</code> which has stirng index and not integers.
The index could be anything like '1234a', 'abcd', and so on.</p>
<p>I have performed k-means on an input df with <code>k = 100</code> and have received <code>centroid</code> and <code>labels</code> as output.</p>
<p>If I am not wrong,</p>
<ul... | <python><k-means> | 2023-04-12 05:00:29 | 1 | 397 | Ash |
75,991,973 | 2,073,937 | Is it OK to derive the same class twice in python? | <p>I have this code:</p>
<pre class="lang-py prettyprint-override"><code>class A:
...
class B(A):
...
class C(B, A):
...
</code></pre>
<p>As you can see, class <strong>C</strong> derives <strong>A</strong> twice, once directly and once indirectly through class <strong>B</strong>.</p>
<p>Is it OK? What possible ... | <python><class> | 2023-04-12 04:43:41 | 3 | 616 | Leonid Ganeline |
75,991,895 | 11,918,314 | Python - How to get number of teams under a manager using manager hierarchy columns | <p>I have a dataframe with the employee emails, manager emails and the manager hierarchy columns. Am trying to get the number of teams that a manager has.</p>
<p>My current dataframe</p>
<pre><code>emp_email mgr_email mgr_hier_01 mgr_hier_02 mgr_hier_03
jack@abc.com cook@abc.com C... | <python><pandas><dataframe><group-by><hierarchy> | 2023-04-12 04:25:23 | 1 | 445 | wjie08 |
75,991,822 | 6,087,589 | from transformers import AutoTokenizer, AutoModel | <p>I am running this code:</p>
<p>I have these updated packages versions:
tqdm-4.65.0 transformers-4.27.4</p>
<p>I am running this code:
from transformers import AutoTokenizer, AutoModel</p>
<p>I am obtaining this erros:
ImportError: cannot import name 'ObjectWrapper' from 'tqdm.utils' (/Users/anitasancho/opt/anaconda3... | <python><import><filenames><huggingface-transformers><tqdm> | 2023-04-12 04:08:56 | 1 | 419 | anitasp |
75,991,817 | 11,938,023 | How do I update a pandas/numpy row with a xor of a next row into that same row | <p>Ok, the question is if there is a fast way with pandas or numpy to xor an array and update the next row with the results.</p>
<p>Basically I have a pandas data frame named 'ss' like so:</p>
<pre><code> rst no1 no2 no3 no4 no5 no6 no7
0 1 6 2 15 14 9 5 1
1 11 0 0 0 0 ... | <python><pandas><numpy><xor> | 2023-04-12 04:06:33 | 1 | 7,224 | oppressionslayer |
75,991,643 | 400,119 | FastAPI coerces a boolean to string when the type is defined str | bool | <p>When running my code with <code>main.py</code> and <code>config.py</code> I get <code>config.testing</code> back as a <code>str</code> and not a <code>bool</code>.</p>
<p>Repo/branch here: <a href="https://github.com/dycw/tutorial-test-driven-development-with-fastapi-and-docker/blob/getting-started/" rel="nofollow n... | <python><fastapi><pydantic> | 2023-04-12 03:21:10 | 2 | 657 | Derek |
75,991,578 | 11,634,498 | TypeError: `generator` yielded an element of shape (32, 224, 224, 3) where an element of shape (224, 224, 3) was expected | <p>My generator code has takes dataframe(csv file) and images as input and generates images with label.
My generator code is:</p>
<pre><code>class ImageSequence:
def __init__(self, df, mode,img_size=(224, 224), num_channels=3):
self.df = df
self.indices = np.arange(len(df))
self.batch_size =... | <python><tensorflow><generator><tensorflow-datasets> | 2023-04-12 03:05:39 | 1 | 644 | Krupali Mistry |
75,991,516 | 1,232,087 | From a single row dataframe how to create a new dataframe containing list of column names and their values | <p><strong>Given df1</strong>:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>c1</th>
<th>c2</th>
<th>c3</th>
<th>c4</th>
<th>c5</th>
<th>c6</th>
<th>c7</th>
<th>c8</th>
</tr>
</thead>
<tbody>
<tr>
<td>45</td>
<td>15</td>
<td>100</td>
<td>68</td>
<td>96</td>
<td>86</td>
<td>35</td>
<td>48<... | <python><apache-spark><pyspark> | 2023-04-12 02:51:46 | 1 | 24,239 | nam |
75,991,498 | 14,109,040 | Flattening a list of sublists and individual elements | <p>I have a list of sublists and elements. I want to flatten the list such that only the sublists within the list are split and added to the list.</p>
<pre><code>[['item1','item2'],['item3','item4','item5'],'item6']
</code></pre>
<p>I have tried the following</p>
<pre><code>[item for sublist in [['item1','item2'],['ite... | <python> | 2023-04-12 02:45:48 | 2 | 712 | z star |
75,991,137 | 6,495,199 | Make extendable fastAPI query class | <p>Im trying to have a base query class to reuse according to the different use cases</p>
<pre><code>from fastapi.params import Query
class BaseParams:
def __init__(
self,
name: str = Query(alias="name", description="name", example="Bob"),
age: int = Query(alias... | <python><rest><fastapi><pydantic> | 2023-04-12 00:59:59 | 1 | 354 | Carlos Rojas |
75,990,991 | 11,737,958 | How to get the file name given in tkinter save dialog | <p>I am new to python. I use tkinter to create a text file editor. I try to save the file contents to a text file. If i save the file name as "abc.txt" or "abc", how do i get the file name in code which is given in file name dialog before saving the file. Thanks in advance!</p>
<p><a href="https://i... | <python> | 2023-04-12 00:20:17 | 1 | 362 | Kishan |
75,990,892 | 6,075,349 | Pandas stacked bar plot with multi week data | <p>I have a <code>df</code> as follows:</p>
<pre><code>Week Instrument Trader Count
1 Stock 100
1 Bond 50
1 MBS 20
2 Stock 150
2 Bond 500
2 MBS 200
</code></pre>
<p>I want to created a stacked bar plot such that <code>... | <python><pandas> | 2023-04-11 23:52:57 | 1 | 1,153 | FlyingPickle |
75,990,859 | 9,883,236 | Transforming the type of an argument of a function using decorator | <p>I am attempting to transform a certain instance that belongs to type A to type B, but I am stuck at the type annotations (using pyright to type check), I currently have the following:</p>
<pre class="lang-py prettyprint-override"><code>A = TypeVar("A")
B = TypeVar("B")
T = TypeVar("T")... | <python><python-typing><pyright> | 2023-04-11 23:43:35 | 0 | 345 | YousefZ |
75,990,832 | 10,387,506 | Random combination of letters and numbers in each cell of one column | <p>I haven't been able to find the solution to the loop part of the following. I have a data frame with over 500K of rows. I want to write a random combination of letters and numbers in a column we'll call "ProductID". I found solutions here that let me write simple numbers, which work, even if they're painfu... | <python><loops><random> | 2023-04-11 23:35:54 | 1 | 333 | Dolunaykiz |
75,990,828 | 7,175,049 | How to get the pandas query statement to work for to_datetime and to_timedelta? | <p>I would like to filter my dataframe so that I get only the rows with the latest 2 days of data (relative to the latest available date from the dataframe). So this code would work:</p>
<p><code>df[pd.to_datetime(df['date']) <= pd.to_datetime(df['date'].max()) - pd.to_timedelta('2 days')]</code></p>
<p>But now I wo... | <python><pandas> | 2023-04-11 23:34:26 | 0 | 400 | StatsNoob |
75,990,752 | 5,032,387 | Pipenv: Staircase package downgraded after updating to Pandas 2.0 | <p>I'm running pipenv 2023.3.20, pip 21.1.3. I updated pandas to version 2.0 from version 1.5.3. I did have to specify this version explicitly because updating as is wasn't actually updating pipfile.lock from the old version. Maybe this is a clue to the problem.</p>
<p>Now, my staircase package version has been down... | <python><pipenv><package-management> | 2023-04-11 23:15:32 | 1 | 3,080 | matsuo_basho |
75,990,745 | 6,051,652 | Remove timezone from timestamp but keep the local time | <p>I have a dataframe with epoch time. I convert the epoch time to a timestamp with my local timezone. I would like to remove the timezone information but keep my local timezone in the timestamp (subtract the timezone offset from the timestamp and then remove the timezone).
This is the code I have:</p>
<pre><code>epoch... | <python><pandas> | 2023-04-11 23:13:48 | 1 | 1,159 | Eyal S. |
75,990,694 | 840,821 | Python Atlassian JIRA iterate for next page | <p>I followed the example described here:
<a href="https://community.atlassian.com/t5/Jira-articles/Atlassian-Python-API-s/ba-p/2091355" rel="nofollow noreferrer">https://community.atlassian.com/t5/Jira-articles/Atlassian-Python-API-s/ba-p/2091355</a>
to write a toy program to get through the list of JIRAs.</p>
<pre cl... | <python><jira> | 2023-04-11 23:04:02 | 1 | 1,949 | Coder |
75,990,606 | 3,620,725 | Automatically add project to sys.path in VS Code like PyCharm/Spyder do? | <h2>Problem</h2>
<p>In a Python project with subpackages, absolute imports don't work inside any files that aren't in the project root directory.</p>
<pre><code>- my_project
- my_package
- __init__.py
- my_module.py
- my_scripts
- some_script.py
</code></pre>
<p><code>some_script.py</code></p>
<pre><c... | <python><visual-studio-code> | 2023-04-11 22:43:31 | 2 | 5,507 | pyjamas |
75,990,603 | 2,687,317 | pandas groupby and agg with multiple levels | <p>I have several very very large datasets like this (simplified). Notice however that not all SBs (in this case 1-4) are represented at every LFrame...</p>
<pre><code>LFrame, Pwr, SB, Channels_Active, Channels_Assigned
1, 10, 1, 2, 2
1, 2, 2, 2, ... | <python><pandas><dataframe> | 2023-04-11 22:43:04 | 4 | 533 | earnric |
75,990,599 | 3,750,282 | Errors with Selenium and Python and Using Chrome Driver after upgrade to a version >89 | <p>I have the following configuration, which works perfectly in it's current form.</p>
<p>I can use any chrome/chromedriver under v89 without any issues
Once I pass the v89 mark, it does not work anymore, giving the below error</p>
<p>Any help would be appreciated, since I am going crazy with this.</p>
<p>I tried diffe... | <python><google-chrome><selenium-webdriver><selenium-chromedriver><webdriver> | 2023-04-11 22:42:13 | 1 | 448 | Scobee |
75,990,526 | 10,509,939 | how to import my custom module into a python IDE like Spyder and run my module? | <p>I'm pretty new to packaging scripts and I have an issue understanding how to run my code after converting it to a package!
I've developed a script with proper files and functions and used the setup tools to convert it to a package. Suppose a simple module named "Simulation_Package" with __ <em>main</em>_ _... | <python><package><anaconda><spyder> | 2023-04-11 22:22:44 | 1 | 391 | Seji |
75,990,460 | 581,002 | Why can't Python decode this valid JSON with escaped quotes? | <p>I have this almost JSON which has something that's only similar to JSON inside:</p>
<pre class="lang-py prettyprint-override"><code>TEST_LINE = """Oct 21 22:39:28 GMT [TRACE] (Carlos-288) org.some.awesome.LoggerFramework RID=8e9076-4dd9-ec96-8f35-bde193498f: {
"service": "MyService&... | <python><json><escaping><decode> | 2023-04-11 22:07:54 | 2 | 3,039 | primfaktor |
75,990,432 | 2,778,224 | List of int and floats in Python Polars casting to object | <p>Why does the column <code>floats</code> in the following example casts to <code>object</code> instead of <code>list[f64]</code>? How can I change it to <code>list[f64]</code>?</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
dfLists = pl.DataFrame({
'ints':[ [0,1], [4,3,2]],
'floats':... | <python><dataframe><python-polars> | 2023-04-11 22:00:32 | 0 | 479 | Maturin |
75,990,424 | 6,242,883 | PyTorch - Error when trying to minimize a function of a symmetric matrix | <p>I want to minimize a loss function of a symmetric matrix where some values are fixed. To do this, I defined the tensor <code>A_nan</code> and I placed objects of type <code>torch.nn.Parameter</code> in the values to estimate.</p>
<p>However, when I try to run the code I get the following exception:</p>
<pre><code>Ru... | <python><optimization><pytorch> | 2023-04-11 21:57:57 | 1 | 1,176 | Tendero |
75,990,405 | 19,130,803 | getting error while installing black and safety | <p>I am using poetry for python application. While adding developement dependencies as below</p>
<pre><code>poetry add black flake8 flake8-import-order flake8-docstrings flake8-black flake8-bugbear safety mypy pytest-cov pytest --group dev
</code></pre>
<p>Getting error for <code>black</code> and <code>safety</code> as... | <python> | 2023-04-11 21:54:23 | 2 | 962 | winter |
75,990,307 | 3,821,009 | Pandas concatenate strings and numpy array | <p>I have this:</p>
<pre><code>n = 5
df = pandas.DataFrame(dict(j=numpy.repeat(0, n)))
df['j'] = 'prefix-'
df['j'] += numpy.arange(n).astype('U')
df['j'] += '-suffix'
print(df) ... | <python><pandas><numpy> | 2023-04-11 21:35:10 | 2 | 4,641 | levant pied |
75,990,114 | 1,287,788 | Error when writing to a compressed CSV file in Python 3.x | <p>I am trying to write data (contained in a dict) to a compressed (gzip) CSV file. As far as I understand the <a href="https://docs.python.org/3/library/gzip.html#gzip.GzipFile" rel="nofollow noreferrer">gzip.GzipFile</a> method should accept a writing operation as a normal file object. Such as:</p>
<pre><code> impo... | <python><python-3.x><csv><gzip> | 2023-04-11 21:01:31 | 1 | 318 | mauscope |
75,990,075 | 10,266,106 | Efficient Sharing of Numpy Arrays in Multiprocess | <p>I have two multi-dimensional Numpy arrays loaded/assembled in a script, named <code>stacked</code> and <code>window</code>. The size of each array is as follows:</p>
<p><code>stacked</code>: (1228, 2606, 26)</p>
<p><code>window</code>: (1228, 2606, 8, 2)</p>
<p>The goal is to perform statistical analysis at each i,j... | <python><numpy><parallel-processing><multiprocessing><numpy-ndarray> | 2023-04-11 20:55:29 | 0 | 431 | TornadoEric |
75,990,005 | 12,817,213 | How to set the text color of a textobject using reportlab pdfgen | <p>I was recently looking for the function needed to set a <code>textobject</code>'s text color. The <code>textobject</code> is a specific method of working with <code>reportlab</code>'s <code>pdfgen</code>. The documentation has some information, but it's pretty unclear.</p>
<p>Starting code:</p>
<pre><code>textobject... | <python><pdf-generation><reportlab> | 2023-04-11 20:45:04 | 1 | 921 | Austin Poulson |
75,989,972 | 850,781 | Numpy cannot `vectorize` a function | <p>I want to apply this simple function to numpy arrays <em><strong>fast</strong></em>:</p>
<pre><code>def f (x):
return max(0,1-abs(x))
</code></pre>
<p>Just for clarity's sake, here is the plot:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(start=-4,stop=4, num=100)
plt.plot(x,... | <python><numpy><vectorization> | 2023-04-11 20:39:55 | 2 | 60,468 | sds |
75,989,956 | 11,922,765 | Python Crontab run a function: OSError: "crontab: user `user' unknown\n" | <p>I want to use task scheduler inside my python script. Here is an example:</p>
<pre><code>import datetime
def myjob():
print("%s: This is my present Job"%(datetime.datetime.now()))
from crontab import CronTab
cron = CronTab(user='user')
job = cron.new(myjob)
job.minute.every(1)
cron.write()
</code><... | <python><python-3.x><cron><cron-task> | 2023-04-11 20:36:54 | 0 | 4,702 | Mainland |
75,989,908 | 15,178,267 | Django: How to get tax amount for diffrent countries and multiply it by product price in django? | <p>I am creating an ecommerce system where i would need to calculate taxes for diffrent countries during checkout. I have added a flat rate for the tax, but that is not how tax works, it need to be percentage based which i have done, but how do i know the country a user is about to order a product from and also get the... | <python><django><django-models><django-views> | 2023-04-11 20:28:10 | 1 | 851 | Destiny Franks |
75,989,899 | 13,045,595 | Can't open video saved on jetson xavier using OpenCV video writer | <p>I possess a Jetson Xavier, and I'm able to access the camera through dev/video0 or GStreamer. However, when I try to save the video in AVI or MP4 formats, I'm unable to open it. Based on the video size, which is around 10-12 MB, I believe it should contain the frames. How can I properly save and reopen the video lat... | <python><opencv><jetson-xavier> | 2023-04-11 20:27:22 | 1 | 335 | M.Akyuzlu |
75,989,831 | 8,285,736 | os.path.join(*list) not working as expected when trying to convert a list to a path | <p>I'm trying to convert this list:
<code>a_list = ['c:', 'project_files', 'ProjA', 'B_Files']</code></p>
<p>into this path:
<code>'c:\\project_files\\ProjA\\B_Files'</code></p>
<p>I'm using this:</p>
<pre><code>a_list = ['c:', 'project_files', 'ProjA', 'B_Files']
my_path = os.path.join(*a_list)
</code></pre>
<p>Howeve... | <python><list><path><os.path> | 2023-04-11 20:18:10 | 1 | 643 | ATP |
75,989,822 | 2,727,655 | What is Stanford CoreNLP's recipe for tokenization? | <p>Whether you're using Stanza or Corenlp (now deprecated) python wrappers, or the original Java implementation, the tokenization rules that StanfordCoreNLP follows is super hard for me to figure out from the code in the original codebases.</p>
<p>The implementation is very verbose and the tokenization approach is not ... | <python><nlp><stanford-nlp><tokenize> | 2023-04-11 20:16:51 | 2 | 554 | lrthistlethwaite |
75,989,817 | 8,372,455 | AttributeError: 'NoneType' object has no attribute 'outputs' | <p>How do you save a tensorflow keras model to disk in h5 format when the model is trained in the scikit learn pipeline fashion? I am trying to follow <a href="https://gist.github.com/MaxHalford/9bfaa8daf8b4bc17a7fb7ba58c880675" rel="nofollow noreferrer">this example</a> but not having any luck.</p>
<p>This works to tr... | <python><tensorflow><machine-learning><keras><scikit-learn> | 2023-04-11 20:16:15 | 1 | 3,564 | bbartling |
75,989,750 | 20,266,647 | PySpark, parquet "AnalysisException: Unable to infer schema for Parquet" | <p>I got this issue, when I read data from parquet via PySpark in MLRun (it seems as invalid parquet). See exception:</p>
<pre><code>-------------------------------------------------
AnalysisException Traceback (most recent call last)
<ipython-input-19-c76c691629bf> in <module>
----> 1 ... | <python><pyspark><parquet><mlrun> | 2023-04-11 20:05:50 | 1 | 1,390 | JIST |
75,989,484 | 3,579,198 | BeautifulSoup extract URL from HTML | <p>I want to extract <code>title</code> ( "Airmeet Invite Email" ) & <code>srcset</code> URLs from following HTML using <code>bs4</code></p>
<p><a href="https://i.sstatic.net/0CInY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0CInY.png" alt="enter image description here" /></a></p>
<p>I ... | <python><beautifulsoup> | 2023-04-11 19:25:47 | 1 | 7,098 | rp346 |
75,989,399 | 13,634,560 | Polars, multiply columns | <p>This should be a straightforward python question, but it's not working for me. I have a list of strings, the columns, as well as an integer, with repeated number of columns as the output.</p>
<pre><code>multi_cols = lpd.columns
len(multi_cols)
103
multi_cols = [[k]*6 for k in lpd.columns]
len(multi_cols)
103
</code>... | <python><python-polars> | 2023-04-11 19:15:19 | 2 | 341 | plotmaster473 |
75,989,324 | 4,366,541 | Reporting Endpoints in LinkedIn Marketing API | <p>I've been trying to hit the new "versioned" LinkedIn Marketing API in an attempt to pull any kind of analytics on my campaigns. Utilizing the python and requests. Documentation found <a href="https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?view=li-lms-2023-03&a... | <python><linkedin-api> | 2023-04-11 19:04:43 | 1 | 825 | Joe Fedorowicz |
75,989,189 | 10,466,809 | Python dataclass type hints and input type conversions | <p>How should we type hint for dataclasses which can accept multiple input types but cast them all to a particular type during, e.g. <code>__post_init__</code>. Example:</p>
<pre><code>from dataclasses import dataclass
from typing import Collection, List
@dataclass
class Foo1:
input_list: Collection
def __po... | <python><python-3.x><types><casting><python-dataclasses> | 2023-04-11 18:46:25 | 3 | 1,125 | Jagerber48 |
75,989,172 | 2,103,050 | tf_agents reset environment using actor | <p>I'm trying to understand how to use <code>Actor</code> class in tf_agents. I am using DDPG (actor-critic, although this doesn't really matter per say). I also am learning off of <code>gym</code> package, although again this isn't fully important to the question.</p>
<p>I went into the class definition for <code>trai... | <python><tensorflow><openai-gym><tf-agent> | 2023-04-11 18:44:44 | 0 | 377 | brian_ds |
75,989,151 | 886,357 | Putting a value filter on pivot table in pandas | <p>I am trying to duplicate some excel functionality in pandas and we have a huge pivot table upon which we do numerous operations that are very slow.</p>
<p>Here is what I am trying to do</p>
<pre><code>import pandas as pd
Data = [["NonLin1", "NestleBig-100", "daily", "solved",... | <python><pandas> | 2023-04-11 18:43:14 | 1 | 3,593 | Morpheus |
75,989,123 | 5,342,700 | Unable to convert scraped list of dictionaries to a Pandas DataFrame | <p>I am trying to scrape tables from the following website:</p>
<p><a href="https://www.rotowire.com/betting/mlb/player-props.php" rel="nofollow noreferrer">https://www.rotowire.com/betting/mlb/player-props.php</a></p>
<p>Data for each table is within a script on the site starting with <code>data: [{ ... }]</code>. Thi... | <python><pandas><dictionary><web-scraping><beautifulsoup> | 2023-04-11 18:38:52 | 1 | 13,059 | Stu Sztukowski |
75,989,104 | 542,270 | How to install local package with transitive dependencies? | <p>I have two python projects under the same root, after <code>tree</code> it looks as follows:</p>
<pre><code>libs
└── lol-pandas
├── pyproject.toml
├── requirements-dev.txt
├── requirements.txt
├── src
│ └── lol
│ ├── __init__.py
│ └── pandas
│ ├── __init__.py
... | <python><pip> | 2023-04-11 18:36:25 | 0 | 85,464 | Opal |
75,988,992 | 14,414,944 | How can I inspect the internal state of an asyncio event loop? | <p>I have a Python program that uses <code>asyncio</code>. When concurrency is high, a particular part of the program hangs. I would like to inspect the state of the <code>asyncio</code> event loop myself, to try and understand the problem, which I have also detailed below. What can I do?</p>
<p>The part of the program... | <python><python-asyncio> | 2023-04-11 18:23:51 | 1 | 1,011 | lmonninger |
75,988,588 | 10,994,166 | Intersect a list with column pyspark | <p>I have a pyspark df like this:</p>
<pre><code>+--------------+--------------------+
| id| recs|
+--------------+--------------------+
| 420281136|[531698003, 81262...|
| 801646419|[685057033, 11542...|
| 920475166|[344077868, 99389...|
| 577242054|[242471215, 99876...|
| ... | <python><apache-spark><pyspark><apache-spark-sql> | 2023-04-11 17:24:48 | 1 | 923 | Chris_007 |
75,988,574 | 2,930,793 | download nltk data in aws lambda from python code | <p>I am trying to dowloand nltk data in AWS lambda from python code. But It says</p>
<pre><code>{
"errorMessage": "[Errno 30] Read-only file system: 'layers'",
"errorType": "OSError",
"requestId": "",
"stackTrace": [
" File \"/... | <python><amazon-web-services><aws-lambda><nltk> | 2023-04-11 17:22:55 | 2 | 903 | Sazzad |
75,988,511 | 9,390,633 | create a date range if a column value matches one | <p>I am using an answer found at <a href="https://stackoverflow.com/questions/74376972/iterate-over-select-columns-and-check-if-a-specfic-value-is-in-these-select-colu/74384246#74384246">iterate over select columns and check if a specfic value is in these select columns and use that column name that has that value to c... | <python><pandas><dataframe><apache-spark><pyspark> | 2023-04-11 17:12:32 | 1 | 363 | lunbox |
75,988,414 | 5,404,647 | Extremely slow scraping with scrapy | <p>I have written a Python script to scrape data from IMDb using the Scrapy library. The script is working fine but it is very slow and seems to be getting stuck. I have added a DOWNLOAD_DELAY of 1 second between requests but it doesn't seem to help. Here is the script:</p>
<pre><code>import scrapy
import json
class M... | <python><scrapy> | 2023-04-11 16:58:53 | 0 | 622 | Norhther |
75,988,408 | 12,300,981 | How to get errors from solved basin-hopping results (using Powell method for local) | <p>I traditionally like to use BFGS or L-BFGS because it reports the inverse-hessian for errors. However I've noticed other solvers such as Nelder-Mead and Powell, do not report the inverse-hessian. The same is true of Basin Hopping.</p>
<p>In a scenario where you are using Basin Hopping with Powell as the local minimi... | <python><scipy><scipy-optimize> | 2023-04-11 16:57:46 | 0 | 623 | samman |
75,988,341 | 1,916,588 | gc.get_referrers returns a list of dictionaries | <p>As far as I understood, <code>gc.get_referrers(my_obj)</code> should return a list of the objects that refer to <code>my_obj</code>.
However, I'm currently seeing this behaviour:</p>
<pre class="lang-py prettyprint-override"><code>import sys
import gc
my_obj = []
ref_1 = my_obj
ref_2 = my_obj
sys.getrefcount(my_obj... | <python><garbage-collection> | 2023-04-11 16:48:41 | 2 | 12,676 | Kurt Bourbaki |
75,988,280 | 13,634,560 | Select polars columns by index | <p>I have a polars dataframe of species, 89 date columns and 23 unique species. The goal is aggregation by a groupby as well as a range of columns. iloc would be the way to do this in pandas, but the select option doesn't seem to work the way I want it to.</p>
<p>In pandas:</p>
<pre><code>gb = df.groupby(["Common_... | <python><python-polars> | 2023-04-11 16:40:28 | 1 | 341 | plotmaster473 |
75,988,277 | 2,665,896 | Is there an async equivalent of unitsetUpClass in Python 3.10? | <p>I have been using <code>unittest.IsolatedAsyncioTestCase</code> to test my async methods. I have been making use of <code>setUpClass</code> and <code>asyncSetUp</code> to create a fixture, and <code>asyncTearDown</code> to cleanup. This is all working merrily so far :-)</p>
<p>But now I have a new requirement which ... | <python><python-3.x><pytest><python-unittest><pytest-asyncio> | 2023-04-11 16:40:09 | 2 | 345 | vxxxi |
75,988,174 | 143,960 | Python: OSError with Augmentor | <pre class="lang-none prettyprint-override"><code>2023-04-11 16:12:33,568 ERROR [Errno 5] Input/output error
2023-04-11 16:12:33,570 ERROR Traceback (most recent call last):
File "/home/me/bot/modules/verification.py", line 342, in onMemberJoin
p.process()
File "/home/me/.local/lib/python3.... | <python><augmentor> | 2023-04-11 16:30:37 | 0 | 1,271 | dangerisgo |
75,988,086 | 19,003,861 | How to print actual number when using Aggregate(Max()) in a Django query | <p>I have the following query set:</p>
<pre><code> max_latitude = Model.objects.aggregate(Max('latitude'))
</code></pre>
<p>When I print it, it returns <code>{'latitude__max': 51.6639002}</code> and not <code>51.6639002</code>.</p>
<p>This is causing a problem when I want to add the latitudes together to calculate an a... | <python><django><django-views> | 2023-04-11 16:19:46 | 2 | 415 | PhilM |
75,988,055 | 4,254,538 | Install Pytorch CPU Only with pip that works on Apple machine as well as Linux | <p>I'm getting install errors when I deploy a Flask app to Azure services. I've tracked the issue down to a <code>pip install torch</code> and likely being due to a CPU version.</p>
<p>I'm unable to find a way to install a CPU-only version of Pytorch that will install on both Macbook and Linux?</p>
| <python><azure><pytorch> | 2023-04-11 16:15:53 | 1 | 780 | Aus_10 |
75,988,013 | 1,629,904 | How to use django channel to create a game lobby and matchmaking | <p>I am using django channels to create a 2-player game like Tic Tac Toe or checkers.</p>
<p>My main issue is how I can preserve the state of the players that joined the lobby waiting to be paired. Would this be something I need to do in the connect method in the channel consumer? If not what if the approach here?</p>
| <python><django><game-development><django-channels><matchmaking> | 2023-04-11 16:10:21 | 1 | 332 | dianesis |
75,987,836 | 21,420,742 | How to merge multiple columns from different dataframes with different columns names in Python | <p>I have two datasets that show Employment by ID and one that shows manager approvals for work, neither one has identical column names but have similar values for some columns. I need to merge in multiple columns from the first dataset into the second and have them read in a employees ID by their name.</p>
<p>DF1: All... | <python><python-3.x><pandas><numpy> | 2023-04-11 15:51:15 | 1 | 473 | Coding_Nubie |
75,987,725 | 2,601,293 | Using WebDAV to list files on NextCloud server results in method not supported | <p>I'm trying to list files using webdab but I'm having issues. I can create directories and put files just fine but not list a directory or pull a file. I'm seeing the error, "Method not supported".</p>
<pre><code>from webdav3.client import Client
options = {
'webdav_hostname': "https://___________.c... | <python><webdav><nextcloud> | 2023-04-11 15:37:30 | 4 | 3,876 | J'e |
75,987,646 | 7,000,874 | combine rows if consecutive index exist | <p>I am trying to combine the string in column text_info in one row only if index is consecutive. The data I have looks very similar to the below table:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>index</th>
<th>text_info</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.0</td>
<td>word 1</td>
</t... | <python><python-3.x><pandas><dataframe><group-by> | 2023-04-11 15:28:41 | 1 | 393 | J.Doe |
75,987,622 | 375,432 | Change case of all column names with Ibis | <p>I have an <a href="http://ibis-project.org/" rel="nofollow noreferrer">Ibis</a> table named <code>t</code>. Its column names are all lowercase. I want to change them all to uppercase. How can I do that?</p>
| <python><ibis> | 2023-04-11 15:26:43 | 1 | 763 | ianmcook |
75,987,560 | 1,997,735 | NumPy - process masked image to get min & max distance from specified color | <p>I've got an image (ndarray with shape (480, 640, 3)) and an associated mask (ndarray with shape (480,640)). What I want to do is this:
For each pixel in the image whose corresponding mask value is 255:</p>
<ul>
<li>Calculate the "distance" of that pixel from a reference color = sqrt((R-r)^2+(B-b)^2+(G-g)^... | <python><numpy><image-processing> | 2023-04-11 15:20:52 | 1 | 3,473 | Betty Crokker |
75,987,430 | 10,499,953 | All the ways to construct DataFrame() from data | <p>The parameters section of the <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html" rel="nofollow noreferrer">documentation</a> for <code>DataFrame</code> (as of <code>pandas</code> 2.0.0) begins:</p>
<blockquote>
<p><strong>data : <em>ndarray (structured or homogeneous), Iterabl... | <python><pandas> | 2023-04-11 15:07:02 | 2 | 417 | Attila the Fun |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.