QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,951,543 | 8,478 | Testing AWS emails using Moto - can't get it to work | <p>I'm trying to use moto to test sending aws emails. The documentation is poor, and some things have changed - like @mock_ses doens't appear to exist anymore. Frankly my understanding of mocking is poor.</p>
<p>This is the function under test:</p>
<pre><code>import logging
from typing import Iterable, Literal
impor... | <python><email><pytest><boto3><moto> | 2024-02-07 00:08:31 | 1 | 3,321 | Marc |
77,951,326 | 1,172,606 | Django update_or_create within a loop is duplicating field values, but just a couple fields | <p>It's been a while but I have a somewhat puzzling issue. I am looping over some data being pulled from an api and performing an update_or_create call through django.</p>
<pre><code>for product in response['products']:
for variant in product['variants']:
print(variant['product_id'])
obj, created = ... | <python><django><for-loop><django-queryset> | 2024-02-06 23:01:47 | 1 | 4,813 | VIDesignz |
77,950,904 | 1,245,281 | setting python logging config using dictionary fails if `incremental` is set to True? | <p>I've got a pretty simple example, cfg1.yaml:</p>
<pre><code>version: 1
incremental: False
formatters:
text_fmt:
format: "%(asctime)s - %(levelname)s - job_id %(job_id)s - task_id %(task_id)s - username %(username)s - %(message)s"
handlers:
text_file:
class: logging.FileHandler
formatter: te... | <python><dictionary><python-logging> | 2024-02-06 21:20:47 | 0 | 551 | RedBullet |
77,950,848 | 7,475,838 | Downloading file with Python gives error 699 | <p>On <a href="https://www.bibleprotector.com" rel="nofollow noreferrer">https://www.bibleprotector.com</a> are files available for download (like <code>TEXT-PCE.zip</code>).<br />
Manual downloading with a 'right click' works just fine.</p>
<p>However, when trying to download the same file using Python, an <code>699</... | <python><python-requests><download><zip> | 2024-02-06 21:08:10 | 2 | 4,919 | René |
77,950,691 | 22,953,332 | Model Creation Freezing Django (or Django Rest Framework) | <p>I have this model:</p>
<pre class="lang-py prettyprint-override"><code>class AllowedUser(models.Model):
PLACE_CHOICES = (
(1, 'Loc1'),
(2, 'Loc2'),
(3, 'Loc3'),
(4, 'Loc4'),
(5, 'Loc5'),
)
id = models.CharField(primary_key=True, max_length=8, unique=True, defa... | <python><django><django-rest-framework> | 2024-02-06 20:32:27 | 1 | 317 | Arthur Araujo |
77,950,663 | 12,027,869 | Total Number of Rows Having Different Row Values by Group | <p>I have a dataframe:</p>
<pre><code>data = {
'group1': ['A', 'A', 'A', 'A', 'A', 'B', 'B'],
'group2': ['xx', 'xx', 'xx', 'xx', 'xx', 'xy', 'xy'],
'num1': [1, 1, 1, 1, 1, 4, 3],
'num2': [2, 2, 2, 3, 3, 6, 7],
}
pd.DataFrame(data))
</code></pre>
<p><a href="https://i.sstatic.net/0zALW.png" rel="nofollow... | <python><pandas> | 2024-02-06 20:26:38 | 2 | 737 | shsh |
77,950,625 | 857,932 | What is the fastest equivalent to `str.lstrip()` that does not copy the string? | <p>In Python, the <code>str.lstrip()</code> method returns a copy of the string with leading characters from the set removed (or leading whitespace removed, if the set is not provided):</p>
<blockquote>
<p><code>str.lstrip([chars])</code><br />
Return <strong>a copy of the string</strong> with leading characters remove... | <python><string> | 2024-02-06 20:19:30 | 0 | 2,955 | intelfx |
77,950,619 | 11,211,041 | How to suppress "Line too long" warning (pyright-extended) in Replit Python? | <p>When coding in Python using <a href="https://replit.com/%7E" rel="nofollow noreferrer">Replit</a>, I get the annoying warning "Line too long" (pyright-extended).</p>
<p><a href="https://i.sstatic.net/N9kUD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/N9kUD.png" alt="enter image descriptio... | <python><suppress-warnings><replit><ruff> | 2024-02-06 20:18:40 | 1 | 892 | Snostorp |
77,950,512 | 11,444,715 | Pandas read_parquet() with filters raises ArrowNotImplementedError for partitioned column with int64 dtype | <p>I am encountering an issue while trying to read a parquet file with Pandas read_parquet() function using the filters argument. One of the partitioned columns in the parquet file has an int64 dtype. However, when applying filters on this column, I'm getting the following error:</p>
<pre><code>pyarrow.lib.ArrowNotImpl... | <python><pandas><pyarrow> | 2024-02-06 19:54:44 | 1 | 735 | Rafael Higa |
77,950,504 | 929,732 | Unable to get BASH Script to get the version of python unless it is version 2 | <pre><code>#!/bin/bash
for x in `find $(readlink -f /usr/local/folder/) -iregex ".*\/python[23]"`
do
TORUN=$(echo "${x} --version")
echo $TORUN
TORUN2=$(eval $TORUN)
done
</code></pre>
<p><strong>and the results</strong></p>
<pre><code>/usr/local/zz/AA_EXTERNAL/venv3/bin/python3 --version
/us... | <python><bash><for-loop> | 2024-02-06 19:53:08 | 0 | 1,489 | BostonAreaHuman |
77,950,292 | 7,932,327 | Creating a cython memoryview manually | <p>I have a contiguous 1-d numpy array that holds data. However, this array is really a buffer, and I have several numpy views to access that data. These views have different shapes, ndims, offsets etc ...</p>
<p>For instance :</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import math as m
sha... | <python><numpy><cython><memoryview><typed-memory-views> | 2024-02-06 19:07:51 | 1 | 501 | G. Fougeron |
77,950,129 | 590,552 | Python 3.9 Tests in separate directory - Module not found | <p>I am working on my first python project, and I would like to structure the folders correctly.
What I have so far is :</p>
<pre><code>HomeDir/MyProject/
ConfigHandler.py
HomeDir/Tests/
ConfigHanderTests.py
</code></pre>
<p>In the ConfigHanderTests.py I am importing a module defined in ConfigHandler.py... | <python><python-3.x> | 2024-02-06 18:41:03 | 0 | 312 | evolmonster |
77,950,122 | 8,010,921 | Handle Exceptions in Python Function's signature | <p>I wonder if I have designed my script correctly (it works so far) because of a loop of warnings from which I cannot get out.</p>
<p>I am trying to define a function that either is able to parse a JSON response from a website or it simply terminates the program. Here my code:</p>
<pre class="lang-py prettyprint-overr... | <python><typing> | 2024-02-06 18:39:59 | 2 | 327 | ddgg |
77,950,106 | 14,113,504 | Numpy array not updating during a for loop | <p>I am trying to code something to solve differential equations, here the case is rather simple, it's the famous harmonic oscillator, however I am trying to make a general code that would work for an ODE of order n.</p>
<p>During my for loop, the values in X are not updating and I checked that the member on the right ... | <python><numpy><differential-equations> | 2024-02-06 18:36:24 | 1 | 726 | Tirterra |
77,949,983 | 18,419,414 | A simple Flask server with connexion cannot be distribuate with pyinstaller | <h1>Context</h1>
<p>I’m trying to distribute my python server that uses <a href="https://github.com/spec-first/connexion" rel="nofollow noreferrer">connexion</a> with <a href="https://pyinstaller.org/en/stable/" rel="nofollow noreferrer">pyinstaller</a>.</p>
<p>Unfortunately, the executable product not pyinstaller does... | <python><flask><pyinstaller><connexion> | 2024-02-06 18:12:45 | 0 | 437 | Brinfer |
77,949,946 | 147,175 | Are system installed python applications or tools vulnerable to breaking if I uninstall a pip package as my username not sudo? | <p>As much as possible this is a cross OS platform question</p>
<p>After I have created and sourced a python virtual environment when I encounter pip install errors like</p>
<pre><code>pip install tensorflow
...
Downloading protobuf-4.23.4-cp37-abi3-manylinux2014_x86_64.whl (304 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━... | <python><pip> | 2024-02-06 18:06:29 | 1 | 28,509 | John Scott Stensland |
77,949,797 | 4,434,941 | Updating a python scraper that no longer works due to javascript blocks | <p>So I had written a scraper (deployed on a schedule) which worked pretty well until recently when the site (NYTimes) made changes that broke it</p>
<p>Essentially the scraper worked by going to an article URL, and using using xpath to extract the full artcile content which I would pass to an LLM in order to summarize... | <python><web-scraping><python-requests> | 2024-02-06 17:41:10 | 1 | 405 | jay queue |
77,949,791 | 6,694,814 | OpenPyxl - problem with saving file to the specified directory | <p>I would like to save my excel files to the directory pointed out by the user.</p>
<pre><code>file_path = filedialog.askdirectory()
print(y)
for x in range(2, (int(y))+1):
newname = "%03d" % x
wb.save(f''+file_path+filewithoutextension+'- '+newname+'.'+fileextension)
print (filewit... | <python><python-3.x> | 2024-02-06 17:39:59 | 2 | 1,556 | Geographos |
77,949,736 | 11,729,033 | How do I type hint a function whose return type is specified by an argument, when that argument can be a type hint as well as a bare type? | <p>I have a function that accepts a type (or type hint) and returns an object matching that type (or hint). For example:</p>
<pre><code>def get_object_of_type(typ):
...
x = get_object_of_type(int)
# x is now guaranteed to be an int
y = get_object_of_type(str | bytes)
# y is now guaranteed to be either a string or a... | <python><python-typing> | 2024-02-06 17:32:11 | 4 | 314 | J E K |
77,949,719 | 17,040,989 | plotly title_side position not working properly | <p>I'm greenhand with Python plots but I was trying to do a PCA for different human populations; while I'm still working on the actual data, the main issue I'm having with visualizations in Python, as opposed to <code>R</code>, is that doesn't make things very easy...</p>
<p>Specifically, I spent some time figuring out... | <python><plotly><legend><centering><legend-properties> | 2024-02-06 17:29:58 | 1 | 403 | Matteo |
77,949,519 | 3,120,501 | Python multiprocessing/Pathos Process pickling error - Numpy vectorised function | <p>I'm trying to parallelise my program by running the main bulk of the code in different processes and drawing the results together periodically. The format of my code is similar to the following example (which, unfortunately, works):</p>
<pre><code>import abc
import numpy as np
from multiprocessing import Process
# f... | <python><multiprocessing><vectorization><pathos> | 2024-02-06 16:56:49 | 1 | 528 | LordCat |
77,949,486 | 547,231 | Pytorch: Appending tensors like a list | <p>I have a dataset with random data like the following:</p>
<pre><code>data = torch.normal(0, 1, size = (1, 3))
dataset = torch.tensor(data.T).float()
print(dataset)
#tensor([[-2.1445],
# [-1.3322],
# [-0.6355]])
</code></pre>
<p>And now I want to simulate Brownian motions which are started in the 1-dime... | <python><pytorch> | 2024-02-06 16:50:06 | 2 | 18,343 | 0xbadf00d |
77,949,419 | 1,137,254 | How to force an Async Context Manager to Exit | <p>I've been getting into Structured Concurrency recently and this is a pattern that keeps cropping up:</p>
<p>It's nice to use async context managers to access resource - say a some websocket. That's all great if the websocket stays open, but what about if it closes? well we expect our context to be forcefully exited ... | <python><python-asyncio><python-trio><structured-concurrency> | 2024-02-06 16:39:53 | 3 | 3,495 | Sam |
77,949,414 | 13,102,905 | python3 loop on listener based on keyboard pressed or released | <p>I tried running this code and using the insert key to activate the status, and I confirmed in the debug that it actually enters status = True, but it never stays in the loop, I can't understand why it doesn't stay in the loop when I click on insert key.</p>
<pre><code>from pynput.keyboard import Listener, Key
STATU... | <python> | 2024-02-06 16:39:37 | 0 | 1,652 | Ming |
77,949,363 | 17,323,391 | AttributeError: module 'my_package' has no attribute 'member', but I can see 'my_package.member' in site_packages | <p>I have a Poetry package and a consuming Python application.</p>
<p>The Poetry package has this in its <code>pyproject.toml</code>:</p>
<pre><code>[tool.poetry]
name = "my-package"
version = "0.1.0"
description = ""
authors = [...]
readme = "README.md"
packages = [
{ includ... | <python><python-import><python-packaging><python-poetry><pyproject.toml> | 2024-02-06 16:32:46 | 0 | 310 | 404usernamenotfound |
77,949,314 | 897,272 | Parsing a string representation of typing to get types of a child | <p>I have a string representing the type of an object, in this case always a tuple, in a format consistent with how it would be written using type hinting. So something like this;</p>
<pre><code>Tuple[int, int]
</code></pre>
<p>I want to get out a list of types in the tuple. Unfortunately our simple regex failed due ... | <python><python-3.x><regex> | 2024-02-06 16:24:02 | 3 | 6,521 | dsollen |
77,949,301 | 1,738,879 | Pandas groupby with capture groups from extractall | <p>I am working with Pandas <code>extract()</code> method to feed the capture group into <code>groupby</code>. A small example of the result of this process is something like the one illustrated below:</p>
<pre><code>import pandas as pd
import re
from io import StringIO
DATA = StringIO('''
colA;colB;colC
Foo;1;1
Bar;2... | <python><python-3.x><pandas> | 2024-02-06 16:22:16 | 2 | 1,925 | PedroA |
77,949,206 | 2,812,625 | Split a Column Based on first instance | <p>Looking to split a df | series column into 2 parts based on the first "_"</p>
<p>example in column:</p>
<p>Male_85__and_over</p>
<pre><code>test['gender'] = test['column_Name_pivoted'].str.split('_').str[0]
test['age'] = test['column_Name_pivoted'].str.split('_',n=1).str[1:]
</code></pre>
<p>Output is not ... | <python><split><series> | 2024-02-06 16:08:45 | 3 | 446 | Tinkinc |
77,949,009 | 343,215 | In Pandas, how can I combine column-wise DataFram to a row-wise DataFrame? | <p><strong>I have two DataFrames. One is column-wise, which has observations added by column. The second adds observations row-wise:</strong></p>
<pre><code> foo 2024-01-01 2024-02-01
-- ----- --------- ---------
0 4010 100.00 10.00
1 4020 101.00 11.00
2 4030 102.00 12.00
3 ... | <python><pandas> | 2024-02-06 15:44:14 | 2 | 2,967 | xtian |
77,948,957 | 11,618,586 | Identifying row numbers where value is stable before and after the value in the column hits a specified value | <h2>EDITED</h2>
<p>I have a pandas dataframe like so:</p>
<pre><code>data = {'ID': ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', ... | <python><python-3.x><pandas><periodicity> | 2024-02-06 15:37:16 | 2 | 1,264 | thentangler |
77,948,918 | 893,254 | How to merge dataframes in Pandas while maintaining multi-index when one dataframe is empty | <p>I am trying to merge some dataframes with the following line of code:</p>
<pre><code>df_list = [...]
required_columns = ['timestamp']
default_empty_dataframe = pandas.DataFrame(columns=required_columns)
default_empty_dataframe['timestamp'] = pandas.to_datetime(default_empty_dataframe['timestamp'], unit='ms')
defau... | <python><pandas><dataframe> | 2024-02-06 15:30:58 | 1 | 18,579 | user2138149 |
77,948,903 | 6,231,251 | 'No matching distribution found for setuptools' while building my own pip package | <p>I am building a Python package using setuptools. This is the basic structure:</p>
<pre><code>/path/to/project/
├── myproj/
│ ├── __init__.py
│ └── my_module.py
├── pyproject.toml
├── setup.cfg
└── ## other stuff ... | <python><pip><setuptools><pypi><python-packaging> | 2024-02-06 15:28:40 | 1 | 882 | sato |
77,948,428 | 8,388,707 | Issue with qdrant collection creation | Not sure about the format which input format support filter too | <p>this is my sample input dataframe</p>
<pre><code>data = {
'name': ['Entry 1', 'Entry 2', 'Entry 3'],
'urls': ['http://example.com/1', 'http://example.com/2', 'http://example.com/3'],
'text': ['Text for Entry 1', 'Text for Entry 2', 'Text for Entry 3'],
'type': ['Type A', 'Type B', 'Type C']}
</code></pre>
<p>I want ... | <python><langchain><qdrant> | 2024-02-06 14:22:26 | 2 | 1,592 | Vineet |
77,948,246 | 11,064,604 | python multiprocessing.pool but with N cores per process | <p>Python's <code>multiprocessing.pool</code> module gives one core per process. Is there an equivalent that instead gives out <strong>N</strong> cores per process? i.e. the <code>multiprocessing.cool_new_pool</code> defined below?</p>
<pre><code>import multiprocessing
def func(x):
return x**2
TOTAL_CORES = 10 #... | <python><multiprocessing><python-multiprocessing> | 2024-02-06 13:58:22 | 1 | 353 | Ottpocket |
77,948,215 | 12,018,554 | numpy effiency way to multiple transformation array | <p>In Linux, I take screenshots and draw squares at certain coordinates. My code works fine, but I transform the numpy array several times.</p>
<pre><code>
def get_screenshot(self):
# Take screenshot
pixmap = window.get_image(0, 0, width, height, X.ZPixmap, 0xffffffff)
# type(data) = <class 'bytes'>
... | <python><numpy> | 2024-02-06 13:53:07 | 1 | 557 | Qwe Qwe |
77,948,193 | 2,190,411 | jax/jaxopt solution for linear programming? | <p><strong>EDIT:</strong> I just found <a href="https://ott-jax.readthedocs.io/en/latest/" rel="nofollow noreferrer">ott-jax</a> which looks like it might be what I need, but if possible I'd still like to know what I did wrong with jaxopt below!</p>
<p><strong>Original:</strong> I'm trying to solve an optimal transport... | <python><numpy><jax><earth-movers-distance> | 2024-02-06 13:49:45 | 1 | 470 | logan |
77,948,024 | 2,287,486 | Pandas: compare rows of dataframe on the basis of multiple columns | <p>Following is the example dataset</p>
<pre><code>df1 = pd.DataFrame(
data=[['Afghanistan','2015','5.1'],
['Afghanistan','2015','6.1'],
['Bahrain','2020',''],
['Bahrain','2020','32'],
['Bahrain','2021','32'],
['Bahrain','2022','32']],
columns=['Country', 'Reference Year', 'value'])
</code></pre>
<p>I want to... | <python><pandas> | 2024-02-06 13:23:54 | 2 | 579 | khushbu |
77,947,927 | 2,567,544 | Why does Python round(x, 0) not equal round(x)? | <p>I'm trying to understand the behaviour of rounding decimal values. The code below is supposed to illustrate the difference in rounding the decimal value 1.5 according to both the half up and half down methods. See comments in the code for specific questions, which revolve around the difference in behaviour in roundi... | <python><floating-point><rounding> | 2024-02-06 13:08:02 | 0 | 607 | user2567544 |
77,947,765 | 101,022 | AWS generate_presigned_post content-type with two values | <p>Using Python's boto3 library, I create a presigned URL and return it to the front end:</p>
<pre class="lang-py prettyprint-override"><code>s3_client = boto3.client('s3')
response = s3_client.generate_presigned_post(
"bucket",
"logo",
Fields={
"Content-Type": "im... | <javascript><python><amazon-web-services><amazon-s3> | 2024-02-06 12:39:35 | 0 | 1,480 | timborden |
77,947,742 | 11,170,350 | Can I update lifespan in FastAPI without restarting the app? | <p>I want to update values in <code>lifespan</code> of FastAPI.</p>
<p>This is the code:</p>
<pre class="lang-py prettyprint-override"><code>@asynccontextmanager
async def lifespan(app: FastAPI):
names = requests.get(url).json()
yield
</code></pre>
<p>Let's say I knew that the response of API has been updated. I... | <python><fastapi> | 2024-02-06 12:36:38 | 1 | 2,979 | Talha Anwar |
77,947,479 | 90,580 | python webbrowser.open() ignores BROWSER="safari" | <p>I have the following script</p>
<pre><code>import webbrowser
webbrowser.open("https://python.org")
</code></pre>
<p>that I run with</p>
<pre><code>BROWSER="safari" python myscript.py
</code></pre>
<p>This opens Google Chrome instead of safari.</p>
| <python> | 2024-02-06 11:51:01 | 1 | 25,455 | RubenLaguna |
77,947,204 | 5,356,096 | Paramater-based dependecies and outs in DVC from constants file | <p>I am trying to define a single-source set of paths such that it can be modified if necessary from a single spot rather than modifying it in various places across many scripts. I am doing this by simply using a <code>constants.py</code> file:</p>
<p><em>constants.py</em></p>
<pre class="lang-py prettyprint-override">... | <python><dvc> | 2024-02-06 11:06:58 | 1 | 1,665 | Jack Avante |
77,947,027 | 845,210 | How can I use a ClassVar Literal as a discriminator for Pydantic fields? | <p>I'd like to have Pydantic fields that are discriminated based on a class variable.</p>
<p>For example:</p>
<pre class="lang-py prettyprint-override"><code>from pydantic import BaseModel, Field
from typing import Literal, ClassVar
class Cat(BaseModel):
animal_type: ClassVar[Literal['cat']] = 'cat'
class Dog(Bas... | <python><python-typing><pydantic><pydantic-v2> | 2024-02-06 10:37:00 | 1 | 3,331 | bjmc |
77,946,957 | 11,630,148 | csrfmiddlewaretoken included in the search url query | <p>The problem is I have 2 searches, one is a search for job seekers to find jobs and another is a search for companies to find job seekers. The expected result is to have <code>http://localhost:8000/search-job-seeker/?&q=searchquery</code> but what I'm getting is <code>http://localhost:8000/search-job-seeker/?csrf... | <python><django> | 2024-02-06 10:25:16 | 0 | 664 | Vicente Antonio G. Reyes |
77,946,772 | 2,376,651 | Segregate spark and hadoop configuration properties | <p>I have a use case where I want to segregate the spark config properties and hadoop config properties from the spark-submit command.</p>
<p>Example spark-submit command:</p>
<pre><code>/usr/lib/spark/bin/spark-submit --master yarn --class com.benchmark.platform.TPCDSBenchmark --deploy-mode cluster --conf spark.execut... | <python><apache-spark><hadoop><logic> | 2024-02-06 09:57:47 | 1 | 599 | Prabhjot |
77,946,746 | 10,595,871 | Connect docker container with SQL Server | <p>I'm trying to run code that writes on a SQL Server database.
The code is working fine on my machine (Microsoft).</p>
<p>dockerfile:</p>
<pre><code># syntax=docker/dockerfile:1
FROM ubuntu:22.04
WORKDIR /app
RUN apt-get update
RUN apt-get install -y apt-utils \
&& echo 'debconf debconf/frontend select... | <python><sql-server><docker> | 2024-02-06 09:52:36 | 1 | 691 | Federicofkt |
77,946,718 | 354,051 | subprocess.run not throwing errors on stderr when using msvc compiler cl.exe as command | <p>Python 3.12.0, Windows 10, MSVC 14.3</p>
<pre class="lang-py prettyprint-override"><code>from subprocess import run
command = ['cl', ...]
proc = run(command, stdout=subprocess.PIPE, shell=True, text=True, stderr=subprocess.PIPE)
output = proc.stdout.splitlines()
errors = proc.stderr.splitlines()
</code></pre>
<p>Whe... | <python><subprocess> | 2024-02-06 09:48:39 | 1 | 947 | Prashant |
77,946,717 | 6,281,366 | pydantic v1 vs v2: dict field inside a model | <p>In pydantic V1, if i have a class with a dict attribute, and i pass a model into it, it will be converted to a dict:</p>
<pre><code>class Test(pydantic.BaseModel):
x: dict
class X(pydantic.BaseModel):
name: str
x = X(name="name")
test = Test(x=x)
Test(x={'name': 'name'})
</code></pre>
<p>But ... | <python><pydantic> | 2024-02-06 09:48:39 | 1 | 827 | tamirg |
77,946,651 | 16,383,578 | How to store NTFS MFT file records in C++? | <p>I have recently written a Python program that resolves an entire Master File Table, you can see it <a href="https://codereview.stackexchange.com/questions/289308/resolve-an-entire-ntfs-master-file-tables-worth-of-file-records-to-absolute-pat">here</a>.</p>
<p>I wrote it all by myself, using various online documentat... | <python><c++> | 2024-02-06 09:38:59 | 0 | 3,930 | Ξένη Γήινος |
77,946,514 | 1,689,811 | Python threadpool io bound tasks | <p>Assume following code :</p>
<pre><code>import concurrent.futures
import time
import itertools
def task_function(task_id):
print(f"Task {task_id} started")
time.sleep(10) # Simulating some work
print(f"Task {task_id} completed")
def generate_task_ids():
# Infinite generator for ... | <python><python-multithreading> | 2024-02-06 09:18:15 | 0 | 334 | Amir |
77,946,460 | 16,446,640 | Unable to See "View Value in Data Viewer" Option in VS Code Debugger | <p>I'm currently encountering an issue with Visual Studio Code where the "View Value in Data Viewer" option is not appearing in the debugger. This issue persists even though I have the Jupyter extension installed. Below are the details of my VS Code setup and the extensions I have installed:</p>
<pre><code>VS... | <python><pandas><visual-studio-code><jupyter> | 2024-02-06 09:06:14 | 0 | 427 | Thomas LESIEUR |
77,946,456 | 19,694,624 | DIscord bot can't edit message | <p>I am having issues with fetching a message by id. It's kinda weird that I can't edit the message I just sent.</p>
<p>I get the error:</p>
<pre><code>discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message
</code></pre>
<p>Code to replicate the error:</p>
<pre><code>import asyncio
import discord
f... | <python><discord><discord.py><pycord><disnake> | 2024-02-06 09:06:02 | 1 | 303 | syrok |
77,946,231 | 9,194,965 | langchain loader with power point not working | <p>The below def load_documents function is able to load various documents such as .docx, .txt, and .pdf into langchain. I would also like to be able to load power point documents and found a script here: <a href="https://python.langchain.com/docs/integrations/document_loaders" rel="nofollow noreferrer">https://python... | <python><powerpoint><loader><langchain> | 2024-02-06 08:29:11 | 1 | 1,030 | veg2020 |
77,945,871 | 9,072,753 | How to properly overload on bool for 3 different cases? | <p>I am writing my own <code>run</code> function. How to write 3rd overload on dynamic value <code>bool</code> for <code>text</code>, so that it doesn't conflict with overload for <code>Literal[False]</code> and <code>Literal[True]</code>?</p>
<pre><code>from __future__ import annotations
from typing import TypeVar, ov... | <python><python-3.x><overloading><typing> | 2024-02-06 07:19:04 | 0 | 145,478 | KamilCuk |
77,945,784 | 8,176,763 | reflecting materiliazed view in sqlalchemy2.0 using postgres as backend with async engine | <p>According to this github issue mat views and views are fully supported.</p>
<p><a href="https://github.com/sqlalchemy/sqlalchemy/issues/8085" rel="nofollow noreferrer">https://github.com/sqlalchemy/sqlalchemy/issues/8085</a></p>
<p>However binding an engine to reflect method for an async engine is not yet implemente... | <python><sqlalchemy> | 2024-02-06 07:02:24 | 1 | 2,459 | moth |
77,945,267 | 16,220,410 | VSCode settings.json error - incorrect type expected string | <p>how do i fix the error shown in the pic, i was trying to edit my VSCode settings.json, installed the extension Ruff and tried to edit the settings based on an article I've read here:</p>
<p><a href="https://medium.com/@ordinaryindustries/the-ultimate-vs-code-setup-for-python-538026b34d94" rel="nofollow noreferrer">h... | <python><visual-studio-code> | 2024-02-06 04:32:47 | 1 | 1,277 | k1dr0ck |
77,945,092 | 8,573,615 | How do I write a python decorator that depends on a class attribute? Or is there a better way to approach this problem? | <p>I am writing a class that takes an external object from an api, performs some processing on that object, exposes some useful methods, then writes the processed object to a database. In cases where the external object no longer exists, I want the class methods to use the data from the database record.</p>
<p>This is... | <python><python-3.x><python-decorators> | 2024-02-06 03:23:57 | 2 | 396 | weegolo |
77,944,859 | 214,526 | optuna parameter tuning for tweedie - Input contains infinity or a value too large for dtype('float32') error | <p>I am trying to tune a XGBRegressor model and I am getting below error only when I try to use the parameter tuning flow:</p>
<p><code>Input contains infinity or a value too large for dtype('float32')</code></p>
<p>I do not get this error if I do not try to tune parameters.</p>
<p>I have ensured my data does not have ... | <python><scikit-learn><xgboost><optuna><xgbregressor> | 2024-02-06 01:49:25 | 1 | 911 | soumeng78 |
77,944,648 | 453,851 | Can recycling python object ids be a problem to a Pickler? | <p>I read that pyhton will recycle IDs, meaning that a new object can end up with the ID of one that previously existed and was distroyed. I also read about <a href="https://docs.python.org/3/library/pickle.html" rel="nofollow noreferrer">pickle</a>:</p>
<blockquote>
<p>The pickle module keeps track of the objects it ... | <python><python-3.x><pickle><memoization> | 2024-02-06 00:10:05 | 1 | 15,219 | Philip Couling |
77,944,598 | 22,674,380 | How to detect object color efficiently? | <p>I'm trying to detect a object's color in an efficient way. Let's assume I run a YOLO model and crop the object region given the bounding boxes. Given the cropped object image, then what's the most efficient and accurate way to detect the color of the object?</p>
<p>Previously, I trained a YOLO model to detect the co... | <python><opencv><deep-learning><computer-vision><classification> | 2024-02-05 23:49:28 | 1 | 5,687 | angel_30 |
77,944,401 | 11,280,068 | Loguru python dynamically update the log format with each request to a FastAPI app | <p>I want to intergrate loguru into my FastAPI app in the middleware, so that I can monitor and troubleshoot every request that comes in.</p>
<p>One thing I want to achieve, that I don't see a clear solution to, is dynamically set the log format string with every request that comes in. For example:</p>
<pre class="lang... | <python><python-3.x><logging><fastapi><loguru> | 2024-02-05 22:46:43 | 1 | 1,194 | NFeruch - FreePalestine |
77,944,065 | 1,442,731 | Python Logging Configuration from both Dict and file | <p>I looked all morning for a solution. Nothing seemed to fit. If anyone has one, I'll be glad to close this. I offer a solution at the end, feel free to let me know if there is anything better. Not sure why this is not a common issue.</p>
<p>I have a relatively complex testing module that I want to do logging on. ... | <python><dictionary><python-logging> | 2024-02-05 21:18:25 | 1 | 6,227 | wdtj |
77,943,896 | 893,254 | Most Pythonic way to handle exception caused by functools.reduce when the iterable yields no elements? | <p>Python's <code>functools.reduce</code> throws an exception when the iterable passed to it yields no elements.</p>
<p>Here's how I currently use it:</p>
<pre><code>some_list = [] # empty list should be permissible
functools.reduce(
lambda left, right: pandas.merge(left, right, on=['idx'], how='outer'),
some... | <python><pandas><functional-programming><reduce> | 2024-02-05 20:46:15 | 1 | 18,579 | user2138149 |
77,943,889 | 405,017 | How to defend against accidentally shadowing the standard library? | <p>I'm new to Python, and wrote a utility script that generates some numbers I need. I named the file <code>numbers.py</code>. This script depends on the PyGame library. I found that just importing that library caused errors, because PyGame tries to <code>import numbers</code> from the Python standard library, and the ... | <python><python-3.x><python-import> | 2024-02-05 20:45:58 | 1 | 304,256 | Phrogz |
77,943,877 | 9,983,652 | How to update string element in a list? | <p>I have a list with string for each element. I'd like to change some element in the list and it didn't work. For example, I meant to change all elements from 2nd element to 'black'.</p>
<pre class="lang-py prettyprint-override"><code>list_string=['black','red','green','blue','gray']
list_string[1:]='black'
</code></p... | <python> | 2024-02-05 20:43:50 | 3 | 4,338 | roudan |
77,943,846 | 17,800,932 | Running `mypy` on a project with `pysnmp-lextudio` package dependency returns `named-defined` errors | <p>To recreate the issue I am having:</p>
<pre class="lang-bash prettyprint-override"><code>poetry new pysnmp-and-mypy
cd ./pysnmp-and-mypy
poetry add mypy
poetry add pysnmp-lextudio
touch ./pysnmp_and_mypy/test.py
</code></pre>
<p>Put the following code into <code>./pysnmp_and_mypy/test.py</code>:</p>
<pre class="lang... | <python><mypy><python-typing><python-poetry><pysnmp> | 2024-02-05 20:36:52 | 1 | 908 | bmitc |
77,943,668 | 3,700,524 | Playwright setting cookies not working in python | <p>I'm trying to use python to add cookies to the browser in playwright, when I print <code>BrowserContext</code> cookies, I can see the cookie that I added, but when I'm checking it from the browser, It doesn't exists. How can I tell the browser to add cookies from browser context? here is my code :</p>
<pre><code>fro... | <python><web-crawler><playwright><playwright-python> | 2024-02-05 20:03:56 | 1 | 3,421 | Mohsen_Fatemi |
77,943,649 | 248,340 | Join an Azure Communication Services Chat as a Teams user | <p>I'm trying to build a proof of concept application using Azure Communication Services.</p>
<p>I have followed the chat hero example <a href="https://learn.microsoft.com/en-us/azure/communication-services/samples/chat-hero-sample" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/communication-service... | <python><azure><azure-communication-services> | 2024-02-05 19:59:36 | 0 | 318 | David Just |
77,943,598 | 16,436,774 | Debugging seeming memory issues in Python | <p>I have a Python script which deals with a fair amount of data using a fair amount of recursion, though not so much that it triggers a <code>MemoryError</code> or <code>RecursionError</code>. Whether this script runs to completion depends on how its run, as well as some seeming random chance.</p>
<ul>
<li><strong>Run... | <python><debugging><memory> | 2024-02-05 19:48:21 | 2 | 866 | kg583 |
77,943,414 | 4,927,641 | Microsoft Graph API python SDK ,creating a enterprise application | <p>After following <a href="https://stackoverflow.com">https://learn.microsoft.com/en-us/graph/application-saml-sso-configure-api?tabs=python%2Cpowershell-script</a> I'm trying to build a Enterprise Application .</p>
<p>However code block mentions</p>
<pre><code>graph_client = GraphServiceClient(credentials, scopes)
r... | <python><microsoft-graph-api><azure-ad-graph-api> | 2024-02-05 19:09:37 | 1 | 316 | gayan ranasinghe |
77,943,395 | 3,457,351 | OpenAI Embeddings API: How to extract the embedding vector? | <p>I use nearly the same code as here in <a href="https://gist.github.com/limcheekin/997de2ae0757cd46db796f162c3dd58c" rel="nofollow noreferrer">this</a> GitHub repo to get embeddings from OpenAI:</p>
<pre><code>oai = OpenAI(
# This is the default and can be omitted
api_key="sk-.....",
)
def get_embedding(te... | <python><vector><openai-api><embedding><openaiembeddings> | 2024-02-05 19:05:39 | 1 | 325 | user39063 |
77,943,358 | 149,138 | PEP-484 type hint for an invisibly-inherited property | <p>How can I type-hint an <code>@property</code> which will come from an undeclared base class (as often occurs when using a mixin)?</p>
<p>E.g. to annotate "expected attributes" coming from the hidden inheritance hierarchy, I'm using:</p>
<pre class="lang-py prettyprint-override"><code>
class SomeMixin:
n... | <python><python-3.x><python-typing> | 2024-02-05 18:59:28 | 1 | 66,260 | BeeOnRope |
77,943,278 | 5,094,261 | How to make progressively loading JSON responses work with FastAPI + React | <p>I have a problem where I have a FastAPI endpoint that returns a list of JSON objects. The API might become slow at times but I want the responses to be streamable so that they're ready to be rendered by the React Frontend as soon as they are available.</p>
<p>I can think of two approaches.</p>
<ol>
<li><p>Use <code>... | <python><reactjs><streaming><fastapi><server-sent-events> | 2024-02-05 18:43:37 | 2 | 1,273 | Shiladitya Bose |
77,943,247 | 5,896,591 | How to install bytestring formatters for built-in types in Python 3? | <p>I am trying to port Python2 protocol code to Python3. How do I get bytestring formatters for built-in types? In Python2, we could do:</p>
<pre><code>>>> b'%s' % None
'None'
>>> b'%s' % 15
'15'
>>> b'%s' % []
'[]'
</code></pre>
<p>The same code in Python3 gives:</p>
<pre><code>>>> ... | <python><python-3.x><byte> | 2024-02-05 18:38:00 | 2 | 4,630 | personal_cloud |
77,943,210 | 5,790,653 | python while loop if all conditions are equal then do another random choice from list | <p>This is my python code:</p>
<pre class="lang-py prettyprint-override"><code>import secrets
from time import sleep
ids = [{'id': number} for number in range(1, 5+1)]
rand1 = secrets.choice(ids)
rand2 = secrets.choice(ids)
rand3 = secrets.choice(ids)
n = 0
while rand1['id'] == rand2['id'] == rand3['id']:
n ... | <python> | 2024-02-05 18:28:37 | 3 | 4,175 | Saeed |
77,943,150 | 18,150,609 | Microsoft Graph SDK for Python: How to Get a SharePoint List? | <p>Preface, there are similar questions (<a href="https://stackoverflow.com/questions/49349577/microsoft-graph-sdk-and-sharepoint-list-items">such as</a>) but these are different as the SDK for python doesn't seem to provide a manner to specify a domain name for the MS365 tenant.</p>
<p>I've created a client secret wit... | <python><azure><sharepoint><sdk><microsoft-graph-api> | 2024-02-05 18:14:54 | 1 | 364 | MrChadMWood |
77,943,148 | 1,467,552 | How to add numeric value from one column to other List column elements in Polars? | <p>Suppose I have the following Polars DataFame:</p>
<pre><code>import polars as pl
df = pl.DataFrame({
'lst': [[0, 1], [9, 8]],
'val': [3, 4]
})
</code></pre>
<p>And I want to add the number in the <code>val</code> column, to every element in the corresponding list in the <code>lst</code> column, to get the f... | <python><dataframe><python-polars> | 2024-02-05 18:14:30 | 3 | 1,170 | barak1412 |
77,943,147 | 880,874 | Why isn't my script printing all my results to the file? | <p>I have the simple code below that loops through a dataframe and prints the results to the screen and also to a file.</p>
<p>My nag issue is however, it prints all the data to the screen just perfectly, but the file is only getting the last end of the data.</p>
<p>Here is my code:</p>
<pre><code>for star in Constella... | <python><python-3.x> | 2024-02-05 18:14:28 | 1 | 7,206 | SkyeBoniwell |
77,943,054 | 2,289,030 | How do I make a custom class that's serializable with dataclasses.asdict()? | <p>I'm trying to use a dataclass as a (more strongly typed) dictionary in my application, and found this strange behavior when using a custom type subclassing <code>list</code> within the dataclass. I'm using Python 3.11.3 on Windows.</p>
<pre class="lang-py prettyprint-override"><code>from dataclasses import dataclass... | <python><python-3.x><generator><python-dataclasses> | 2024-02-05 17:59:19 | 2 | 968 | ijustlovemath |
77,942,862 | 5,363,686 | Function to aggregate json | <p>Assume I have a gcs bucket with json files with the following structure:</p>
<pre><code>[
{
"Id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"Name": "alibaba",
"storeid": "Y1",
"storeName": "alibaba1",
"a": "1... | <python><pandas> | 2024-02-05 17:27:54 | 2 | 11,592 | Serge de Gosson de Varennes |
77,942,843 | 6,734,243 | how to install a namespace package with hatch? | <p>in The context of the sphinxcontrib organisation the package are supposed to all live in a sphinxcontrib namespace package like "sphinxcontrib.icon" or "sphinxcontrib.badge".</p>
<p>The file have the following structure:</p>
<pre><code>sphinxcontrib-icon/
├── sphinxcontrib/
│ └── icon/
│ ... | <python><packaging><hatch> | 2024-02-05 17:25:56 | 1 | 2,670 | Pierrick Rambaud |
77,942,774 | 4,704,065 | Plot a dataframe with different conditions | <p>I have a data frame where I need to plot X-Y axis value (Itow - X-axis , Icorr - Yaxis) and label them based on svid .</p>
<p>My data fame looks like this:</p>
<p><a href="https://i.sstatic.net/dot0z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dot0z.png" alt="enter image description here" /></a></... | <python><pandas><dataframe><matplotlib> | 2024-02-05 17:15:54 | 1 | 321 | Kapil |
77,942,477 | 8,211,382 | How to Put the message using UOM (begin, commit, backout). getting error: 2012 MQRC_ENVIRONMENT_ERROR | <pre><code>import pymqi
queue_manager = 'QM1'
channel = 'DEV.APP.SVRCONN'
host = '127.0.0.1'
port = '1414'
queue_name = 'TEST.1'
conn_info = f'{host}({port})'
# Connect to the queue manager
qmgr = pymqi.connect(queue_manager, channel, conn_info)
queue = pymqi.Queue(qmgr, queue_name, pymqi.CMQC.MQOO_OUTPUT)
try:
f... | <python><ibm-mq><pymqi> | 2024-02-05 16:28:20 | 2 | 450 | user_123 |
77,942,388 | 2,989,089 | Last git changes on a given file | <p>Using the <a href="https://gitpython.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer"><code>gitpython</code></a> library, I'm trying access the date of the last changes on a given file. So far I only found out how to:</p>
<pre class="lang-py prettyprint-override"><code>import git
# get a handle on a re... | <python><gitpython> | 2024-02-05 16:14:55 | 0 | 884 | Antoine Gallix |
77,942,347 | 3,433,875 | Create an arc between two points in matplotlib | <p>I am trying to recreate the chart below using matplotlib:
<a href="https://i.sstatic.net/P9NGe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/P9NGe.png" alt="enter image description here" /></a></p>
<p>I have most of it done but, I just cant figure out how to create the arcs between the years:</p>
<p... | <python><matplotlib> | 2024-02-05 16:08:10 | 1 | 363 | ruthpozuelo |
77,942,241 | 10,595,871 | pandas dataframe.to_sql() works on jupyter but not on VScode with same parameters | <p>I have a simple code that I'm running fine on jupyter notebook:</p>
<pre><code>import pyodbc
import sqlalchemy
user_id = 'userid'
password = 'password'
server = 'server'
database_name = 'database_name'
driver = 'SQL Server'
connection_string = (
f'DRIVER={{{driver}}};'
f'SERVER={server};'
... | <python><sql-server><pandas> | 2024-02-05 15:55:00 | 1 | 691 | Federicofkt |
77,942,064 | 20,599,682 | Why does running this python program from Terminal fail? | <p>So, I wrote a basic script:</p>
<pre><code>import sys
if len(sys.argv) != 3:
print(0)
else:
arg1 = int(sys.argv[1])
arg2 = int(sys.argv[2])
print(arg1 + arg2)
</code></pre>
<p>But when I try to do <code>python3 test.py 1 2</code> it fails with exit code 1 and just prints "Python"
In my pat... | <python><path><sys> | 2024-02-05 15:27:00 | 0 | 328 | FoxFil |
77,941,994 | 14,775,478 | What is setuptool's alternative to (the deprecated) distutils `strtobool`? | <p>I am migrating to Python 3.12, and finally have to remove the last <code>distutils</code> dependency.</p>
<p>I am using <code>from distutils.util import strtobool</code> to enforce that command-line arguments via <code>argparse</code> are in fact bool, properly taking care of <code>NaN</code> vs. <code>False</code> ... | <python><argparse><setuptools><distutils> | 2024-02-05 15:15:59 | 3 | 1,690 | KingOtto |
77,941,872 | 14,114,654 | Create a new column by combining information from other columns | <p>How could I create the "message" column that incorporates information from other columns? The dataframe is already sorted in every way.</p>
<pre><code>df head members
0 Abba As Ally
1 Abba As Apo
2 Abba As Abba
3 Bella Bi Bella
4 Bella Bi Boo
5 Bella Bi... | <python><pandas><group-by> | 2024-02-05 14:58:18 | 2 | 1,309 | asd |
77,941,622 | 16,092,023 | Not able to call a shell variable as other variable within the script | <p>in order to parse yaml file, we were using the solution provided <a href="https://github.com/mrbaseman/parse_yaml" rel="nofollow noreferrer">here</a> and which is working expected for us to generate the variables in the key value pairs of yaml.</p>
<p>The script part which I tried is as below</p>
<pre><code>#!/bin/b... | <python><bash><shell><yaml><azure-pipelines-yaml> | 2024-02-05 14:22:15 | 0 | 1,551 | Vowneee |
77,941,613 | 8,484,261 | Comparing two pandas dataframe to see the changes and list them out after grouping on three columns? | <p>I have two dataframes df1 and df2 which gives the list of customers at different points of time. Each customer is in a District. Districts are grouped into Regions, which are grouped into Zones.
I am trying to create a table which shows the change in customer count by Zone/Region/District.
Teh output should be as th... | <python><pandas><dataframe> | 2024-02-05 14:20:09 | 1 | 3,700 | Alhpa Delta |
77,941,565 | 1,662,230 | Peewee overwrites default SQL mode | <p>There's no error raised when calling <code>save()</code>, <code>create()</code>, or <code>insert().execute()</code> on a model instantiated with one or more fields omitted, even on fields configured as <code>null=False</code> and <code>default=None</code> (<a href="http://docs.peewee-orm.com/en/latest/peewee/models.... | <python><mysql><peewee><strict><sql-mode> | 2024-02-05 14:11:25 | 1 | 559 | Magnus Lind Oxlund |
77,941,482 | 7,026,806 | Can Mypy overload single objects and unpacked tuples? | <p>The following is easy enough to implement at runtime, but it seems impossible to express in Mypy.</p>
<p>Using the <code>*</code> unpacking (for its nice compactness, e.g. <code>foo(1, 2, ...)</code>) I also want to express the case when there's a single element, because requiring to unpack the single tuple adds a l... | <python><mypy><python-typing> | 2024-02-05 13:58:24 | 1 | 2,020 | komodovaran_ |
77,941,473 | 5,604,555 | Paramiko "UnicodeDecodeError" when authenticating with key from Pageant | <p>Experiencing an issue when attempting to connect to a server using Paramiko and SSH agent Pageant. The error indicates that the script is failing during the connection attempt, specifically when Paramiko tries to interact with the SSH agent (Pageant) and processes the key data. The error message suggests that Parami... | <python><ssh><paramiko><ssh-keys><pageant> | 2024-02-05 13:56:54 | 1 | 1,417 | Frank |
77,941,328 | 86,072 | Is there a way to inherit the parent __init__ arguments? | <p>Suppose I have a basic class inheritance:</p>
<pre><code>class A:
def __init__(self, filepath: str, debug=False):
self.filepath = filepath
self.debug = debug
class B(A):
def __init__(self, portnumber: int, **kwargs):
super(B, self).__init__(**kwargs)
self.portnumber = portnum... | <python><inheritance><python-typing> | 2024-02-05 13:32:54 | 2 | 53,340 | LeGEC |
77,941,127 | 12,173,376 | How can I get the fully qualified names of return types and argument types using libclang's python bindings? | <p>Consider the following example. I use <code>python clang_example.py</code> to parse the header <code>my_source.hpp</code> for function and method declarations.</p>
<h1>my_source.hpp</h1>
<pre class="lang-cpp prettyprint-override"><code>#pragma once
namespace ns {
struct Foo {
struct Bar {};
B... | <python><c++><libclang> | 2024-02-05 12:56:24 | 1 | 2,802 | joergbrech |
77,941,048 | 2,016,632 | Scipy B-splines don't seem to all follow Irwin–Hall | <p>I'm confused how to get B-splines from Scipy. For example, if I take <code>t = [0,0,0,0,1,1,1,1]</code> and <code>c=[1,0,0,0,...]</code> <code>c=[0,1,0,0,...]</code> <code>c=[0,0,1,0,...]</code> and <code>c=[0,0,0,1,...]</code> and call <code>scipy.interpolate.BSpline</code> then I get four lovely cubics: <code>x^3<... | <python><scipy><spline> | 2024-02-05 12:45:49 | 1 | 619 | Tunneller |
77,940,993 | 12,546,311 | How to plot a violinplot from frequency data not using repeat? | <p>I have data in a frequency table since it is too much data without keeping it like this:</p>
<pre><code>value count year status
0 985572 2000 U
1 1857356 2000 U
2 3904079 2000 U
3 6399287 2000 U
4 9321185 2000 U
5 13093158 2000 U
6 163... | <python><matplotlib><seaborn> | 2024-02-05 12:37:23 | 1 | 501 | Thomas |
77,940,781 | 12,106,577 | Decode h264 video bytes into JPEG frames in memory with ffmpeg | <p>I'm using python and ffmpeg (4.4.2) to generate a h264 video stream from images produced continuously from a process. I am aiming to send this stream over websocket connection and decode it to individual image frames at the receiving end, and emulate a stream by continuously pushing frames to an <code><img></c... | <python><ffmpeg><video-streaming><h.264> | 2024-02-05 12:01:48 | 1 | 399 | John Karkas |
77,940,641 | 16,556,045 | Change a MultipleChoiceField to only be able to select one choice at a time | <p>so I am currently working on a program in Django that uses MultipleChoiceFields, I only want to be able to select one choice at a time within the bounds of my code. How exactly would I be able to change my MultipleChoice field to accomplish this goal, and what attributes would I need to add?</p>
<p>I have tried look... | <python><django> | 2024-02-05 11:40:25 | 0 | 934 | KronosHedronos2077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.