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,818,659 | 13,396,497 | Read first two and last rows based on 2 columns | <p>I have a dataframe :</p>
<pre><code>dfs = pd.read_csv(StringIO("""
datetime ID C_1 C_2 C_3 C_4 C_5 C_6
"18/06/2023 3:51:50" 136 101 2024 89 4 3 13
"18/06/2023 3:51:52" 136 101 2028 61 4 3 18
"18/06/2023 3:51:53" 24 101 2029 65 0 ... | <python><pandas> | 2024-01-15 09:05:22 | 1 | 347 | RKIDEV |
77,818,549 | 3,909,896 | Read value with hidden carriage return in boolean field as boolean | <p>I'm trying to read (dirty) CSV files from a cloud storage with PySpark which have <code><boolean>\r</code> values at the end of the line sometimes. This is not always the case, the column also contains correct booleans or even nothing (=null).</p>
<p>I get a schema from another place which specifies the colum... | <python><csv><pyspark> | 2024-01-15 08:44:10 | 1 | 3,013 | Cribber |
77,818,509 | 1,055,817 | ReadTheDocs Sphinx build failing due to version error | <p>I've created a documentation for python library that I released last December.
<a href="https://monalysa.readthedocs.io/en/latest/" rel="nofollow noreferrer">https://monalysa.readthedocs.io/en/latest/</a></p>
<p>GitHub Repository: <a href="https://github.com/siva82kb/monalysa/tree/main" rel="nofollow noreferrer">htt... | <python><python-sphinx><read-the-docs> | 2024-01-15 08:34:38 | 1 | 1,942 | siva82kb |
77,818,152 | 11,922,237 | How to remove Jupyter + all its components completely (As if it never existed) | <p>After I totally messed up my base (root) environment and the Jupyter installation within, I want to install it from scratch. To do so, I need to remove it entirely from my system. I tried the solutions recommended in <a href="https://stackoverflow.com/questions/33052232/how-to-uninstall-jupyter">this thread</a> but ... | <python><jupyter-notebook><jupyter><jupyter-lab> | 2024-01-15 07:12:34 | 1 | 1,966 | Bex T. |
77,817,773 | 6,676,101 | Why would the `plot` method of the `matplotlib` library return an empty list? | <p>I was hoping to make two different plots using <code>matplotlib</code>.</p>
<pre class="lang-python prettyprint-override"><code>import matplotlib.pyplot as pltlib
import numpy as np
x1 = np.arange(1, 5, 0.1)
y1 = np.sin(x1)
x2 = np.arange(1, 5, 0.1)
y2 = np.log10(x2)
plot1 = pltlib.plot()
plot2 = pltlib.plot(x2,... | <python><matplotlib> | 2024-01-15 05:10:15 | 2 | 4,700 | Toothpick Anemone |
77,817,609 | 10,844,607 | Cloud Function can't call PostgreSQL multiple times at once, unless test queries are run first | <p>Edit: The answer to this was a bit complicated. The tl;dr is make sure you do <a href="https://cloud.google.com/functions/docs/samples/functions-tips-lazy-globals#functions_tips_lazy_globals-python" rel="nofollow noreferrer">Lazy Loading</a> properly; many of the variables declared in the code below were declared an... | <python><flask><sqlalchemy><google-cloud-functions><google-cloud-sql> | 2024-01-15 03:48:40 | 2 | 5,694 | Dr-Bracket |
77,817,496 | 4,451,521 | argparse with a pair of floats | <p>Is there an elegant way to introduce a pair of floats using argparse?</p>
<p>I know I can use both separately and later process them to convert them into a numpy array of two floats, or even I have been suggested to enter the pair as a string and convert them to numbers but both seem ugly and unnecessary.</p>
<p>Is ... | <python><argparse> | 2024-01-15 02:59:25 | 0 | 10,576 | KansaiRobot |
77,817,356 | 10,693,596 | How to correctly define a classmethod that accesses a value of a mangled child attribute? | <p>In Python, how do I correctly define a classmethod of a parent class that references an attribute of a child class?</p>
<pre class="lang-py prettyprint-override"><code>from enum import Enum
class LabelledEnum(Enum):
@classmethod
def list_labels(cls):
return list(l for c, l in cls.__labels.items())
... | <python><enums><python-class> | 2024-01-15 01:59:08 | 3 | 16,692 | SultanOrazbayev |
77,817,085 | 2,249,815 | Python 3.X exec + compile - pass command line arguments | <p>I see answers on how to pass command line arguments to exec but not if compile is nestled inside.</p>
<p>Provided with the code:</p>
<pre><code>filename = 'C:\\temp\\script.py'
exec(compile(open(filename).read(),filename, 'exec'))
</code></pre>
<p><strong>How can I pass command line arguments or input to the calling... | <python><python-3.x><blender> | 2024-01-14 23:34:59 | 1 | 4,653 | Jebathon |
77,816,808 | 9,582,542 | Scrapy Collecting Data From Table | <p>I dont get errors from the script below but this script returns no data. I am trying to get all the games for each of the weeks which start in table 4 in the html. When I enter the xpath commands in the scrapy shell I get data but once I put in the parse definition I dont get anything in return.</p>
<pre><code>impor... | <python><scrapy> | 2024-01-14 21:45:59 | 2 | 690 | Leo Torres |
77,816,676 | 6,753,182 | Is it possible to immediately interrupt the AsyncIO event loop upon task completion? | <p>Take a look at the following simple program:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
def callback(_):
loop = asyncio.get_running_loop()
loop.stop()
async def echo(msg):
print(msg)
async def main():
loop = asyncio.get_running_loop()
taskA = loop.create_task(echo(... | <python><python-asyncio><event-loop> | 2024-01-14 20:57:05 | 1 | 3,290 | FirefoxMetzger |
77,816,072 | 998,248 | How does pyright retain argument type information with `partial`? | <p>Take this simple example</p>
<pre class="lang-py prettyprint-override"><code>from functools import partial
def foo(a: str, b: int, c: float, d:str) -> bool:
print(a, b, c, d)
return True
bar = partial(foo, 'a', 1, 2.0)
bar() # error
</code></pre>
<p>Pyright can correctly identify that <code>bar</code> ... | <python><python-typing><pyright> | 2024-01-14 17:43:32 | 1 | 2,791 | Anthony Naddeo |
77,815,953 | 17,835,120 | Autogen connecting to config file errors | <p>Errors connecting to config files for models using autogen, seems to be dependent on the python code I am executing.</p>
<p>My goal is to have one config file that will work for any autogen project.</p>
<p>I'm able to get execute a basic conversation between <code>assistant</code> and <code>user_proxy</code> a but a... | <python><configuration><artificial-intelligence><openai-api><ms-autogen> | 2024-01-14 17:06:36 | 0 | 457 | MMsmithH |
77,815,874 | 4,105,440 | Placing images in an already existing matplotlib axis side by side | <p>Starting from an already existing matplotlib figure I added a footer by appending a small axis to the bottom. The idea is to fill this footer with an arbitrary number of logos. I want to place the logos side by side (separated by a user controllable pad parameter) so that they fill the footer in height, thus computi... | <python><matplotlib> | 2024-01-14 16:46:43 | 1 | 673 | Droid |
77,815,745 | 11,748,924 | Preventing multiple runs of a cell in google colaboratory | <p>Here is I define <code>run_once</code> cell magic in order to prevent multiple output in same code in google colaboratory. If it's happen while code is not changed, it will display history output without actual computation like first run.</p>
<pre><code>#@title Mendefinisikan Fungsi `run_once`
from IPython.core.magi... | <python><jupyter-notebook><jupyter><google-colaboratory> | 2024-01-14 16:09:22 | 1 | 1,252 | Muhammad Ikhwan Perwira |
77,815,725 | 2,991,243 | Unmasking adds an extra whitespace for BPE tokenizer | <p>I created a custom BPE tokenizer for pre-training a Roberta model, utilizing the following parameters (I tried to align it with the default parameters of BPE for RoBERTa.):</p>
<pre><code>from tokenizers.models import BPE
from tokenizers import ByteLevelBPETokenizer
from tokenizers.processors import RobertaProcessin... | <python><huggingface-transformers><tokenize><huggingface><huggingface-tokenizers> | 2024-01-14 16:03:00 | 1 | 3,823 | Eghbal |
77,815,713 | 1,208,142 | Accessing element in web page using Selenium with Python | <p>I can't seem to be able to scrape the description on this page: <a href="https://www.centris.ca/fr/condo-appartement%7Ea-louer%7Ebrossard/17307615?view=Summary&uc=6" rel="nofollow noreferrer">https://www.centris.ca/fr/condo-appartement~a-louer~brossard/17307615?view=Summary&uc=6</a></p>
<p>With this selector... | <python><selenium-webdriver> | 2024-01-14 15:59:00 | 3 | 5,347 | Lucien S. |
77,815,644 | 14,954,262 | For loop with random number of conditions | <p>I have this code for filtering lists in Python:</p>
<pre><code>column_to_check_for_include = [
1,
2,
] # random result possible , could as well be [0] or [0,1,2] or whatever
column_to_check_for_exclude = [
0,
2,
3,
] # random result possible , could as well be [0] or [0,1,2] or whatever
conte... | <python><for-loop><random> | 2024-01-14 15:37:22 | 1 | 399 | Nico44044 |
77,815,379 | 639,676 | How to speed up data exchange between Python processes? | <p>I'm using Python's <code>multiprocessing</code> module for parallel processing of tasks. My goal is to have multiple processes work cooperatively on a set of tasks as efficiently as possible. To avoid duplicating work, I'm using a shared dictionary to track completed tasks. If a task is already completed by one proc... | <python><python-3.x><multiprocessing> | 2024-01-14 14:17:23 | 0 | 4,143 | Oleg Dats |
77,815,182 | 10,544,569 | In python how to update node at jsonpath with filter? | <p>I want to update node at json path with filtering (e.g. json path with such part "[@.field]").</p>
<p>My current attempts with jsonpath_ng failed:</p>
<pre><code>import jsonpath_ng.ext
import jsonpath_ng
from hashlib import md5
# try several ways to transform {"a": {"b": "c"}... | <python><jsonpath> | 2024-01-14 13:18:08 | 1 | 1,325 | IndustryUser1942 |
77,815,033 | 726,730 | Python Aiortc Video delay (after some seconds remote video is frozzen | <p>I am trying to connect a browser peer with a server python peer.</p>
<p>The code I use to stream server video is:</p>
<pre class="lang-py prettyprint-override"><code> def create_local_tracks(self):
global relay, webcam
options = {"video_size": "640x480"}
if relay i... | <python><webrtc><aiortc> | 2024-01-14 12:27:52 | 0 | 2,427 | Chris P |
77,815,006 | 1,473,517 | Find the optimal shift for max circle sum | <p>I have an n by n grid of integers which sits in an infinite grid and I want to find the circular area, with origin at (x, x) (notice that both dimensions are equal), with maximum sum. I assume that x <= 0. Here is an illustration with n=10 of two circles with different centers and different radii. Only one qua... | <python><algorithm><performance><math><optimization> | 2024-01-14 12:18:45 | 1 | 21,513 | Simd |
77,814,939 | 5,798,365 | Double elements of a list with specific indices stored in another list | <p>I have this list:</p>
<pre><code>L=[10, 20, 30, 40, 50, 60, 70, 80, 90]
</code></pre>
<p>and a list of indices of the elements that should be doubled, for example:</p>
<pre><code>dbl_indices = [0, 2, 5]
</code></pre>
<p>which should turn my list into:</p>
<pre><code>[20, 20, 60, 40, 50, 120, 70, 80, 90]
</code></pre... | <python> | 2024-01-14 11:57:54 | 2 | 861 | alekscooper |
77,814,924 | 1,351,182 | How can I explicitly free numpy array memory? | <p>How can I explicitly free the memory associated with a <code>numpy</code> array?</p>
<p>As usual on Stackexchange, there are numerous questions with more-or-less the same title, but with no correct answer.</p>
<p>Here is an example of the problem:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as n... | <python><numpy><memory-management> | 2024-01-14 11:53:24 | 3 | 924 | Myridium |
77,814,729 | 1,473,517 | How to emphasise a part of a circle in matplotlib | <p>I have the following code:</p>
<pre><code>import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import numpy as np
plt.yticks(np.arange(-10, 10.01, 1))
plt.xticks(np.arange(-10, 10.01, 1))
plt.xlim(-10,9)
plt.ylim(-10,9)
plt.gca().invert_yaxis()
# Set aspect ratio to be equal
plt.gca().set_aspect('eq... | <python><matplotlib> | 2024-01-14 10:48:52 | 1 | 21,513 | Simd |
77,814,353 | 4,872,985 | Repeating values on recursive sudoku solver in python | <p>I'm trying to make a sudoku solver using recursion by storing possible values in a dictionary with index as key and the set of possible values as value. Parameter b is just the board expressed as a single list, and .get_row, .get_col, .get_box methods return their respective values properly. If an entry in the dicti... | <python><algorithm><sudoku> | 2024-01-14 08:29:31 | 1 | 616 | Fabio Olivetto |
77,814,328 | 5,459,343 | Consistent characters with DALL E-3 and python API | <p>How can I generate consistent characters across multiple images using the OpenAI Python API for DALL-E 3? I've successfully achieved this by directly prompting the model on the OpenAI website (e.g., by referencing a seed number), but I'm uncertain about replicating the same behavior through the API. Any guidance or ... | <python><openai-api><image-generation> | 2024-01-14 08:18:57 | 0 | 573 | J.K. |
77,814,327 | 5,798,365 | Sorting in the ascending and then in the descending order in Python without negation | <p>I have this list:</p>
<pre><code>L = [(1, 'a'), (4, 'k'), (3, 'p'), (3, 'q'), (2, 'a'), (2, 'b'), (1, 'z')]
</code></pre>
<p>which I want to sort in the ascending order by the 0th element of each tuple and <em>then</em> in the descending order by the 1st one. What's the way to do that?</p>
<p>I could use the general... | <python><sorting> | 2024-01-14 08:18:48 | 2 | 861 | alekscooper |
77,814,292 | 4,281,998 | Sqlalchemy: for loop over related collection skips items | <p>I'm trying to iterate through a related collection (<code>user.addresses</code> below), and disassociate all of them from the parent <code>User</code>. When I set a breakpoint in the loop, my debugger shows the collection has say 3 items, but advancing execution may only hit the breakpoint one more time. In all of m... | <python><sqlalchemy><python-asyncio> | 2024-01-14 08:02:26 | 1 | 3,611 | Brady Dean |
77,814,150 | 2,964,170 | How to find the next element using Python Selenium | <pre><code>
browser.find_element(By.ID,'thread-0-list')
browser.find_element(By.ID,'tpz_body')
browser.find_element(By.ID,'view')
browser.find_element(By.ID,'topaz')
browser.find_element(By.ID,'X1')
browser.find_element('id','X4')
... | <python><selenium-webdriver><selenium-chromedriver> | 2024-01-14 06:41:57 | 2 | 425 | Vas |
77,813,880 | 1,397,922 | How to hide fields in order_line based on some value of their parent (order_id) in Odoo v16? | <p>Is there any way to hide some fields in purchase order line based on some conditions/value of their parent (order_id). I've tried this way:</p>
<pre><code><field name="price_subtotal" attrs="{'invisible': [('order_id.currency_id.name', '=', 'IDR')]}"/>
</code></pre>
<p>But unfortunately, th... | <python><xml><odoo> | 2024-01-14 03:47:54 | 1 | 550 | Andromeda |
77,813,551 | 5,896,591 | Python2.7: How to create a new StreamHandler without losing the module name on each output line? | <p>I want to replace the default <code>StreamHandler</code>, to redirect output to a different stream. However, when I create a new <code>StreamHandler</code>, the module name no longer appears in logging output:</p>
<pre><code>import logging
logging.basicConfig(level = logging.INFO)
LOG = logging.getLogger(__name__)... | <python><python-2.7><logging><python-logging> | 2024-01-14 00:13:36 | 1 | 4,630 | personal_cloud |
77,813,470 | 13,281,808 | Django rest framework is providing the wrong parameters to custom permission class | <p>I'm having an issue where Django Rest Framework's custom permission system is treating my custom permissions' methods like they are <code>classmethods</code> or <code>staticmethods</code>.</p>
<p>When hitting a breakpoint in the permission method:</p>
<pre><code>def has_permission(self, request, view=None):
</code><... | <python><django><django-rest-framework><permissions> | 2024-01-13 23:29:26 | 1 | 379 | NateOnGuitar |
77,813,441 | 2,056,201 | Cannot activate venv while debugging in Visual Studio Code | <p>I am able to activate the venv in terminal from VSCode in the console using <code>venv/Scripts/activate</code> command.</p>
<p>I can run the python script in the terminal</p>
<p>But when I try to Debug the same script in VSCode, it does not run in the Venv and I get missing dependency errors.</p>
<p>What are the st... | <python><windows><visual-studio-code> | 2024-01-13 23:16:55 | 2 | 3,706 | Mich |
77,813,013 | 15,452,898 | Create subsets in Python based on special conditions | <p>I am currently doing some data manipulation procedures and have run into a problem of how to make subsets based on special conditions.</p>
<p>My example (dataframe) is like this:</p>
<pre><code>Name ID ContractDate LoanSum DurationOfDelay
A ID1 2023-01-01 10 0
A ID1 2023-01-03 15 ... | <python><dataframe><pyspark><filtering><data-manipulation> | 2024-01-13 20:37:27 | 1 | 333 | lenpyspanacb |
77,812,660 | 893,254 | Why does the presence of the Global Interpreter Lock not prevent data corruption issues when using thread shared state? | <p>I am trying to understand exactly what the Global Interpreter Lock (GIL) in Python protects, and what it does not protect.</p>
<p>An example code which demonstrates an answer to this question would be useful. I can't create such a thing myself, because I do not fully understand what state the GIL protects and what i... | <python><multithreading><gil> | 2024-01-13 18:37:18 | 1 | 18,579 | user2138149 |
77,812,632 | 11,357,623 | factory pattern with lambda | <p>How would you create a factory based method using lambda?</p>
<p>function signature looks like this. Factory gets a string parameter and returns the instance.</p>
<pre><code>class Foo:
@abstractmethod
def store(factory: Callable[[str], Bar])
obj = factory("abc") # store or call to get insta... | <python><factory> | 2024-01-13 18:28:00 | 1 | 2,180 | AppDeveloper |
77,812,285 | 13,968,392 | column order relevant in df.to_sql(if_exists="append")? | <p>I was wondering, whether <code>df.to_sql("db_table", con=some_engine, if_exists="append")</code> requires that the order of the columns of <code>df</code> (a dataframe) and <code>db_table</code> (a database table) has to be the same. There is nothing about it in the <a href="https://pandas.pydata... | <python><sql><pandas><pandas-to-sql> | 2024-01-13 16:53:39 | 1 | 2,117 | mouwsy |
77,812,185 | 3,123,290 | Accessing Eager-Loaded Relationships When Lazy Loading in Async Sqlalchemy | <p>Asyncio Sqlalchemy has the nifty <code>awaitable_attrs</code> that allows you to lazy load relationships you might otherwise be forced to eager load.
However, when you <em>do</em> lazy load relationship objects, those objects do not appear to execute their respective relationship loading strategies. For example:</p>... | <python><sqlalchemy><python-asyncio> | 2024-01-13 16:25:55 | 1 | 778 | EthanK |
77,812,156 | 2,779,432 | Reassign dictionary key values | <p>I have this dictionary</p>
<pre><code>brands = {
1: 'BPR Performance Rimfire',
2: 'M22',
3: 'M22 Subsonic',
4: 'Super Suppressed',
5: 'Super X',
6: 'USA',
7: 'Varmint HE',
8: 'Varmint LF',
9: 'Wildcat',
10: 'Xpert', }
</code></pre>
<p>and depending on some user selection I want to display a subset of this dictionary... | <python><dictionary> | 2024-01-13 16:16:32 | 1 | 501 | Francesco |
77,811,984 | 2,437,508 | python - can't come back when reaching EOF when using less as a pager | <p>I am using <code>less</code> as a pager so that output of the application can be read easily. I create the subprocess like this:</p>
<pre><code>a_process = subprocess.Popen(["less"], stdin=subprocess.PIPE)
</code></pre>
<p>Then I write into the pager like this (multiple lines):</p>
<pre><code>a_process.std... | <python><subprocess><less> | 2024-01-13 15:28:41 | 1 | 31,374 | eftshift0 |
77,811,879 | 5,177,326 | How to match regex in contents from file in python? | <p>This forum is full of similar questions, so here is mine:</p>
<pre><code>import re
import subprocess
rx = re.compile("(?m)^\(cpu\)\(.*\)")
output = subprocess.run(["cat","/proc/cpuinfo"], stdout=subprocess.PIPE)
lines = output.stdout.decode('utf-8')
r = rx.search(lines)
if r:
p... | <python><regex> | 2024-01-13 14:58:05 | 2 | 328 | olh |
77,811,835 | 7,478,525 | How to configure two microservices using Python (uvicorn/fastapi/requests) to call each other in one use case? | <p>I have two microservices. Let's name them <code>service1</code> and <code>service2</code>.
I have implemened an endpoint on <code>service1</code> which calls an endpoint from <code>service2</code>. To fullfill this request, an endpoint from <code>service2</code> needs some data from <code>service1</code>, so <strong... | <python><rest><microservices><fastapi><uvicorn> | 2024-01-13 14:46:50 | 1 | 783 | westman379 |
77,811,591 | 1,186,421 | Django 5 signal asend: unhashable type list | <p>Trying to make a short example with django 5 async signal. Here is the code:</p>
<p>View:</p>
<pre class="lang-py prettyprint-override"><code>async def confirm_email_async(request, code):
await user_registered_async.asend(
sender=User,
)
return JsonResponse({"status": "ok"})
<... | <python><django><python-asyncio><django-signals> | 2024-01-13 13:31:18 | 1 | 2,673 | KaronatoR |
77,811,394 | 15,671,866 | Buffer overflow script using subprocess | <p>This is my <code>vuln.c</code> code:</p>
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
#include <unistd.h>
// this function is added because I need that sequence of assembly istructions in the binary file
void oh_look_useful() {
asm("pop %rdi; ret");
}
int vuln() {
... | <python><c><subprocess><buffer-overflow> | 2024-01-13 12:21:55 | 0 | 585 | ma4stro |
77,810,920 | 1,473,517 | How to find pair of subarrays with maximal sum | <p>Given an array of integers, I can find the maximal subarray sum using <a href="https://en.wikipedia.org/wiki/Maximum_subarray_problem" rel="nofollow noreferrer">Kadane's algorithm</a>. In code this looks like:</p>
<pre><code>def kadane(arr, n):
# initialize subarray_sum, max_subarray_sum and
subarray_sum = 0... | <python><algorithm><performance> | 2024-01-13 09:25:51 | 2 | 21,513 | Simd |
77,810,703 | 3,337,089 | Loading video using scikit-video latest version and numpy latest version gives numpy has no float attribute error | <p>I have installed the latest version of <code>scikit-video=1.1.11</code> and the latest version of <code>numpy=1.26.1</code>. When trying to load a video as</p>
<pre><code>>>> import skvideo.io
>>> skvideo.io.vread('video_path.mp4')
</code></pre>
<p>I get the following error</p>
<pre><code>Traceback... | <python><numpy><video><scikits> | 2024-01-13 07:56:47 | 1 | 7,307 | Nagabhushan S N |
77,810,665 | 10,896,941 | Is it possible to make non-first tab selected in PySimpleGUI window startup? | <pre><code>window = sg.Window("foobar", layout, margins=(2, 2), finalize=True)
window.Element('-ENCR_TAB-').Select()
</code></pre>
<p>What I see is that the first tab is selected and only after a little while the '-ENCR_TAB-' (the second tab) is selected as expected. Is it possible to have it selected by defa... | <python><user-interface><pysimplegui> | 2024-01-13 07:42:44 | 2 | 410 | Jiri B |
77,810,565 | 6,202,327 | Pymeshlab claiming files are not present when they are? | <p>I have two pymeshlab scripts:</p>
<pre class="lang-py prettyprint-override"><code>import os
import argparse
import pymeshlab
from collections import Counter
def load_mesh(file_path):
ms = pymeshlab.MeshSet()
ms.load_new_mesh(file_path)
measures = ms.get_topological_measures()
print(measures)
d... | <python><geometry><mesh><pymeshlab> | 2024-01-13 06:53:25 | 0 | 9,951 | Makogan |
77,810,548 | 3,547,851 | Langchain model to extract key information from pdf | <p>I was looking for a solution to extract <strong>key information</strong> from pdf based on my instruction.</p>
<p>Here's what I've done:</p>
<ol>
<li>Extract the pdf text using ocr</li>
<li>Use langchain splitter , CharacterTextSplitter, to split the text into chunks</li>
<li>Use Langchain, FAISS, OpenAIEmbedding to... | <python><openai-api><langchain><chatgpt-api><chat-gpt-4> | 2024-01-13 06:43:17 | 0 | 1,143 | Webster |
77,810,507 | 8,211,382 | How to browse the message based on MsgId or CorrelId from queue in pymqi | <pre><code>import pymqi
queue_manager = 'QM1'
channel = 'DEV.APP.SVRCONN'
host = '127.0.0.1'
port = '1414'
queue_name = 'TEST.1'
message = 'Hello from Python 2!'
conn_info = '%s(%s)' % (host, port)
</code></pre>
<p>First I did the PUT operation like the below code and I worked fine. I put for more 2000 messages</p>
<p... | <python><ibm-mq><pymqi> | 2024-01-13 06:25:05 | 2 | 450 | user_123 |
77,810,374 | 5,795,116 | Empty pdf while scraping using Python and Selenium | <p>I'm facing an issue while attempting to print a PDF from a webpage using Selenium in Python. The webpage in question is
<a href="https://jamabandi.nic.in/land%20records/NakalRecord" rel="nofollow noreferrer">https://jamabandi.nic.in/land%20records/NakalRecord</a>. I'm trying to select the first record from each drop... | <python><pandas><web-scraping><selenium-chromedriver><webdriver> | 2024-01-13 05:15:30 | 1 | 327 | jatin rajani |
77,810,274 | 11,748,924 | `%%capture` jupyter notebook or colab doesn't work for storing cell output that display image or table pandas | <p>I have read docs about <code>%%capture cap</code>. It only work for text representation. I expect it stored everything what has been displayed into cell output; image, table, even html element.</p>
<p>And then I can load it into another cell with same identical output:</p>
<h1>CELL_A</h1>
<pre><code>%%capture cap
i... | <python><matplotlib><jupyter-notebook><google-colaboratory><stdout> | 2024-01-13 04:10:55 | 2 | 1,252 | Muhammad Ikhwan Perwira |
77,810,225 | 12,461,032 | fastAPI multiple model file relationship causes circular dependency issue | <p>I am relatively new to fastAPI.</p>
<p>I am developing a set of APIs. To make my project better structured, I separated my model into multiple files. For now, I have an Employee and Skills table. There is a one to many relationship from employee to skills, where each employee can have multiple skills which are tied ... | <python><fastapi><circular-dependency> | 2024-01-13 03:31:26 | 1 | 472 | m0ss |
77,810,105 | 3,973,175 | python3's adjust_text is moving text badly | <p>I have overlapping text from my script:</p>
<pre><code>import matplotlib.pyplot as plt
from adjustText import adjust_text
x = [12,471,336,1300]
y = [2,5,4,11]
z = [0.1,0.2,0.3,0.4]
im = plt.scatter(x, y, c = z, cmap = "gist_rainbow", alpha = 0.5)
plt.colorbar(im)
texts = []
texts.append(plt.text(783, 7.623... | <python><python-3.x><matplotlib> | 2024-01-13 02:23:50 | 1 | 6,227 | con |
77,810,074 | 6,423,456 | How can I maintain an async CosmosDB connection pool in a FastAPI app? | <p>I have a FastAPI app that uses the <code>azure-cosmos</code> library to store data in a CosmosDB. I'm expecting to have a ton of traffic, so I want to create a pool of async CosmosDB clients.</p>
<p>Is that something the azure-cosmos library supports? I can't seem to find any examples of using a connection pool for ... | <python><azure-cosmosdb><fastapi> | 2024-01-13 02:06:58 | 2 | 2,774 | John |
77,810,045 | 214,526 | How to set important features as attribute on XGBRegressor and save as part of json while saving the model | <p>I have trained a <code>XGBRegressor</code> model. Now, I am trying to save the important features as attribute on the model and want that the attribute gets saved/restored along with the model.</p>
<p>I have 2 issues here -</p>
<p>1.</p>
<pre><code>regressor.fit(X=X_train, y=y_train, eval_set=[(X_train, y_train), (X... | <python><python-3.x><xgboost><xgbregressor> | 2024-01-13 01:47:43 | 2 | 911 | soumeng78 |
77,809,859 | 2,537,486 | Change the type of a column multi-index level? | <p>I am reading a <code>.csv</code> file that looks like this:</p>
<pre><code>,1,1,2,2,3,3...
,'A','B','A','B',...
0,1,2,3,4,...
1,2,3,4,5,...
</code></pre>
<p>I read this with
<code>df = pd.read_csv(fname,header=[0,1],index_col=0)</code></p>
<p>Now, deplorably, pandas sets the dtype of the first level of the column mu... | <python><pandas><csv><multi-index> | 2024-01-13 00:04:42 | 2 | 1,749 | germ |
77,809,714 | 7,809,915 | Get page with requests without response or status code | <p>I use the following source code:</p>
<pre><code>import requests
url = "https://www.baha.com/nasdaq-100-index/index/tts-751307/name/asc/1/index/performance/471"
web = requests.get(url)
print(web.status_code)
url = "https://www.baha.com/adobe/stocks/details/tts-117450574"
web = requests.get(url)... | <python><python-3.x><python-requests><python-requests-html> | 2024-01-12 23:11:43 | 1 | 490 | M14 |
77,809,695 | 2,474,876 | partial() on python types? | <p>I often use type hints to help document code & occasionally when the type signatures are too complex & repeatedly used I alias them like this:</p>
<pre class="lang-py prettyprint-override"><code>MyType = Dict[Tuple[int,...], float] # ex: cluster & score.
</code></pre>
<p>Is there a way in python to para... | <python><generics><python-typing><type-alias> | 2024-01-12 23:04:49 | 1 | 417 | eliangius |
77,809,648 | 5,960,363 | VS Code uses wrong interpreter with Poetry and Docker | <h2>Question</h2>
<p>How can I get VS Code to default to my poetry interpreter?</p>
<h2>Background</h2>
<p>I'm working on a Python project in a dev container based on a Debian image, with the Python extension installed in the container. I use Poetry for dependency management. For debug simplicity I'm running as root.</... | <python><docker><visual-studio-code><python-poetry><vscode-remote> | 2024-01-12 22:48:08 | 1 | 852 | FlightPlan |
77,809,634 | 573,082 | How to create windows-based CUDA-enabled docker image? | <p>I'm new to docker. I created an executable from python script (with <code>pyinstaller</code>) that I want to run in docker container. That executable needs CUDA.
I found CUDA-enabled image from <a href="https://hub.docker.com/r/nvidia/cuda" rel="nofollow noreferrer">here</a>.
But, these images are for linux. I canno... | <python><windows><docker><dockerfile><cuda> | 2024-01-12 22:44:15 | 1 | 14,501 | theateist |
77,809,536 | 709,439 | How to store tabular data in Python, to be able to search using different indexes? | <p>I have a table of data, which I read from a database; something like:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>timestamp</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Alice</td>
<td>324234234</td>
</tr>
<tr>
<td>2</td>
<td>Bob</td>
<td>756756746</td>
</... | <python><python-3.x> | 2024-01-12 22:17:03 | 1 | 17,761 | MarcoS |
77,809,501 | 9,092,563 | ScrapyRT Port Unreachable in Kubernetes Docker Container Pod | <p>I'm experiencing difficulties in accessing a ScrapyRT service running on specific ports within a Kubernetes pod. My setup includes a Kubernetes cluster with a pod running a Scrapy application, which uses ScrapyRT to listen for incoming requests on designated ports. These requests are intended to trigger spiders on t... | <python><node.js><docker><kubernetes><scrapy> | 2024-01-12 22:06:55 | 2 | 692 | rom |
77,809,483 | 1,873,689 | MicroPython sleep_us lies? | <p>Working on another project I faced something weird in working with time.<br />
Especially with <code>time.ticks_us()</code>.</p>
<p>I am using the ESP32 S2 module.</p>
<p>Code:</p>
<pre><code>from time import ticks_us, sleep_us
for i in range(100):
t2 = ticks_us()
sleep_us(1)
t = ticks_us() - t2
prin... | <python><time><esp32><micropython> | 2024-01-12 22:01:06 | 2 | 1,301 | aleXela |
77,809,438 | 10,759,785 | How to use Python's multiprocessing library to parallelize a for loop that iterates a depth array? | <p>I work with well log data that has different values related to different depths. Very often I need to iterate over the depths, performing calculations, and storing these values in a previously created array to create new well logs. It is something equivalent to the example below.</p>
<pre><code>import numpy as np
d... | <python><multithreading><numpy><performance><multiprocessing> | 2024-01-12 21:49:39 | 1 | 331 | Lucas Oliveira |
77,809,386 | 119,527 | How to capture all arguments after double dash (--) using argparse | <h2>Background</h2>
<p>Many command-line utilities provide special handling for all arguments after a double dash (<code>--</code>). Examples:</p>
<p><code>git diff</code>: All arguments after <code>--</code> are paths (which can start with <code>-</code>):</p>
<pre><code>git diff [options] -- [path...]
</code></pre>
<... | <python><argparse> | 2024-01-12 21:33:47 | 3 | 138,383 | Jonathon Reinhart |
77,809,374 | 21,305,238 | How to specify a pyparsing expression that has two parts, the length of each may varies but their sum is fixed? | <p>I need to specify an expression that is defined as <code>a<sup><i>m</i></sup>b<sup><i>n</i></sup></code>, such that:</p>
<ul>
<li><code>m</code> + <code>n</code> = <code>t</code>; <code>t</code> is fixed</li>
<li>0 <= <code>m</code> <= <code>t</code> - 1</li>
<li>1 <= <code>n</code> <= <code>t</code></li... | <python><pyparsing> | 2024-01-12 21:31:28 | 1 | 12,143 | InSync |
77,809,352 | 2,417,922 | Why doesn't "np.equal" (Numpy) work for me when executing under PyCharm? | <p>I'm trying to understand some curious behavior running Python <strong>under PyCharm</strong>.
Here's the code:</p>
<pre><code>import numpy as np
s="aabaaaacaabc"
m=np.array( [ list( s ) ] * 3 )
print("m", m )
l=np.array([['a'],['b'],['c']] )
print( "l", l )
x = np.equal( m, l )
</code><... | <python><numpy><pycharm> | 2024-01-12 21:24:42 | 0 | 1,252 | Mark Lavin |
77,809,196 | 8,248,194 | Getting Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead | <p>When doing</p>
<pre><code>python -m twine upload dist/*
</code></pre>
<p>in my computer I get:</p>
<pre><code>Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead.
</code></pre>
<p>I have in ~/pypirc the following data:</p>
<pre><code>[distutils]
index-server... | <python><pypi> | 2024-01-12 20:38:17 | 1 | 2,581 | David Masip |
77,809,173 | 2,805,482 | How overlay a image to specific part on another image in opencv | <p>I have below image and I want to overlay a black patch on the right most side of the image. So I am resizing the both the images to specific size in below code and get only the non white part of overlay and paste it over the specific x,y coordinates but not getting the expected results. I looked into <code>cv2.addWe... | <python><opencv><image-processing><transparency><alphablending> | 2024-01-12 20:32:52 | 1 | 1,677 | Explorer |
77,809,095 | 896,112 | Python syntactic sugar to generate identical instances of the same class? | <p>Let's say I have this simple class :</p>
<pre class="lang-py prettyprint-override"><code>class Person:
def __init__(self, name, id):
self.name = name
self.id = id
</code></pre>
<p>and the following instances :</p>
<pre class="lang-py prettyprint-override"><code>tom = Person('Tom', 12)
dick = Pers... | <python> | 2024-01-12 20:12:44 | 1 | 9,259 | Carpetfizz |
77,809,007 | 7,428,676 | Importing pandas dataframe data to HubSpot CRM | <p>I need to send data which is in a pandas dataframe df. I need to import this data to Hubspot</p>
<pre><code>from io import StringIO
csv_data = StringIO()
df.to_csv(csv_data, index=False)
csv_data.seek(0)
import requests
import json
# Your HubSpot API Key
api_key = 'api_key'
# HubSpot Import API endpoint
endpoint =... | <python><pandas><hubspot> | 2024-01-12 19:54:21 | 1 | 564 | IronMaiden |
77,808,931 | 1,874,170 | Deducing console codepage when PEP 528 may or may not be implemented? | <p>I've got some code that needs to print certain non-ASCII characters to the console, when the console might not be in UTF-8 mode.</p>
<p>On Linux and Mac, it's <em>simply</em> the responsibility of anyone rowdy enough to use a non UTF-8 terminal to set <code>LANG</code> <a href="https://drj11.wordpress.com/2007/05/14... | <python><character-encoding><future-proof> | 2024-01-12 19:36:31 | 2 | 1,117 | JamesTheAwesomeDude |
77,808,731 | 5,036,928 | NumPy Get elements based on starting indices and stride | <p>I am looking for the numpythonic way to accomplish the following:</p>
<pre><code>A = np.arange(1000)
x = np.array([0, 10, 20, 30], dtype=int)
dx = np.array([3, 4, 5, 6], dtype=int)
for x_, dx_ in zip(x, dx):
print(A[x_:x_+dx_])
</code></pre>
<p>Looking at <a href="https://stackoverflow.com/questions/48920850/ho... | <python><numpy><numpy-slicing> | 2024-01-12 18:51:57 | 1 | 1,195 | Sterling Butters |
77,808,666 | 11,357,623 | nested directories and classes in a python library | <h1>Efficient Imports</h1>
<p>I have several nested directories in this library I'm building, some nested directories have no files but other directories, or each directory has one or more class files.</p>
<p>The library is basically getting ported from another language, and I have to keep the structure same.</p>
<p>I'... | <python> | 2024-01-12 18:39:11 | 1 | 2,180 | AppDeveloper |
77,808,612 | 7,648,377 | Python test fail while function works in isolation | <p>This is the function</p>
<pre><code>def update_content_if_reusable(content_data):
""" Add reusable counter """
content = json.loads(content_data)
if 'layouts' in content:
for layout in content['layouts'].values():
if 'isReusable' in layout:
... | <python> | 2024-01-12 18:29:48 | 1 | 2,762 | Andrei Lupuleasa |
77,808,549 | 711,855 | Shared variable & threading.Lock | <p>In Java, unless you use atomic operations or some other thread sync mechanism, you might have stalled values for a shared variable in a thread.</p>
<p>Given the GIL, in CPython. I see the value of a Lock inc cases where:
Multiple steps are taken before assigning a value, even in the confusing <code>a += 1</code> idi... | <python><multithreading><synchronization><locking> | 2024-01-12 18:15:12 | 1 | 2,004 | juanmf |
77,808,548 | 8,022,306 | How to use Django's ORM to update the value for multiple keys in a JsonField using .update() method? | <p>I have a model field I am trying to update using Django's <code>.update()</code> method. This field is a JsonField. I am typically saving a dictionary in this field. e.g. <code>{"test": "yes", "prod": "no"}</code></p>
<p>Here is the model:</p>
<pre><code>class Question(models.... | <python><django> | 2024-01-12 18:14:56 | 2 | 422 | Toluwalemi |
77,808,447 | 2,142,728 | Where is the selected Python interpreter path stored in Visual Studio Code (workspace)? | <p>I am using Visual Studio Code for my Python development, and I can select the Python interpreter through the UI by using cmd + shift + p and then choosing Python: Select interpreter.</p>
<p>I've checked the <code><project>/.vscode/settings.json</code> file, but I couldn't find the information about the selecte... | <python><visual-studio-code><python-poetry> | 2024-01-12 17:52:27 | 0 | 3,774 | caeus |
77,808,398 | 10,155,763 | ECS Scheduled Task Start and End Time | <p>How do i get the start and end time of an ECS scheduled task using CLI or SDK?</p>
<pre><code>aws events describe-rule
</code></pre>
<p>only provides basic information with no start and end time.</p>
| <python><amazon-ecs><aws-fargate><aws-event-bridge> | 2024-01-12 17:41:46 | 1 | 325 | manoman687 |
77,808,349 | 4,506,929 | How do I call Python scripts from within a Python script such that the hierarchy information is always retained? | <p>I'd like to run a few scripts within a script such that</p>
<ol>
<li>Know when a script is being called from another script and when it's run directly</li>
<li>Be able to get information/variables from the parent script into the child script.</li>
</ol>
<p>Here's an illustration of what I mean. Say I have files <cod... | <python><ipython> | 2024-01-12 17:30:14 | 1 | 3,547 | TomCho |
77,808,303 | 6,817,610 | Property decorator without object attribute | <p>I have a class like this that contains property but doesn't have corresponding attribute:</p>
<pre><code>class Example(object):
def __init__(self, csv_dict):
self._csv_dict = csv_dict
@property
def name(self):
return self["name"]
@property
def number(self):
try... | <python><class><object> | 2024-01-12 17:21:59 | 1 | 953 | Anton Kim |
77,808,253 | 1,473,517 | How to replace Counter to use numpy code only | <p>I have this code:</p>
<pre><code>from collections import Counter
import numpy as np
def make_data(N):
np.random.seed(40)
g = np.random.randint(-3, 4, (N, N))
return g
N = 100
g = make_data(N)
n = g.shape[0]
sum_dist = Counter()
for i in range(n):
for j in range(n):
dist = i**2 + j**2
... | <python><numpy> | 2024-01-12 17:12:41 | 1 | 21,513 | Simd |
77,808,226 | 10,645,965 | Pydantic: pass the entire dataset to a nested field | <p>I am using django, django-ninja framework to replace some of my apis ( written in drf, as it is becoming more like a boilerplate codebase ). Now while transforming some legacy api, I need to follow the old structure, so the client side doesn't face any issue. This is just the backstory.</p>
<p>I have two separate mo... | <python><django><django-rest-framework><pydantic><django-ninja> | 2024-01-12 17:09:08 | 1 | 691 | Khan Asfi Reza |
77,808,185 | 7,675,202 | Importing locally created package in python installed from Pipfile not detected | <p>I created a package folder parallel to my apps folder, where my packages folder will have shared/reusable code that'll be used across different apps and probably published, but before then i need to test it and use it locally.</p>
<p>This is my Pipfile for my mobile folder:</p>
<pre><code>[packages]
pronto_auth = {e... | <python> | 2024-01-12 17:02:42 | 1 | 4,345 | Mohamed Mohamed |
77,807,760 | 10,816,965 | Avoid SQL injection when creating user with SQLAlchemy Core | <p>When creating a user with <code>psycopg</code>, I would create the following composite in order to avoid SQL injection:</p>
<pre><code>from psycopg.sql import SQL, Identifier, Literal
username = "test_user"
password = "test_password"
query = SQL(
"CREATE USER {username} WITH ENCRYPTED P... | <python><postgresql><sqlalchemy><psycopg3> | 2024-01-12 15:51:16 | 0 | 605 | Sebastian Thomas |
77,807,681 | 2,611,159 | Getting all values of an "enum" class of ctypes type | <p>I'm struggling to find all values or iterate over all values for an enum class found in an SDK I need to make use of. The enums are not the classical <code>Enum</code> as python comes with but defined as</p>
<pre><code>import ctypes
import ctypes.utils
XSULONG32 = ctypes.c_uint32
class XS_INFO(XSULONG32):
XS_CON... | <python><enums><ctypes> | 2024-01-12 15:37:53 | 1 | 6,094 | planetmaker |
77,807,656 | 5,506,167 | Why is it unsafe to use a generic self type in an argument? | <p>The <a href="https://mypy.readthedocs.io/en/stable/generics.html#generic-methods-and-generic-self" rel="nofollow noreferrer">mypy doc says</a>:</p>
<blockquote>
<p>Note that mypy lets you use generic self types in certain unsafe ways in order to support common idioms. For example, using a generic self type in an arg... | <python><python-typing><mypy> | 2024-01-12 15:33:02 | 1 | 1,962 | Saleh |
77,807,611 | 1,714,692 | Proper index creation in mongodb timeseries collection | <p>I am trying to create indexes for a nested mongo db timeseries collection.
My mongo db version, obtained by running <code>mongod --version</code>, is v3.6.8.</p>
<p>The timeseries schema follows the <a href="https://www.mongodb.com/docs/manual/core/timeseries-collections/" rel="nofollow noreferrer">suggested one</a>... | <python><mongodb><indexing><pymongo><mongodb-compass> | 2024-01-12 15:24:34 | 1 | 9,606 | roschach |
77,807,349 | 6,494,707 | macro accuracy in scikit learn | <p>I am trying to calculate <code>macro accuracy</code>.</p>
<p>if I set</p>
<pre><code>from sklearn.metrics import precision_recall_fscore_support
y_true=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
y_pred=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2]
print(precision_recall_fscore_support(y... | <python><scikit-learn> | 2024-01-12 14:42:15 | 1 | 2,236 | S.EB |
77,807,142 | 13,520,498 | AttributeError: Calling operator "bpy.ops.import_scene.obj" error, could not be found | <p>I am trying to write a python script that will convert triangular-mesh objects to quad-mesh objects.</p>
<p><a href="https://i.sstatic.net/mNB4W.png" rel="noreferrer"><img src="https://i.sstatic.net/mNB4W.png" alt="enter image description here" /></a></p>
<p>For example, image (a) will be my input (<code>.obj/.stl</... | <python><python-3.x><blender><stl-format><bpy> | 2024-01-12 14:06:50 | 2 | 1,991 | Musabbir Arrafi |
77,807,054 | 5,764,661 | FastAPI exception_handlers and mounted apps | <p>I have a FastAPI app :</p>
<pre class="lang-py prettyprint-override"><code>app = FastAPI()
</code></pre>
<p>And several mounted apps.</p>
<pre class="lang-py prettyprint-override"><code>app.mount("app_1", mounted_app_1)
app.mount("app_2", mounted_app_1)
# and so on
</code></pre>
<p>I defined an e... | <python><exception><fastapi> | 2024-01-12 13:49:06 | 0 | 301 | William Pollet |
77,806,959 | 1,652,219 | How to run multiple dependent sql statements in sqlalchemy? | <h2>Problem</h2>
<p>I have a bunch of dependent SQL statements that I would like to run in the same context in sqlalchemy, but I cannot make it work.</p>
<h2>Running All at Once</h2>
<pre><code>values = ', '.join(f"('{id}')" for id in obligor_ids)
q = f"""
USE {database};
DECLARE @Oblig... | <python><sql><sql-server><sqlalchemy><subquery> | 2024-01-12 13:34:32 | 1 | 3,944 | Esben Eickhardt |
77,806,881 | 1,279,000 | How do I update multiple rows when applying a left join on a model query? | <p>In this little card scanning app demo I'm making while learning SQLAlchemy, I'm attempting to make any card(s) assigned to a user inactive after the user is made inactive. I'm struggling to write a query that will update the access card status value with a left join in the mix. Here's what I have now:</p>
<pre><code... | <python><sqlalchemy><flask-sqlalchemy> | 2024-01-12 13:23:41 | 1 | 1,278 | Christopher Stevens |
77,806,839 | 2,168,548 | pydicom.dcmread() consumes a lot of memory when working with bigger files | <p>Is there a way where we can read the dicom file using buffer?</p>
<p>I tried defer_size = '50 MB' , but when i accessed pixel data, all the pixel data was read and stored in memory</p>
<p>Can I do something like:</p>
<pre><code>def buffered_dcmread(file_path, buffer_size=4096):
with open(file_path, 'rb') as file... | <python><pydicom> | 2024-01-12 13:15:31 | 1 | 359 | ShoibAhamed |
77,806,829 | 2,989,777 | How can I write a JMESPath expression to select a keys containing brackets ("({")? | <p>Given the dictionary</p>
<pre class="lang-py prettyprint-override"><code>product_data = {
'restrictions({"basketItems":[],"endDateTime":"","startDateTime":""})': [
{
'__typename': 'ProductRestrictionType',
'type': 'RdgDateRange',
... | <python><json><jmespath> | 2024-01-12 13:13:50 | 1 | 1,185 | yasirnazir |
77,806,798 | 13,180,560 | Unable to bypass CORS in my Flask and React app | <p>I am getting CORS error most of the time even if i give access to all origins its giving the same issue</p>
<p><a href="https://i.sstatic.net/TWSUi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TWSUi.png" alt="CORS ERROR" /></a></p>
<p>Here is my code in Flask</p>
<p><a href="https://i.sstatic.net/I... | <python><reactjs><flask><socket.io><flask-socketio> | 2024-01-12 13:08:52 | 1 | 1,416 | Amir Doreh |
77,806,675 | 11,829,002 | Compute a linear regression, not for all data points | <p>I'm plotting errors obtained for various mesh sizes to study the order of convergence of the model.
As shown in the two plots below the "good regime" is not always present, either because the mesh is too coarse (Fig. 1) or either we reach floating point precision (Fig. 2).</p>
<p><a href="https://i.sstatic... | <python><scikit-learn><linear-regression> | 2024-01-12 12:47:42 | 1 | 398 | Thomas |
77,806,510 | 14,720,380 | Can I use Pydantic to deserialize a Union type, without creating another basemodel? | <p>I want to deserialize some data into a union type like so:</p>
<pre class="lang-py prettyprint-override"><code>from pydantic import BaseModel, Field
from typing import Annotated, Union, Literal
class Foo(BaseModel):
type: Literal["foo"] = "foo"
x: int
class Bar(BaseModel):
type: Li... | <python><pydantic><pydantic-v2> | 2024-01-12 12:19:21 | 1 | 6,623 | Tom McLean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.