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 β |
|---|---|---|---|---|---|---|---|---|
78,722,450 | 2,153,235 | Specify None as default value for Boolean function argument? | <p>The prototype for <a href="https://numpy.org/doc/stable/reference/generated/numpy.histogram.html" rel="nofollow noreferrer"><code>numpy.histogram</code></a> contains an input argument <code>density</code> of type <code>bool</code> and default value <code>None</code>. If the caller does not supply <code>density</cod... | <python><default-arguments> | 2024-07-08 18:44:36 | 2 | 1,265 | user2153235 |
78,722,382 | 1,749,551 | How to use prompt-toolkit key binding with inner prompt | <p>I have a <a href="https://python-prompt-toolkit.readthedocs.io" rel="nofollow noreferrer">prompt_toolkit</a> application where I want a bunch of keys to be acted on immediately, without pressing Enter. It's not a fullscreen app, it's just using the <code>bottom_toolbar</code>. So I have set up key bindings:</p>
<pre... | <python><prompt-toolkit> | 2024-07-08 18:21:25 | 1 | 4,798 | Nick K9 |
78,722,378 | 1,412,564 | parser add_mutually_exclusive_group - how can I set a default value? | <p>We use Python and Django for our websites. We set a test command that adds to the default Django test command:</p>
<pre class="lang-py prettyprint-override"><code>from django.core.management.commands import test
class Command(test.Command):
def add_arguments(self, parser):
super().add_arguments(parser=... | <python><django><argparse> | 2024-07-08 18:19:34 | 1 | 3,361 | Uri |
78,722,284 | 5,790,653 | How to add a colon after each two characters in a string | <p>I have a list like this:</p>
<pre><code>list1 = [ '000c.29e6.8fa5', 'fa16.3e9f.0c8c', 'fa16.3e70.323b' ]
</code></pre>
<p>I'm going to convert them to mac addresses in format <code>00:0C:29:E5:8F:A5</code> in uppercase.</p>
<p>How can I do that?</p>
<p>I googled but found nothing. I also thought how to do, but still... | <python> | 2024-07-08 17:49:45 | 3 | 4,175 | Saeed |
78,722,207 | 71,612 | Is it possible to get the exact script invocation in Python? | <p>I would like my python script to produce a text file containing the exact command line the user entered to invoke the script. In the past, I have done the following in bash:</p>
<p><code>echo "$0" "$@" > "${output_dir}/configuration/invocation.txt"</code></p>
<p>Is there something eq... | <python><command-line-arguments> | 2024-07-08 17:28:48 | 1 | 3,641 | Stephen |
78,722,190 | 2,207,559 | Azure Functions Python PIP issue | <p>I have an azure functions app running on python@3.11</p>
<p>I need to use requests module, so at the top of the .py file I've added 'import requests'. I've also added requests to requirements.txt.</p>
<p>I have CI/CD configured with GitHub Actions. The yml is attached.</p>
<p>My understanding is MS should install th... | <python><azure-functions><github-actions> | 2024-07-08 17:22:50 | 1 | 3,103 | atoms |
78,722,158 | 375,432 | Use Ibis to filter table to row with largest value in each group | <p>I have a table like this:</p>
<pre><code>βββββββββββββββββ³ββββββββββββββ³βββββββββββββ
β country β city β population β
β‘βββββββββββββββββββββββββββββββββββββββββββ©
β string β string β int64 β
βββββββββββββββββΌββββββββββββββΌβββββββββββββ€
β India β Bangalore β 8443675 β
β Indi... | <python><ibis> | 2024-07-08 17:15:03 | 1 | 763 | ianmcook |
78,722,140 | 9,098,350 | Integration testing FMX app, page_source doesn't contain app controls | <p>I'm exploring the idea of creating integrations tests for my FMX app. Ideally I'd be able to execute these tests for multiple platforms (Windows, Android, iOS, macOS), but for now I'm just trying to get it to work on Windows (64-bit) first using WinAppDriver.</p>
<p>I've created this Python script</p>
<pre><code>fro... | <python><delphi><appium><firemonkey><winappdriver> | 2024-07-08 17:07:32 | 0 | 15,192 | bas |
78,722,044 | 3,581,875 | Is it possible to actually change a function signature at runtime? (and have it enforced) | <p>I want to dynamically change a function's signature. Here's my code:</p>
<pre><code>from inspect import getfullargspec, signature
from functools import wraps
def mock(sign):
def deco(func):
@wraps(func)
def wrap(*args, **kwargs):
print('wrap', args, kwargs)
wrap.__signature__... | <python><decorator><signature> | 2024-07-08 16:44:24 | 0 | 1,152 | giladrv |
78,721,957 | 9,003,672 | How to mock response for request.get object in AWS Lambda deployed through localstack for local testing purpose | <p>As per requirement I am doing the lambda testing locally using the LocalStack. I could able to deploy and invoke the lambda using <strong>localstack</strong>. But I get an error in the lambda handler code, as my code is accessing some external link through requests.get() module.</p>
<p>I have mocked those external l... | <python><aws-lambda><wiremock><localstack> | 2024-07-08 16:19:22 | 1 | 501 | Binit Amin |
78,721,860 | 10,200,497 | How can I change values of a column if the group nunique is more than N? | <p>My DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': ['a', 'a', 'a', 'b', 'c', 'x', 'j', 'w'],
'b': [1, 1, 1, 2, 2, 3, 3, 3],
}
)
</code></pre>
<p>Expected output is changing column <code>a</code>:</p>
<pre><code> a b
0 a 1
1 a 1
2 a 1
3 NaN 2 ... | <python><pandas><dataframe> | 2024-07-08 15:59:22 | 5 | 2,679 | AmirX |
78,721,846 | 1,814,420 | Unable to get queues: '' | <p>I have a RabbitMQ running inside a Docker container using image tag <code>rabbitmq:management</code> for the management plugin and proper port mapping (5672 and 15672) using the command</p>
<pre class="lang-bash prettyprint-override"><code>$ docker run -d -p 5672:5672 -p 15672:15672 rabbitmq:management
</code></pre>... | <python><rabbitmq><celery><flower> | 2024-07-08 15:55:28 | 0 | 12,163 | Triet Doan |
78,721,735 | 1,718,989 | Recursive Directory Search - Not getting the correct current working directory (Python) | <p>I'm currently in the early stages of a course for Python, and have hit a wall and was hoping for some guidance. The problem states.</p>
<blockquote>
<ol>
<li>-Write a function or method called find that takes two arguments called path and dir. The path argument should accept a relative or absolute path to a director... | <python><python-3.x><object><recursion> | 2024-07-08 15:32:43 | 1 | 311 | chilly8063 |
78,721,694 | 10,732,434 | Unicode look-alikes | <p>I am looking for an easy way to match all unicode characters that look like a given letter. Consider an example for a selection of characters that look like small letter <code>n</code>.</p>
<pre class="lang-py prettyprint-override"><code>import re
import sys
sys.stdout.reconfigure(encoding='utf-8')
look_alike_char... | <python><string><unicode> | 2024-07-08 15:22:25 | 2 | 2,197 | sanitizedUser |
78,721,646 | 12,234,535 | Adjusting colormaps for geoplotting | <p>I draw some geoplots using cartopy. Using Two Slope Normalisation and "RdBu_r" colormap to plot air temperature field.</p>
<pre><code>color_map = 'RdBu_r'
fig = plt.figure(figsize=(16, 12))
ax = plt.axes(projection=prj)
norm = TwoSlopeNorm(vmin=np.min(data), vcenter=273.15, vmax=np.max(data))
filled_cont... | <python><matplotlib><plot><colors><cartopy> | 2024-07-08 15:12:17 | 2 | 379 | Outlaw |
78,721,617 | 8,372,455 | Plotting subplots in Matplotlib: second plot not showing data | <p>I am trying to create subplots in Matplotlib where the first plot is a stacked bar plot and the second plot is a line plot. Both plots should share the same datetime index for the x-axis. However, I am facing an issue where the second plot does not show any data.</p>
<pre><code> Economizer Economizer_pl... | <python><pandas><matplotlib> | 2024-07-08 15:06:45 | 1 | 3,564 | bbartling |
78,721,505 | 19,067,218 | Choosing Between yield and addfinalizer in pytest Fixtures for Teardown | <p>I've recently started using pytest for testing in Python and created a fixture to manage a collection of items using gRPC. Below is the code snippet for my fixture:</p>
<pre class="lang-py prettyprint-override"><code>import pytest
@pytest.fixture(scope="session")
def collection():
grpc_page = GrpcPage... | <python><pytest><fixtures> | 2024-07-08 14:47:17 | 2 | 344 | llRub3Nll |
78,721,443 | 4,126,652 | Type hints for decorators | <p>The <a href="https://outlines-dev.github.io/outlines/reference/prompting/" rel="nofollow noreferrer">outlines</a> library has a prompt class like this</p>
<pre class="lang-py prettyprint-override"><code>@dataclass
class Prompt:
"""Represents a prompt function.
We return a `Prompt` class inste... | <python><python-typing><python-decorators> | 2024-07-08 14:33:32 | 1 | 3,263 | Vikash Balasubramanian |
78,721,344 | 6,751,456 | django using aggregate() and distinct() together | <p>I have a filterset that has following attributes:</p>
<pre><code>dosFromGte = filters.DateFilter(method="search_by_dos_from_gte", lookup_expr="gte")
dosToLte = filters.DateFilter(method="search_by_dos_from_lte", lookup_expr="lte")
# One of these methods:
def search_by_dos_fr... | <python><django><orm><django-annotate><django-aggregation> | 2024-07-08 14:14:53 | 0 | 4,161 | Azima |
78,721,341 | 23,196,983 | Efficiently remove rows from pandas df based on second latest time in column | <p>I have a pandas Dataframe that looks similar to this:</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>Index</th>
<th>ID</th>
<th>time_1</th>
<th>time_2</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>101</td>
<td>2024-06-20 14:32:22</td>
<td>2024-06-20 14:10:31</td>
</tr>
<tr>
<td>1</td>
... | <python><pandas><group-by> | 2024-07-08 14:14:27 | 3 | 310 | Frede |
78,721,195 | 4,489,082 | AttributeError: `np.string_` was removed in the NumPy 2.0 release. Use `np.bytes_` instead.. Did you mean: 'strings'? | <p>I m interested in seeing neural network as graph using tensorboard. I have constructed a network in pytorch with following code-</p>
<pre><code>import torch
BATCH_SIZE = 16
DIM_IN = 1000
HIDDEN_SIZE = 100
DIM_OUT = 10
class TinyModel(torch.nn.Module):
def __init__(self):
super(TinyModel, self).__init__... | <python><numpy><pytorch><tensorboard> | 2024-07-08 13:44:22 | 2 | 793 | pkj |
78,721,181 | 2,123,706 | Replace subtrings in a list of strings using dictionary in python | <p>I have a list of substrings:</p>
<pre><code>ls = ['BLAH a b c A B C D 12 34 56',
'BLAH d A B 12 45 78',
'BLAH a/b A B C 12 45 78',
'BLAH a/ b A 12 45 78',
'BLAH a b c A B C D 12 34 99']
</code></pre>
<p>I want to replace the lower case substrings with an identifier:</p>
<pre><code>dict2 = {'a b c':'... | <python><string><dictionary><replace> | 2024-07-08 13:40:58 | 3 | 3,810 | frank |
78,721,153 | 8,110,961 | pandas dataframe filter rows by datetime | <p>I have a dataframe with (non index) column called 'est'. I want to filter out rows having datetime prior to 2023-01-01. I tried as below</p>
<pre><code>spot = df.query(df.est >= date(year=2023, month=1, day=1))
spot = df[df['est'].dt >= date(year=2023, month=1, day=1)]
</code></pre>
<p>but its throwing error... | <python><pandas><dataframe> | 2024-07-08 13:36:15 | 1 | 385 | Jack |
78,721,151 | 2,302,262 | Type checker cannot find attribute "year" on class "pandas.DatetimeIndex" | <p>I'm writing functions that act on <code>pandas.Series</code> with a <code>DatetimeIndex</code>. I can tell the type checker that the <code>Series</code> does not have just any <code>Index</code>, but a <code>DatetimeIndex</code>, using <code>typing.cast</code> (see <a href="https://stackoverflow.com/questions/787209... | <python><pandas><python-typing> | 2024-07-08 13:35:50 | 0 | 2,294 | ElRudi |
78,721,064 | 4,442,337 | How to mark a DRF ViewSet action as being exempt from the application of a custom middleware? | <p>I've created a <a href="https://docs.djangoproject.com/en/5.0/topics/http/middleware/#writing-your-own-middleware" rel="nofollow noreferrer">Custom Django Middleware</a> and added to the <code>MIDDLEWARE</code> settings variable correctly.</p>
<pre class="lang-py prettyprint-override"><code>from django.http import H... | <python><django><django-rest-framework> | 2024-07-08 13:14:28 | 0 | 2,191 | browser-bug |
78,720,908 | 10,892,021 | AsyncIO CPython hangs with 100% CPU usage | <p>Our Python application is hanging on these 2 particular machines after 10-20 minutes of use. Htop shows 100% CPU usage. I used Pystack to get the stack trace of the running process. The Python side of the stack trace shows nothing interesting, it was just some dictionary look up (and each time it hangs they are at d... | <python><python-asyncio><cpython><python-internals><python-3.12> | 2024-07-08 12:39:04 | 0 | 797 | Sophon Aniketos |
78,720,900 | 2,302,262 | Type hints for subset of class | <p>I'm writing functions that act on <code>pandas.Series</code> with a <code>DatetimeIndex</code>. I can do type hints, like so:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
def filter_year(s: pd.Series, year: int) -> pd.Series:
keep = s.index.year == year
return s[keep]
</code></... | <python><python-typing> | 2024-07-08 12:37:43 | 4 | 2,294 | ElRudi |
78,720,804 | 6,803,114 | Split a pandas dataframe column into multiple based on text in those columns | <p>I have a pandas dataframe with a column.</p>
<pre><code>id text_col
1 Was it Accurate?: Yes\n\nReasoning: This is a sample text
2 Was it Accurate?: Yes\n\nReasoning: This is a sample text
3 Was it Accurate?: No\n\nReasoning: This is a sample text
</code></pre>
<p>I have to break the text_col into two ... | <python><python-3.x><pandas><dataframe> | 2024-07-08 12:17:02 | 1 | 7,676 | Shubham R |
78,720,752 | 3,628,240 | Getting intersection of subset of multiindex dataframe from Pandas | <p>I have some a multi index df, with a month and then facilityIDs and a TotalSpend value for each facility. I'm trying to aggregate the TotalSpend across all facilities for a quarter, where they have data in all 3 months of the quarter AND all 3 months of the quarter in the previous year.</p>
<p><a href="https://i.sst... | <python><pandas><dataframe> | 2024-07-08 12:05:29 | 1 | 927 | user3628240 |
78,720,274 | 9,924,230 | How to efficiently perform parallel file search using pathlib `glob` in Python for large directory structures? | <p>I'm working on a Python project where I need to search for specific files across a very large directory structure. Currently, I'm using the glob (or rglob) method from the pathlib module, but it is quite slow due to the extensive number of files and directories.</p>
<p>Here's a simplified version of my current code:... | <python><parallel-processing><glob><pathlib> | 2024-07-08 10:16:56 | 2 | 613 | Roy |
78,720,213 | 6,930,340 | Putting polars API extensions in dedicated module - How to import from target module? | <p>I want to extend <code>polars</code> API as described in the <a href="https://docs.pola.rs/api/python/stable/reference/api.html" rel="nofollow noreferrer">docs</a>, like this:</p>
<pre><code>@pl.api.register_expr_namespace("greetings")
class Greetings:
def __init__(self, expr: pl.Expr):
self._e... | <python><python-polars> | 2024-07-08 10:04:56 | 1 | 5,167 | Andi |
78,719,729 | 16,869,946 | Multivariate normal distribution using python scipy stats and integrate nquad | <p>Let<br>
<img src="https://i.sstatic.net/itTcpdLj.png" height="50" /><br>
be independent normal random variables with means<br>
<img src="https://i.sstatic.net/Wi4QpGxw.png" height="50" /><br>
and unit variances, i.e. <br>
<img src="https://i.sstatic.net/EEG24NZP.png" height="40" /><br>
I would like to compute the pr... | <python><scipy><normal-distribution><scipy.stats><scipy-integrate> | 2024-07-08 08:06:21 | 1 | 592 | Ishigami |
78,719,496 | 1,858,864 | Dynamically generate Django .filter() query with various attrs and matching types | <p>I use Django 1.6 and Python 2.7 and I need to generate queryset filter dynamically.</p>
<p>The basic thing I need is to use different fields (field1, field2, field3) in filter and use different type of matching (equals, startsfrom, endswith, contains).</p>
<p>Here is an example of possible combinations:</p>
<pre><co... | <python><django><django-orm> | 2024-07-08 07:07:48 | 0 | 6,817 | Paul |
78,719,295 | 4,382,391 | show scale legend of 2D histplot | <p>I want to add a color scale legend to a 2D seaborn dist plot that shows the frequency range of the color scale. An example is mocked up here in ms paint:</p>
<p><a href="https://i.sstatic.net/n9h7aoPN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/n9h7aoPN.png" alt="a 2D seaborn distplot with a color... | <python><seaborn><colorbar><histplot> | 2024-07-08 06:01:03 | 1 | 1,070 | Null Salad |
78,719,212 | 3,486,684 | Reducing code/expression duplication when using Polars `with_columns`? | <p>Consider some Polars code like so:</p>
<pre class="lang-py prettyprint-override"><code>df.with_columns(
pl.date_ranges(
pl.col("current_start"), pl.col("current_end"), "1mo", closed="left"
).alias("current_tpoints")
).drop("current_start", &... | <python><python-polars> | 2024-07-08 05:26:34 | 1 | 4,654 | bzm3r |
78,719,155 | 11,608,962 | PyTorch RuntimeError: No operator found for memory_efficient_attention_forward with torch.float16 inputs on CPU | <p>I am working with a PyTorch model (AutoModelForCausalLM) using the transformers library and encountering a RuntimeError related to tensor types and operator support. Hereβs a simplified version of my code:</p>
<pre class="lang-py prettyprint-override"><code>import torch
import requests
from PIL import Image
from IPy... | <python><tensorflow><pytorch> | 2024-07-08 04:58:13 | 1 | 1,427 | Amit Pathak |
78,719,135 | 3,486,684 | How can I create a Polars struct when using list eval? | <p>I am trying to create a Polars DataFrame that includes a column of structs based on another DataFrame column. Here's the setup:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame(
[
pl.Series("start", ["2023-01-01"]).str.to_date(),
pl.Se... | <python><dataframe><list><python-polars> | 2024-07-08 04:44:58 | 1 | 4,654 | bzm3r |
78,719,078 | 3,486,684 | How to type hint a `pl.date`? | <p>Suppose we create some dates:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame(
[
pl.Series("start", ["2023-01-01"], dtype=pl.Date).str.to_date(),
pl.Series("end", ["2024-01-01"], dtype=pl.Date).str.to_date(),
]... | <python><python-typing><python-polars><pyright> | 2024-07-08 04:11:35 | 1 | 4,654 | bzm3r |
78,718,996 | 8,535,456 | Browser doesn't get response header from my inherited http.server.SimpleHTTPRequestHandler | <p>I am trying to build a HTTP server by inheriting <code>http.server.SimpleHTTPRequestHandler</code>.</p>
<p>It works fine and unless that the browser just doesn't know my server is trying to
send HTML data, and keep rendering the response HTML in plain text.</p>
<p>However, I have already set <code>self.send_header('... | <python><html><http><server><simplehttprequesthandler> | 2024-07-08 03:20:38 | 1 | 1,097 | Limina102 |
78,718,891 | 2,604,247 | Do Python coders have a bias towards list over tuple? | <h4>Basic Facts</h4>
<ul>
<li>Lists are mutable (supporting inserts, appending etc.), Tuples are not</li>
<li>Tuples are more memory efficient, and faster to iterate over</li>
</ul>
<p>So it would seem their use-cases are clear. Functionally speaking, lists offer a superset of operations, tuples are more performant at ... | <python><list><performance><data-structures><iterable-unpacking> | 2024-07-08 02:16:53 | 2 | 1,720 | Della |
78,718,762 | 13,118,291 | Getting error when trying to install Pandas using pip | <p>I am trying to install Pandas.</p>
<p>I did:</p>
<pre><code>pip install pandas
</code></pre>
<p>And I tried other versions:</p>
<pre><code>pip install pandas=2.2.1
</code></pre>
<p>Always the same error:</p>
<pre><code>root@thinkpad:/# pip install pandas==2.2.1
Collecting pandas==2.2.1
Downloading pandas-2.2.1.tar... | <python><python-3.x><pandas><linux><pip> | 2024-07-08 00:54:45 | 1 | 465 | Elyes Lounissi |
78,718,748 | 3,486,684 | Writing a DataFrame which has a column with type `pl.List(SomePolarsEnum)` inside a `pl.Struct` causes panic "ListArray's child's DataType must match" | <p>A minimal not-working example:</p>
<pre class="lang-py prettyprint-override"><code>from pathlib import Path
import polars as pl
Alphas = pl.Enum(["hello"])
MiniStruct = pl.Struct({
"alpha": Alphas,
})
MiniStructs = pl.List(MiniStruct)
df = pl.DataFrame(
pl.Series("xs", [[] for _ ... | <python><python-polars> | 2024-07-08 00:39:26 | 0 | 4,654 | bzm3r |
78,718,725 | 3,628,240 | Quarter over Quarter for monthly spend with Pandas | <p>I have some transaction data that after grouping by date and FacilityID that looks like the below after the grouping. I'm trying to calculate the quarter over quarter change for all of the transactions, so the sum of the total spend of all of the Facilities combined (i.e. the aggregate spend in all 3 months of both ... | <python><pandas> | 2024-07-08 00:19:40 | 1 | 927 | user3628240 |
78,718,715 | 1,575,548 | Response 403 - Is it me or them? | <p>I am using <a href="https://github.com/lvxhnat/pyetfdb-scraper" rel="nofollow noreferrer"><code>pyetfdb-scraper</code></a> to scrap info about ETFs. It worked last week, but suddenly, I am consistently getting <code>403</code> errors.</p>
<pre><code>from pyetfdb_scraper.etf import ETF
test = ETF('VTI')
</code></pre>... | <python><python-requests> | 2024-07-08 00:13:38 | 1 | 982 | BΓ©atrice M. |
78,718,676 | 395,857 | What is the difference, if any, between model.half() and model.to(dtype=torch.float16) in huggingface-transformers? | <p>Example:</p>
<pre><code># pip install transformers
from transformers import AutoModelForTokenClassification, AutoTokenizer
# Load model
model_path = 'huawei-noah/TinyBERT_General_4L_312D'
model = AutoModelForTokenClassification.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Con... | <python><huggingface-transformers><huggingface><quantization><half-precision-float> | 2024-07-07 23:33:43 | 1 | 84,585 | Franck Dernoncourt |
78,718,668 | 2,146,894 | How to interpret and adjust the colorbar when plotting an RGB image with imshow? | <p>I have a 2x2x3 numpy array like this</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
import numpy as np
red = np.array([[0, 50], [100, 200]])
green = np.array([[0, 185], [100, 255]])
blue = np.array([[0, 129], [0, 255]])
combined = np.stack((red, green, blue), -1)
# [[[ 0, 0,... | <python><matplotlib> | 2024-07-07 23:25:29 | 1 | 21,881 | Ben |
78,718,645 | 4,884,235 | Python in Excel: How to access the records of a JSON file imported using Excel Query | <p>I have a deeply nested JSON file that I have imported using Power Query into Excel and Microsoft 365 using
Data>Get Data>From File>From JSON</p>
<p>It loads into a [Record].</p>
<p>I would like to access and process this loaded object using Python in Excel.</p>
<p>I have a manual workaround of loading the J... | <python><json><excel><powerquery> | 2024-07-07 23:07:58 | 0 | 656 | Chris Seeling |
78,718,554 | 9,212,050 | Training a Custom Feature Extractor in Stable Baselines3 Starting from Pre-trained Weights? | <p>I am using the following custom feature extractor for my StableBaselines3 model:</p>
<pre><code>import torch.nn as nn
from stable_baselines3 import PPO
class Encoder(nn.Module):
def __init__(self, input_dim, embedding_dim, hidden_dim, output_dim=2):
super(Encoder, self).__init__()
self.encoder =... | <python><pytorch><reinforcement-learning><stable-baselines><stablebaseline3> | 2024-07-07 22:11:00 | 1 | 1,404 | Sayyor Y |
78,718,450 | 123,891 | authlib + mailchimp oauth2: invalid_client: client_id parameter missing | <p>I'm building out an OAuth2 Factory using authlib and FastAPI because my upstream application needs to authenticate with multiple providers.</p>
<p>The authentication factory works well with all providers except for Mailchimp.</p>
<p>I don't want to use the mailchimp_marketing client library (for a few different reas... | <python><oauth-2.0><fastapi><mailchimp><mailchimp-api-v3> | 2024-07-07 21:12:30 | 1 | 20,303 | littleK |
78,718,381 | 1,818,935 | Create a list accumulating the results of calling a function repeatedly on an input value | <p>Is there a library function that creates recursive lists in the following sense,</p>
<pre><code>recursive_list(f, x0, n) = [x0, f(x0), f(f(x0)), f(f(f(x0))), ...]
</code></pre>
<p>with <code>n</code> elements in the returned list?</p>
<p>If not, how can this be written?</p>
| <python><list><recursion><higher-order-functions> | 2024-07-07 20:39:32 | 4 | 6,053 | Evan Aad |
78,718,359 | 2,218,321 | Python: Multiprocessing took longer than sequential, why? | <p>I have this code, it generates 2,000,000 points uniformly distributed in a bounding box and does some calculations to partition the points based on some criteria.</p>
<pre><code>import numpy as np
from draw import draw
import time
X = 0
Y = 1
N = 2000000
max_x = -100000
max_y = -100000
min_x = 100000
min_y = 1000... | <python><numpy><multiprocessing> | 2024-07-07 20:30:09 | 1 | 2,189 | M a m a D |
78,718,332 | 2,203,144 | SSL: CERTIFICATE_VERIFY_FAILED certificate verify failed (_ssl.c:727) or _ssl.c:1000 | <h2>The problem</h2>
<p>When I run <code>pip install certifi</code> (or python -m pip install certifi) (pip2), I get the error</p>
<pre><code>[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
</code></pre>
<p>or if I run <code>pip3 install certifi</code>, I get the error</p>
<pre><code>[SSL: CERTI... | <python><ssl><ssl-certificate> | 2024-07-07 20:17:23 | 0 | 3,988 | mareoraft |
78,718,204 | 14,336,726 | How to set weights with pyDecision | <p>I'm trying to figure out how to set weights in a MAUT excercise in which I follow this <a href="https://colab.research.google.com/drive/1qm3ARgQm68GUK2irGiCB-B49vnVHazB7?usp=sharing#scrollTo=z9tbtRnUKbKM" rel="nofollow noreferrer">pyDecision example</a>. In my evaluation matrix I have 68 measurement criteria and the... | <python><mcdm> | 2024-07-07 19:12:51 | 1 | 480 | Espejito |
78,717,770 | 10,445,333 | Pandas read XML file with designated data type | <p>My code:</p>
<pre><code>df = pd.read_xml(
path_or_buffer=PATH,
xpath="//Data",
compression="gzip"
)
</code></pre>
<p>I'm using Pandas <code>read_xml()</code> function to read <code>xml.gz</code> format data. I'm using Pandas <code>1.3.2</code> version. When I tried to read the data, P... | <python><pandas><xml> | 2024-07-07 16:01:42 | 3 | 2,333 | Jonathan |
78,717,759 | 3,628,240 | Calculating Year over Year change for a Month in Pandas, from Excel | <p>I have an excel file with raw data, which lists transaction data by month for facilities. There's the month/year, the facilityID, and then spend in that transaction. There can be multiple transactions for a facility in a month. I've managed to group the transactions by date and facilityID, with the total spend as th... | <python><pandas> | 2024-07-07 15:56:45 | 1 | 927 | user3628240 |
78,717,523 | 7,563,454 | Main loop waits on thread pool despite using map_async | <p>I have a multiprocessing thread pool with a loop running on the main thread. The main loop must run without being blocked: It issues a task to the thread pool on startup and whenever all results have been processed and a new set must be calculated, while retrieving those results that become available even when the p... | <python><multithreading><threadpool> | 2024-07-07 14:10:52 | 1 | 1,161 | MirceaKitsune |
78,717,509 | 14,224,948 | Can't add cache for my dependencies in GitHub Actions using Python | <p>I have a project that uses ruff and pytest. I want to cache those dependencies, but in the docs there is an example that uses some kind of node.js env, and chatGPT suggested me something like that:</p>
<pre><code>name: Code analysis
on:
pull_request:
push:
branches: main
jobs:
analyze:
runs-on: ubunt... | <python><continuous-integration><github-actions> | 2024-07-07 14:06:15 | 1 | 1,086 | Swantewit |
78,717,481 | 1,982,032 | How can add the positional argument :UnitedStates.__init__() missing 1 required positional argument: 'm'? | <p>In the article "Automating Option Pricing Calculations",https://sanketkarve.net/automating-option-pricing-calculations/,chapter "Calculation of Implied Volatility via Stock Prices":</p>
<pre><code>from QuantLib import *
valuation_date = Date(20,11,2020)
Settings.instance().evaluationDate = valuat... | <python><quantlib> | 2024-07-07 13:52:29 | 0 | 355 | showkey |
78,717,463 | 4,451,315 | pyarrow: find diff for chunkedarray | <p>If I have a chunkedarray, how do I find its diff (similar to pandas.Series.diff or polars.Series.diff)?</p>
<p>e.g. if I start with</p>
<pre class="lang-py prettyprint-override"><code>import pyarrow as pa
ca = pa.chunked_array([[1,3, 2], [5, 2, 1]])
</code></pre>
<p>I'd like to end up with an array (or chunked array... | <python><pyarrow> | 2024-07-07 13:43:15 | 1 | 11,062 | ignoring_gravity |
78,717,452 | 181,783 | CPython: what happens when the take_gil function calls the drop_gil function | <p>I'm using <a href="https://github.com/maartenbreddels/per4m" rel="nofollow noreferrer">perf probes to profile the GIL contention</a> in a multithreaded Python application and I find sequences where the <a href="https://github.com/python/cpython/blob/main/Python/ceval_gil.c#L292C1-L292C9" rel="nofollow noreferrer">ta... | <python><cpython><perf><gil> | 2024-07-07 13:39:09 | 1 | 5,905 | Olumide |
78,717,232 | 10,807,094 | Why is an imported variable reevaluated on each request in Flask? | <p>I'm working on a flask app. There is the app.py file which uses an imported variable:</p>
<pre><code>from other_file import rnd
@app.route('/some/path/', methods=['GET'])
def some_func:
return make_response(jsonify(value=str(rnd)))
</code></pre>
<p>and other_file.py</p>
<pre><code>import random
rnd = random.ra... | <python><flask> | 2024-07-07 12:03:57 | 0 | 591 | Yusif |
78,716,778 | 10,200,497 | How can I use groupby in a way that each group is grouped with the previous overlapping group? | <p>My DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': list('xxxxxxxxxxyyyyyyyyy'),
'b': list('1111222333112233444')
}
)
</code></pre>
<p>Expected output is a list of groups:</p>
<pre><code> a b
0 x 1
1 x 1
2 x 1
3 x 1
4 x 2
5 x 2
6 x 2
a b
4 ... | <python><pandas><dataframe> | 2024-07-07 08:24:13 | 1 | 2,679 | AmirX |
78,716,770 | 1,371,666 | Access function and variable of parent(not exactly) class in tkinter of python | <p>Please see the code below I got from OysterShucker<br></p>
<pre><code>import tkinter as tk
class Table(tk.Frame):
def __init__(self, master, header_labels:tuple, *args, **kwargs):
tk.Frame.__init__(self, master, *args, **kwargs)
# configuration for all Labels
# easier to mainta... | <python><tkinter> | 2024-07-07 08:18:12 | 1 | 481 | user1371666 |
78,716,751 | 10,855,529 | How to remove or drop a field from a struct in Polars? | <p>I want to remove one field from a struct. Currently, I have it set up like this, but is there a simpler way to achieve this?</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
import polars.selectors as cs
def remove_one_field(df: pl.DataFrame) -> pl.DataFrame:
meta_data_columns = (df.se... | <python><dataframe><python-polars> | 2024-07-07 08:07:50 | 2 | 3,833 | apostofes |
78,716,568 | 1,056,563 | After installing python3.11 none of the general python/python3 executables are symlinked to them | <p>I have installed <code>python 3.11</code> via <code>Homebrew</code>. There are many posts about similar issues with python@3.X not updating python/python3, etc. But I have not seen a solution that fixes the fact that the executables including <code>pip/pip3</code>, <code>pydoc</code>, <code>idle</code>, <code>whee... | <python><homebrew> | 2024-07-07 06:13:02 | 1 | 63,891 | WestCoastProjects |
78,716,562 | 3,949,631 | How to get only plain text from a webpage | <p>I am trying to access the contents of a webpage using <code>urllib</code> and <code>bs4</code>:</p>
<pre><code>import bs4
from urllib.request import Request, urlopen
url = "https://ar5iv.labs.arxiv.org/html/2309.10034"
req = Request(url=url, headers={'User-Agent': 'Mozilla/7.0'})
webpage = str(urlopen(req... | <python><beautifulsoup><urllib> | 2024-07-07 06:05:52 | 3 | 497 | John |
78,716,221 | 25,818,422 | Is there any way to construct a code object from a code string and assign it to an existing function using Python? | <p>My problem is like this: I need to change how a function behave, but I can't access or change the file with which the function is located. I <em>could</em> <code>import</code> it though, and I would like to change the implementation a bit. However, since I can't access the source code itself, I can't change it direc... | <python><function><byte><python-internals> | 2024-07-07 00:39:03 | 1 | 330 | Luke L |
78,716,159 | 21,152,416 | How to execute typer program without specifying filename | <p>Assume having <code>tool.py</code> file with the following content:</p>
<pre class="lang-py prettyprint-override"><code>import typer
app = typer.Typer()
@app.command()
def create():
...
@app.command()
def delete():
...
if __name__ == "__main__":
app()
</code></pre>
<p>It can be executed ... | <python><typer> | 2024-07-06 23:49:51 | 0 | 1,197 | Victor Egiazarian |
78,716,097 | 3,628,240 | Using Pandas to get year over year change from Excel file | <p>I have an excel file that looks something like this: <a href="https://i.sstatic.net/JpcFaJe2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JpcFaJe2.png" alt="excel file example" /></a></p>
<p>Each row represents a month of the year, each column is a user_ID, and the cell is the dollars that user spe... | <python><pandas> | 2024-07-06 22:55:13 | 1 | 927 | user3628240 |
78,715,993 | 2,856,552 | How do I add legend handles in Matplotlib? | <p>I would like to add a legend to my Python plot, with a title and legend handles. My sincere apologies as a complete novice in Python, I got my code from a post. The code below works, but I want to add a legend. All the plots I have googled deal with line plots with several lines.</p>
<pre><code>import geopandas as g... | <python><matplotlib><geopandas> | 2024-07-06 21:43:09 | 1 | 1,594 | Zilore Mumba |
78,715,983 | 963,319 | Pandas outer join not working as expected | <p>I want to merge two CSV files from the open Bixi dataset. The problem is that after the outer merge, there are rows missing:</p>
<pre><code>In [148]: outer_merged_df['Code']==7150
Out[148]:
0 False
1 False
2 False
3 False
4 False
...
1045584 False
1045585... | <python><pandas> | 2024-07-06 21:36:40 | 1 | 2,751 | Jenia Be Nice Please |
78,715,925 | 15,803,668 | Prevent root items from being dropped onto another root item in PyQt5 QTreeView | <p>I'm working on a PyQt5 application where I have a QTreeView populated with a QStandardItemModel. The root items present documents and the child sections within the document. So they should not be mixed. I want to achieve the following behaviors:</p>
<ul>
<li>top level items can only be moved in a way that only their... | <python><pyqt5><qtreeview> | 2024-07-06 21:07:58 | 3 | 453 | Mazze |
78,715,742 | 159,072 | Why is my Binary PSO feature selection showing no progress? | <p>I have written a Python script as follows:</p>
<ol>
<li>A data-file <code>file</code> of path <code>'/content/drive/MyDrive/dataset.csv'</code>
(a) dataset file is 6.62 GB in size
(b) has 1079134 rows excluding the header row<br />
(c) has 1029 columns</li>
<li>Divide the rows into 25 chunks each of size <code>chunk... | <python><feature-selection><particle-swarm> | 2024-07-06 19:38:22 | 0 | 17,446 | user366312 |
78,715,584 | 681,911 | Fast way to remove multiple rows by indices from a Pytorch or Numpy 2D array | <p>I have a numpy array (and equivalently a Pytorch tensor) of shape <code>Nx3</code>. I also have a list of indices corresponding to rows, that I want to remove from this tensor. This list of indices is called <code>remove_ixs</code>. <code>N</code> is very big, about 5 million rows, and <code>remove_ixs</code> is 50k... | <python><numpy><pytorch> | 2024-07-06 18:14:49 | 2 | 4,366 | sanjeev mk |
78,715,532 | 1,033,217 | How to Expose Python Enum as "Constants" without the Class Name All At Once | <p>The following code creates three "constants" that can be used without the enum's class name before each one. Is there a way to do this to all members of the enum without having an explicit line of code for each member as shown here?</p>
<pre class="lang-py prettyprint-override"><code>import enum
class Tes... | <python><python-3.x><enums><constants> | 2024-07-06 17:49:40 | 2 | 795 | Utkonos |
78,715,358 | 1,125,062 | How to assign value to a zero dimensional torch tensor? | <pre><code>z = torch.tensor(1, dtype= torch.int64)
z[:] = 5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: slice() cannot be applied to a 0-dim tensor.
</code></pre>
<p>I'm trying to assign a value to a torch tensor but because it has zero dimensions the slic... | <python><pytorch> | 2024-07-06 16:24:12 | 3 | 4,641 | Anonymous |
78,715,315 | 3,581,217 | Filter OpenStreetMap edges on `Surface` type | <p>I'm accessing OpenStreetMap data using <code>osmnx</code>, using:</p>
<pre><code>import osmnx as ox
graph = ox.graph_from_place('Bennekom')
nodes, edges = ox.graph_to_gdfs(graph)
</code></pre>
<p>I know from openstreetmap.org/edit that all (?) street features have an attribute <code>Surface</code>, which can be <co... | <python><openstreetmap><osmnx> | 2024-07-06 16:05:20 | 1 | 10,354 | Bart |
78,715,165 | 7,563,454 | Function to rotate a quaternion by the given amount | <pre><code>class quaternion:
__slots__ = ("x", "y", "z", "w")
def __init__(self, x: float, y: float, z: float, w: float):
self.x = x
self.y = y
self.z = z
self.w = w
def rotate(self, x: float, y: float, z: float):
# Correctly ... | <python><math><3d><rotation><coordinates> | 2024-07-06 15:00:42 | 1 | 1,161 | MirceaKitsune |
78,715,100 | 9,744,061 | Subscript title of figure which contain variable in matplotlib | <p>I want to write title in python figure, which contain variable <code>n=100</code>. I want to write as $t_n=0.1$ (n is subscript). I try as follows:</p>
<pre><code>import matplotlib.pyplot as plt
n=100
plt.figure()
plt.title(f'$t_{n:3d}=0.1$')
plt.show()
</code></pre>
<p>But it shows as follows:</p>
<p><a href="http... | <python><matplotlib><plot><title> | 2024-07-06 14:33:01 | 1 | 305 | Ongky Denny Wijaya |
78,715,040 | 3,581,875 | Import function from package file | <p>My project structure is as follows:</p>
<pre><code>package/
module/
__init__.py
component.py
main.py
script.py
</code></pre>
<p>In main.py I have: <code>from module.component import something</code>.</p>
<p>And in script.py I want to import a function (lets call it 'function') from main.py.</... | <python><import> | 2024-07-06 14:05:11 | 1 | 1,152 | giladrv |
78,714,497 | 4,040,643 | Unclear behaviour of pinecone's load_dataset | <p>In the following program, I have the three functions <code>get_dataset1</code>, <code>get_dataset2</code>, and <code>get_dataset3</code> that are all very similar. They only differ in when they call <code>len(dataset)</code> and <code>os.path.join = tmp</code>.</p>
<p>The functions <code>get_dataset1</code> and <cod... | <python><os.path><pinecone> | 2024-07-06 09:54:46 | 1 | 489 | Imago |
78,714,456 | 4,451,315 | Type a Callable so it can take any number of string arguments, and then keyword arguments | <p>I have a function which accepts any function such that:</p>
<ul>
<li>it accepts any number of arguments of type <code>str</code></li>
<li>it may accept any number of keyword arguments of any type</li>
<li>it returns <code>str</code></li>
</ul>
<p>Examples of acceptable function:</p>
<ul>
<li><code>def func(a: str, b... | <python><mypy><python-typing> | 2024-07-06 09:39:53 | 0 | 11,062 | ignoring_gravity |
78,714,445 | 2,989,330 | Understanding and introspecting torch.autograd.backward | <p>In order to locate a bug, I am trying to introspect the backward calculation in PyTorch. Following the <a href="https://pytorch.org/docs/stable/notes/autograd.html#backward-hooks-execution" rel="nofollow noreferrer">description of torch's Autograd mechanics</a>, I added backward hooks to each parameter of my model a... | <python><pytorch><torch><autograd> | 2024-07-06 09:35:25 | 1 | 3,203 | Green η»Ώθ² |
78,714,232 | 6,227,500 | How to convert binary to string (UUID) without UDF in Apache Spark (PySpark)? | <p>I can't find a way to convert a binary to a string representation without using a UDF. Is there a way with native PySpark functions and not a UDF?</p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import DataFrame, SparkSession
import pyspark.sql.functions as F
import uuid
from pyspark.sql.types i... | <python><apache-spark><pyspark><binary> | 2024-07-06 07:50:57 | 1 | 1,040 | raphaelauv |
78,713,669 | 3,842,788 | How to run a Python file in VS Code inside a virtual environment? | <p>In my folder <code>folder1</code> I have a python venv which I have activated in my terminal with <code>source .venv/bin/activate</code>.</p>
<p>Then, I run my python file in the terminal using <code>python3.12 file1.py</code></p>
<p>How do I run this through VS Code's <code>launch.json</code>?</p>
| <python><visual-studio-code><virtual-environment> | 2024-07-06 01:31:57 | 1 | 6,957 | Aseem |
78,713,666 | 7,867,195 | Find the index of a child in lxml | <p>I am using Python 3.12 and lxml.</p>
<p>I want to find a particular tag, and I can do it with elem.find("tag"). elem is of type Element.</p>
<p>But I want to move child elements of this child into the parent where the child was. For that, I need the index of the child. ANd I can't find a way to find that i... | <python><python-3.x><xml><lxml> | 2024-07-06 01:29:28 | 2 | 1,115 | Mikhail Ramendik |
78,713,551 | 395,857 | I load a float32 Hugging Face model, cast it to float16, and save it. How can I load it as float16? | <p>I load a huggingface-transformers float32 model, cast it to float16, and save it. How can I load it as float16?</p>
<p>Example:</p>
<pre><code># pip install transformers
from transformers import AutoModelForTokenClassification, AutoTokenizer
# Load model
model_path = 'huawei-noah/TinyBERT_General_4L_312D'
model = ... | <python><machine-learning><huggingface-transformers><huggingface><half-precision-float> | 2024-07-05 23:58:06 | 1 | 84,585 | Franck Dernoncourt |
78,713,461 | 1,386,054 | temporary variable in list comprehension | <p>Is there a concise way to rewrite the following code fragment as a list comprehension?</p>
<pre class="lang-py prettyprint-override"><code>nsms = []
for line in lines:
fields = line.split(';')
if len(fields) > 4 and fields[4] == 'NSM':
nsms += [fields]
</code></pre>
<p>The challenge is the tempora... | <python><list-comprehension> | 2024-07-05 23:02:21 | 2 | 49,710 | Adrian McCarthy |
78,713,426 | 3,240,688 | pandas groupby duplicate index in Pandas 1 vs Pandas 2 | <p>I have the following 3 lines of code of Pandas groupby and apply that behaves differently in Pandas 1.3 vs Pandas 2.2.</p>
<pre><code>df = pd.DataFrame({'group': ['A', 'A', 'B', 'B'], 'value': [1, 2, 3, 4]}).set_index(['group'])
print(df.groupby(level='group', group_keys=True).apply(lambda x: x))
print(df.groupby(le... | <python><pandas><dataframe> | 2024-07-05 22:37:59 | 0 | 1,349 | user3240688 |
78,713,372 | 2,153,235 | ascii_graph works on primitive literals but not same(?) array from numpy.arange & zip | <p>I am trialing the <a href="https://anaconda.org/conda-forge/ascii_graph" rel="nofollow noreferrer"><code>ascii_graph</code></a> package for Python. If I assemble the histogram data using <code>numpy.arange</code> and <code>zip</code>, the plotting fails. If I assemble the data from primitive literals, it succeeds.... | <python><numpy><python-zip> | 2024-07-05 22:05:22 | 1 | 1,265 | user2153235 |
78,713,151 | 595,305 | How can I implement a responsive QPlainTextEdit? | <p>Here's an MRE:</p>
<pre><code>import sys, random
from PyQt5 import QtWidgets, QtCore, QtGui
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
main_splitter = MainSplitter(self)
self.setCentralWidget(main_splitter)
mai... | <python><pyqt><resize> | 2024-07-05 20:14:41 | 1 | 16,076 | mike rodent |
78,713,012 | 62,857 | Read parquet file using pandas and pyarrow fails for time values larger than 24 hours | <p>I have exported a parquet file using parquet.net which includes a <code>duration</code> column that contains values that are greater than 24 hours. I've opened the tool using the floor tool that's included with parquet.net and the column has type INT32, converted type TIME_MILIS and logical type TIME (unit: MILLIS, ... | <python><pandas><parquet><pyarrow><parquet.net> | 2024-07-05 19:18:07 | 1 | 2,270 | Wouter |
78,712,904 | 4,391,360 | Create a similar matrix object in matlab and python | <p>For comparison purposes, I want to create an object which would have the same shape and indexing properties in matlab and python (numpy).
Let's say that on the matlab side the object would be :</p>
<pre><code>arr_matlab = cat(4, ...
cat(3, ...
[ 1, 2;
3, 4;
5, 6], ...
... | <python><numpy><matlab> | 2024-07-05 18:41:55 | 1 | 727 | servoz |
78,712,857 | 9,951,273 | BigQuery `load_table_from_dataframe` in a transaction? | <p>I have multiple data pipelines which perform the following actions in BigQuery:</p>
<ol>
<li>Load data into a table using the BQ Python client's <code>load_table_from_dataframe</code> method.</li>
<li>Execute a BigQuery <code>merge</code> SQL statement to update/insert that data to another table.</li>
<li>Truncate t... | <python><google-bigquery> | 2024-07-05 18:20:55 | 0 | 1,777 | Matt |
78,712,792 | 916,945 | Use scipy.integrate.nquad to integrate integrals whose result is a complex number | <p>I want to try to numerically integrate the intergal of <code>1/(1+x**2+y**2)</code>, where <code>y</code> is from <code>0</code> to <code>sqrt(16-x**2)</code> and <code>x</code> is from <code>0</code> to <code>5</code>.</p>
<p>The problem is that the result is a complex number.</p>
<p>Can <code>scipy.nquad</code> ha... | <python><numpy><scipy><complex-numbers> | 2024-07-05 17:57:16 | 1 | 2,837 | Paul R |
78,712,452 | 832,490 | The date provided in the filter query must be within the last 30 days and not in the future | <p>I have the following request which works fine when days is less than 30.</p>
<pre><code>days = 29
</code></pre>
<pre><code>end = datetime.now(timezone.utc)
start = end - timedelta(days=days)
query_parameters = CallRecordsRequestBuilder.CallRecordsRequestBuilderGetQueryParameters(
filter=" ".join(
... | <python><azure><microsoft-graph-api><microsoft-teams> | 2024-07-05 16:19:01 | 0 | 1,009 | Rodrigo |
78,712,374 | 2,218,321 | Pyhull python library: Output of convex hull are not subset of the input set | <p>I installed <a href="https://pypi.org/project/pyhull/" rel="nofollow noreferrer">Pyhull</a> library to generate the convex hull for a set of points. The documentation and usage are straightforward. However, the output of the library is strange. Its documentation at <a href="https://pythonhosted.org/pyhull/" rel="no... | <python><convex-hull> | 2024-07-05 15:57:53 | 1 | 2,189 | M a m a D |
78,711,953 | 16,525,263 | How to extract date part from folder name and move it to another folder on hdfs using pyspark | <p>I currently have folders and sub-folders in day-wise structure in this path <code>'/dev/data/'</code></p>
<pre><code>2024.03.30
part-00001.avro
part-00002.avro
2024.03.31
part-00001.avro
part-00002.avro
2024.04.01
part-00001.avro
part-00002.avro
2024.04.02
part-00001.avro
part-00002.avro
</co... | <python><pyspark><hdfs> | 2024-07-05 14:19:25 | 0 | 434 | user175025 |
78,711,626 | 8,842,262 | Pydantic forces SQL query to already populated field | <p>I have interesting case happening with Pydantic: even though the field is already populated by object, when FastAPI returns (or I manually use <code>model_validate</code>) the extra SQL is called to some fields (to be more precise, undefered and joinedload-ed fields):</p>
<pre><code>class PortfolioFullSchema(BaseMod... | <python><sqlalchemy><fastapi><pydantic> | 2024-07-05 13:03:35 | 1 | 513 | Miradil Zeynalli |
78,711,489 | 1,818,059 | Calculate position (transform) on SVG object in code? | <p>I have started a small project to make sheets of (complex) labels in code by effectively merging first a pre-generated QR code (svg format) onto a single label, then this label onto a master sheet.</p>
<p>The merging is automated in Python and works.</p>
<p>But, the position of the QR in the single label is done by ... | <python><xml><svg> | 2024-07-05 12:32:44 | 0 | 1,176 | MyICQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.