QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,767,889 | 1,818,935 | Error running a magic programmatically via IPython's run_cell_magic | <p>Consider the following program, which I wrote in two Jupyter Notebook cells.</p>
<p>Cell 1:</p>
<pre><code>import rumbledb as rmbl
%load_ext rumbledb
%env RUMBLEDB_SERVER=http://public.rumbledb.org:9090/jsoniq
</code></pre>
<p>Cell 2:</p>
<pre><code>%%jsoniq
parse-json("{\"x\":3}}").x
</code></pr... | <python><jupyter-notebook><ipython-magic><jsoniq> | 2024-07-19 06:45:04 | 2 | 6,053 | Evan Aad |
78,767,789 | 1,818,935 | How to invoke a cell magic inside a function? | <p>Consider the following program, which I wrote in two Jupyter Notebook cells.</p>
<p>Cell 1:</p>
<pre><code>import rumbledb as rmbl
%load_ext rumbledb
%env RUMBLEDB_SERVER=http://public.rumbledb.org:9090/jsoniq
</code></pre>
<p>Cell 2:</p>
<pre><code>%%jsoniq
parse-json("{\"x\":3}}").x
</code></pr... | <python><json><jupyter-notebook><ipython><jsoniq> | 2024-07-19 06:21:47 | 1 | 6,053 | Evan Aad |
78,767,751 | 18,595,760 | How to enable Intellisense when using YouTube API with Python in VSCode | <p>I want to get the IntelliSense in VSCode when using Google YouTube API with Python. But I don't know the detailed step.</p>
<pre><code>from googleapiclient.discovery import build
api_key="****"
youtube=build("youtube","v3",developerKey=api_key)
request=youtube.channels().list(
part=... | <python><visual-studio-code><youtube-api><youtube-data-api> | 2024-07-19 06:07:51 | 1 | 317 | test1229 |
78,767,565 | 4,556,479 | f-strings: Skip thousands delimiter (comma) for four digits (1000); limit comma to five or more digits | <p>I have a paper where the editors request I remove thousands separators (comma) for four digit-numbers. I used f-strings:</p>
<pre class="lang-py prettyprint-override"><code>form=",.0f"
format(123456, form)
> '123,456'
format(1234, form)
> '1,234'
</code></pre>
<p>I cannot find the correct format to k... | <python><formatting> | 2024-07-19 04:53:04 | 2 | 3,581 | Alex |
78,767,542 | 355,715 | Is there a way to read sequentially pretty-printed JSON objects in Python? | <p>Suppose you have a JSON file like this:</p>
<pre><code>{
"a": 0
}
{
"a": 1
}
</code></pre>
<p>It's not JSONL, because each object takes more than one line. But it's not a single valid JSON object either. It's sequentially listed pretty-printed JSON objects.</p>
<p><code>json.loads</code> in P... | <python><json><pretty-print> | 2024-07-19 04:39:11 | 2 | 15,817 | polm23 |
78,767,325 | 2,780,906 | What allowable date forms can be used in pandas bdate_series holidays? | <p>I am currently testing the bdate_series to use in my code.</p>
<p>The following code still outputs July 2 as a date, even though I expected it to be excluded.</p>
<pre><code>>>> pd.bdate_range(start='20240701', end='20240705',holidays=["20240702"],freq="C")
DatetimeIndex(['2024-07-01', ... | <python><pandas><date> | 2024-07-19 02:39:22 | 0 | 397 | Tim |
78,767,238 | 1,601,580 | Best way to count tokens for Anthropic Claude Models using the API? | <h1>Summary</h1>
<p>How can I count the number of tokens before sending it to Anthropic?</p>
<hr />
<h1>Question content</h1>
<p>I'm working with Anthropic's Claude models and need to accurately count the number of tokens in my prompts and responses. I'm using the <code>anthropic_bedrock</code> Python client but recent... | <python> | 2024-07-19 01:47:58 | 4 | 6,126 | Charlie Parker |
78,767,207 | 2,925,620 | pyqtgraph: Elegant way to remove a plot from GraphicsLayoutWidget? | <p>I am trying to programmatically add and remove plots to <code>GraphicsLayoutWidget</code>. Adding works as expected via <code>addPlot(row, col)</code> (col is zero for me). Unfortunately there is no <code>removePlot</code> function (which I find odd!), so I am trying to use <code>removeItems(plot)</code>. This does ... | <python><pyqtgraph> | 2024-07-19 01:28:22 | 1 | 357 | emma |
78,767,203 | 6,395,612 | Pyspark Filtering Array inside a Struct column | <p>I have a column in my Spark DataFrame that has this schema:</p>
<pre><code>root
|-- my_feature_name: struct (nullable = true)
| |-- first_profiles: map (nullable = true)
| | |-- key: string
| | |-- value: array (valueContainsNull = true)
| | | |-- element: struct (containsNull = true)
|... | <python><dataframe><pyspark><filter> | 2024-07-19 01:25:06 | 2 | 402 | MathLal |
78,767,142 | 3,120,501 | Dictionary indexing with Numpy/Jax | <p>I'm writing an interpolation routine and have a dictionary which stores the function values at the fitting points. Ideally, the dictionary keys would be 2D Numpy arrays of the fitting point coordinates, <code>np.array([x, y])</code>, but since Numpy arrays aren't hashable these are converted to tuples for the keys.<... | <python><numpy><dictionary><jit><jax> | 2024-07-19 00:48:27 | 2 | 528 | LordCat |
78,767,002 | 15,800,558 | "detail": "Not Found" Error With Python Django REST API | <p>Im having an issue with a Python Django REST API i've built that manages the file upload and retreival from and to a Google Cloud SQL DB. I am not exactly sure whats causing the error but whene i run it runs fine at successfully connects to the Database and connects at <a href="http://127.0.0.1:8000/" rel="nofollow ... | <python><django><debugging><django-rest-framework><http-status-code-404> | 2024-07-18 23:25:07 | 1 | 317 | Sarimm Chaudhry |
78,766,850 | 1,119,391 | Are Python 3.12 subinterpreters multi-CPU? | <p>Python 3.12 exposes the subinterpreter functionality: after starting the Python main.exe you can spawn multiple subinterpreter threads.
Questions:</p>
<ol>
<li>As the subinterpreter threads run in the same process as the Python main thread, does that mean the subinterpreters can only use the cores of the CPU the mai... | <python><python-3.x><python-subinterpreters> | 2024-07-18 22:10:06 | 1 | 335 | stustd |
78,766,780 | 1,749,551 | How to extract a rectangle in an image from identified lines | <p><strong>(See below for update with partially working code.)</strong></p>
<p>I have thousands of images that look like this:</p>
<p><a href="https://i.sstatic.net/531hwP7H.jpg" rel="noreferrer"><img src="https://i.sstatic.net/531hwP7H.jpg" alt="enter image description here" /></a>
<a href="https://i.sstatic.net/KPDK7... | <python><opencv><ocr><hough-transform><document-layout-analysis> | 2024-07-18 21:40:26 | 1 | 4,798 | Nick K9 |
78,766,731 | 3,367,091 | "in" operator for list does not call item's __eq__ method | <p>This is the code setup:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Self, Iterable
class PersonNotFoundError(Exception):
"""Person not found in collection."""
class Person:
"""A person with a name."""
def __init__... | <python> | 2024-07-18 21:26:02 | 2 | 2,890 | jensa |
78,766,698 | 4,228,320 | AMBIGUOUS_REFERENCE error when trying to aggregate a dataframe in azure | <p>Have a dataframe with the following columns
year, month, loc_code, usg_type, id_code, usg</p>
<p>trying to aggregate
in SQL it would have been</p>
<pre><code>select year, month, loc_code, usg_type, count(distinct id_code) as id_count, sum(usg) as traffic
group by all
</code></pre>
<p>In Python I've tried the followi... | <python><dataframe><azure> | 2024-07-18 21:13:47 | 1 | 489 | Ben |
78,766,495 | 1,818,935 | How to use JSONiq in a python program? | <p>How can I use JSONiq to query JSON objects in a python program running on my PC?</p>
<p>I have managed to use JSONiq in a Jupyter Notebook running inside Visual Studio Code, but I'm interested in using JSONiq in a regular python program (*.py), rather than a notebook (*.ipynb).</p>
| <python><json><jsoniq> | 2024-07-18 20:16:05 | 2 | 6,053 | Evan Aad |
78,766,475 | 162,758 | module not found error with poetry and multistage docker image | <p>I am trying to execute a multistage docker build to create a light image. I am using poetry for dependency management. My dockerfile is as below</p>
<pre><code>FROM python:3.12-slim as builder
RUN pip install poetry
RUN mkdir -p /app
COPY . /app
WORKDIR /app
RUN python -m venv .venv
RUN poetry install
FROM python:... | <python><docker><python-poetry><docker-multi-stage-build> | 2024-07-18 20:07:52 | 1 | 2,344 | VDev |
78,766,426 | 13,142,245 | Export Pydantic model classes (not instances) to JSON | <p>I understand that Pydantic can export models to JSON, see <a href="https://docs.pydantic.dev/1.10/usage/exporting_models/" rel="nofollow noreferrer">ref</a>. But in practice, this means instances of a model:</p>
<pre><code>from datetime import datetime
from pydantic import BaseModel
class BarModel(BaseModel):
... | <python><json><pydantic> | 2024-07-18 19:53:24 | 1 | 1,238 | jbuddy_13 |
78,765,650 | 893,254 | Is it possible (or recommended?) to mix abstract base classes with Pydantic BaseModel? | <p>In the example code below, I tried to combine abstract base classes with Pydantic. I wanted to write this code because I had an existing type <code>Ticker</code> which has two implementations. It can either be represented as a string or an integer value.</p>
<p>I later wanted to add some data classes to represent me... | <python><pydantic> | 2024-07-18 16:31:46 | 0 | 18,579 | user2138149 |
78,765,628 | 6,691,051 | Reading .csv column with decimal commas and trailing percentage signs as floats using Pandas | <p>I am faced with reading a .csv file with some columns like this:</p>
<pre><code>Data1 [-]; Data2 [%]
9,46;94,2%
9,45;94,1%
9,42;93,8%
</code></pre>
<p>I want to read <code>Data1 [%]</code> column as a pandas DataFrame with values <code>[94.2, 93.4, 96.4]</code>.</p>
<p>I am able to remove the percentage sign using ... | <python><pandas><dataframe><csv> | 2024-07-18 16:26:32 | 1 | 2,081 | FerventHippo |
78,765,604 | 2,066,725 | How to enable "vi mode" for the python 3.13 interactive interpreter? | <p>One of the new features in python 3.13 is a <a href="https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter" rel="nofollow noreferrer">more sophisticated interactive interpreter</a>. However, it seems that this interpreter is no longer based on <code>readline</code>, and therefore no longe... | <python><python-3.x> | 2024-07-18 16:19:53 | 1 | 1,534 | Kale Kundert |
78,765,505 | 10,958,326 | How to use overload from the typing package within a higher-order function in Python? | <p>Returning an overloaded function from a higher-order callable does not produce expected results with respect to type hints: namely, the resulting function behaves as if it was unannotated at all.</p>
<p>Here a minimal example:</p>
<pre><code>from typing import Optional, overload
def get_f(b: int):
@overload
... | <python><overloading><mypy><python-typing> | 2024-07-18 15:56:51 | 1 | 390 | algebruh |
78,765,504 | 7,112,039 | SQLALchemy: Object deleted by Cascade option is still retrievable even after flushing the session | <p>I have a simple SqlAlchemy Relationship defined as follows</p>
<pre class="lang-py prettyprint-override"><code>class User(BaseModel):
cars = relationship(
"Car",
back_populates="user",
passive_deletes="all",
)
class Car(BaseModel):
user_id: Mapped[O... | <python><sqlalchemy> | 2024-07-18 15:56:44 | 0 | 303 | ow-me |
78,765,477 | 8,605,685 | Why does except Exception appear to not be catching an exception? | <p>The code below raises two exceptions: A <code>ValueError</code> and a library specific <code>ApplicationError</code>. The <code>ValueError</code> is still being printed to the console. Why is the <code>except</code> block not suppressing its output?</p>
<pre><code>from pyomo.common.errors import ApplicationError
fro... | <python><exception> | 2024-07-18 15:50:29 | 1 | 12,587 | Salvatore |
78,765,384 | 20,409,539 | Tkinter interpreting the long press of the button as many press and release events | <p>I want to create a small virtual joystick with <code>tkinter</code>, so I need correct handling of long press of buttons.</p>
<p>I've created a code like this:</p>
<pre><code>import tkinter as tk
def up():
print("Up")
up_button.config(image=up_active_image)
def reset_up(event):
print("Up... | <python><tkinter> | 2024-07-18 15:31:36 | 1 | 317 | Ilia Nechaev |
78,765,225 | 11,357,695 | monkeypatch logging basicConfig with pytest | <p>I have a function that that involves setting up a logger:</p>
<p><code>app/src/app/pipelines.py</code>:</p>
<pre><code>import logging
def get_log_handlers(filepath):
return [logging.FileHandler(filepath,
'w'),
logging.StreamHandler()
]
def function(resul... | <python><logging><pytest><monkeypatching><stringio> | 2024-07-18 15:01:09 | 1 | 756 | Tim Kirkwood |
78,765,111 | 13,866,965 | Issue with Custom Rounding Function | <p>I have implemented a custom rounding function in Python using Pandas, but it's not producing the expected results in certain cases. It basically should always <strong>round down</strong> to the nearest step.Here's the function and how I'm applying it:</p>
<pre><code>import pandas as pd
# Define the custom rounding ... | <python><pandas><dataframe> | 2024-07-18 14:38:54 | 1 | 451 | arrabattapp man |
78,765,048 | 8,112,883 | Embedding variable with HTML tags in plotly dash layout | <p>I have a variable with some text already containing HTML tags - like line breaks/bold/etc.
I'm extracting this variable from a dataframe based on some conditions.</p>
<p>I want to use this inside my Dash layout.</p>
<p><code>myData = df["HTML_TEXT_COLUMN].values[0]</code></p>
<p>For example, you can consider <c... | <python><html><plotly-dash> | 2024-07-18 14:29:41 | 1 | 374 | Manu Manjunath |
78,764,968 | 449,693 | Detecting a specific type of invalid JSON file | <p>I have JSON-like records being written by sensors.</p>
<p>The files are not valid because they look like concatenated records like the following:</p>
<pre><code> {
"timestamp": "2024-07-17T12:31:12Z",
"source_ip": "10.0.0.2",
"source_port": 5678,
&qu... | <python><ijson> | 2024-07-18 14:16:00 | 2 | 12,431 | Tony Ennis |
78,764,883 | 10,164,750 | Decoding Byte to String is adding additional characters "\" | <p>I am trying to convert a <code>bytes</code> field to <code>str</code>. I tried the following code. Not sure, why it is adding an extra <code>char</code> before and after each <code>key</code> and <code>value</code>.</p>
<pre><code>print(event_json)
print(type(event_json))
event_json_nobytes = event_json.decode('utf-... | <python><json><cloudevents> | 2024-07-18 13:57:23 | 1 | 331 | SDS |
78,764,795 | 7,160,592 | Is there a way to enable, pause, resume chrome devtools? | <p>Preq:</p>
<ol>
<li>Launch selenium script in python</li>
<li>Once launched we are trying to connect to chrome devtools and
control the execution of script for debugging.</li>
<li>As and when selenium script starts replaying, I'm fetching websocket
url and executing below code snippet.</li>
</ol>
<p>Below is my code... | <python><selenium-webdriver><websocket><google-chrome-devtools> | 2024-07-18 13:41:10 | 1 | 509 | sridattas |
78,764,778 | 5,950,598 | How to fix "XPath syntax error: Invalid expression" when using etree.XPath in Python while using union operator "|" | <p>I'm trying to compile an XPath expression using etree.XPath in Python, but I'm encountering a syntax error. Here's the code snippet:</p>
<pre class="lang-py prettyprint-override"><code>XPATH = '//bridge-domain/(bridge-domain-group-name|bridge-domain-name|bridge-acs/bridge-ac/interface-name|bridge-acs/bridge-ac/attac... | <python><xpath><lxml> | 2024-07-18 13:38:23 | 1 | 516 | Jan Krupa |
78,764,677 | 16,578,438 | cast list type value of dictionary column in pandas | <p>I am trying to write a complex type to dynamodb, but getting into the error:</p>
<pre><code>import pandas as pd
df = pd.DataFrame.from_records([{"col_w_status": {"ACTIVE":["ABC100-01"],"INACTIVE":["ABC100"]}}])
col_list = ["col_w_status"]
display(df)
for... | <python><pandas><aws-data-wrangler> | 2024-07-18 13:17:38 | 1 | 428 | NNM |
78,764,662 | 3,437,787 | How to pivot predictions over several timesteps against actual values? | <p>I have a python script that produces predictions for a timeseries over several timesteps like this:</p>
<p><a href="https://i.sstatic.net/zTYvhG5n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zTYvhG5n.png" alt="Image of desired output" /></a></p>
<p>I would like to pivot or rearrange the prediction... | <python><pandas> | 2024-07-18 13:15:28 | 4 | 62,064 | vestland |
78,764,659 | 22,370,136 | Scraping all pages using Scrapy-Crawler & LinkExtractor-Rules | <p>I am trying to scrape dockerhub.com with the scrapy-vertical approach using the Crawler and i need to define a rule which gathers all pages with the following pattern:</p>
<ul>
<li><a href="https://hub.docker.com/search?q=python&page=1" rel="nofollow noreferrer">https://hub.docker.com/search?q=python&page=1<... | <python><web-scraping><browser><scrapy><playwright> | 2024-07-18 13:15:21 | 1 | 407 | Vlajic Stevan |
78,764,497 | 15,175,771 | When calling torchvision.transforms.Normalize and converting to PIL.Image, how are values above 1 handled? | <p>Applying <a href="https://pytorch.org/vision/main/generated/torchvision.transforms.Normalize.html" rel="nofollow noreferrer">torchvision.Normalize</a> should lead to values below 0 and above 1, and thus below 0 and 255 when switching to integer values.</p>
<p>However, when watching the values, this seems NOT to be t... | <python><pytorch><python-imaging-library><torch><torchvision> | 2024-07-18 12:43:46 | 1 | 340 | GabrielGodefroy |
78,764,364 | 16,389,095 | How to convert non-readable PDF into readable PDF with OcrMyPdf: troubles with tesseract and configparser | <p>I'm trying to convert a scanned PDF into a readable one.</p>
<p>The original PDF contains text, tables, images/logos. The desired output file should be exactly the same of the original file.</p>
<p>I found different strategies on the web to do it in Python:</p>
<p><a href="https://basilchackomathew.medium.com/best-o... | <python><pdf><ocr><ocrmypdf> | 2024-07-18 12:14:52 | 0 | 421 | eljamba |
78,764,092 | 9,036,382 | How to update a polars dataframe column at a specific range? | <p>I want to update a specific column at a specific row index range.</p>
<p>Here's what I want to achieve in pandas:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({ "foo": [0,0,0,0] })
df["foo"].iloc[0:3] = 1
# or
df.iloc[0:3, df.columns.get_loc("foo")] = 1
</code><... | <python><python-polars> | 2024-07-18 11:20:23 | 2 | 534 | Oreille |
78,764,081 | 3,446,351 | Subtle mistake in conda create syntax will install a patch = 0 version of python | <p>I'm creating a new conda environment with no additional packages.</p>
<p>It is interesting to note the difference in the python interpreter version installed with a small change in the <strong>conda create</strong> syntax...</p>
<pre><code>conda create --name test python=3.11
</code></pre>
<p>...installs python 3.11... | <python><conda> | 2024-07-18 11:17:37 | 1 | 691 | Ymareth |
78,763,960 | 6,144,940 | WindRoseAxe generated incompleted axis | <p>I just encounter this problem, which never happened before.</p>
<p>The axis is not complete. The code works well in previous runs.</p>
<p>I am not sure what detail I should provide for resolving the problem. Please let me know.</p>
<p>Python version : 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)... | <python><python-3.x><windrose> | 2024-07-18 10:56:34 | 1 | 473 | Justin |
78,763,857 | 3,391,592 | Rows not getting added to Snowflake table using Python connector | <p>I am trying to create and load a table in Snowflake using Python. The data is in a pandas data frame. Below is the code I'm using. The table gets created, but it has 0 rows and there's no error message shown.</p>
<pre><code>with engine.connect() as con:
data.head(0).to_sql(name=table_name, con=con, if_ex... | <python><sqlalchemy><snowflake-cloud-data-platform> | 2024-07-18 10:35:24 | 2 | 478 | Moon_Watcher |
78,763,468 | 3,510,201 | Use exc_info for log record information when log is raised within an exceptionhook | <p><strong>TLDR;</strong> When the log record is passed an <code>exc_info</code> is there a way for me to use that for the log record data instead of were it was logged from?</p>
<p>I am using a exceptionhook to log any uncaught exceptions. For normal logging instances I am using the data within the log record to get a... | <python><logging> | 2024-07-18 09:19:41 | 1 | 539 | Jerakin |
78,763,404 | 2,261,637 | Using structlog with Datadog | <p>We're using the logging module from the stdlib to send logs from our Django app to Datadog and we have customised our logging based on <a href="https://pypi.org/project/django-datadog-logger" rel="nofollow noreferrer">django-datadog-logger</a></p>
<p>We're exploring a move to <a href="https://www.structlog.org" rel=... | <python><django><datadog><python-logging><structlog> | 2024-07-18 09:05:07 | 0 | 1,875 | Bruno A. |
78,763,342 | 16,815,358 | Compromise between quality and file size, how to save a very detailed image into a file with reasonable size (<1MB)? | <p>I am facing a small (big) problem: I want to generate a high resolution speckle pattern and save it as a file that I can import into a laser engraver. Can be PNG, JPEG, PDF, SVG, or TIFF.</p>
<p>My script does a decent job of generating the pattern that I want:</p>
<p>The user needs to first define the inputs, these... | <python><opencv><image-processing> | 2024-07-18 08:52:04 | 3 | 2,784 | Tino D |
78,763,286 | 12,439,683 | MyST implicit references work locally but not on Read The Docs | <p>I am using Sphinx to build my documentation and I parse markdown files with MyST.
I used <a href="https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html#inline-links-with-implicit-text" rel="nofollow noreferrer">implicit text</a> to link to different references, for example <code>[](#my-heading)<... | <python><hyperlink><python-sphinx><read-the-docs><myst> | 2024-07-18 08:39:51 | 1 | 5,101 | Daraan |
78,763,225 | 19,745,277 | Python Ping IPv4 and IPv6 from docker container | <p>I am trying to ping IPv4 and IPv6 addresses from inside my docker container.</p>
<p>I already tried using <code>ping3</code>, that does not support IPv6</p>
<pre><code>>>> from ping3 import ping
>>> v4 = ping("142.250.185.110")
>>> v6 = ping("2a00:1450:4001:831::200e")
... | <python><docker><ping> | 2024-07-18 08:25:35 | 1 | 349 | noah |
78,763,062 | 1,397,843 | Why `pd.merge()` still works even though the `on` column is located in the index | <p>Consider the following example:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
df1 = pd.DataFrame(
data={'A': range(5)},
index=range(10, 15),
).rename_axis(index='ID')
df2 = df1.add(100).reset_index()
print(df1)
# A
# ID
# 10 0
# 11 1
# 12 2
# 13 3
# 14 4
print(df2)
# ... | <python><pandas><merge> | 2024-07-18 07:49:53 | 1 | 386 | Amin.A |
78,763,016 | 13,160,199 | Way to convert a latex file to pdf only with python? (without having to locally install anything) | <p>I am building a mathematical software with PyQt, and I would like to provide the users with a result in a file written in LaTex and also the compiled version of it in PDF. However, I can't find a way to do so. All solutions I've seen require me to install a compiler locally.</p>
<p>I cannot expect the users to insta... | <python><pdf><pyqt><latex> | 2024-07-18 07:39:31 | 1 | 335 | Lavínia Beghini |
78,762,922 | 11,345,585 | What is the best approach to handle class instances in django application in a production environment? | <p>I would like to consider 2 approaches. First, you could create a class and its instance in a class and inside views import the instance and call its methods. Second, you import the class and create instance of the class inside the view function when you handle a request. which one do you think is better. Also I am n... | <python><django><class><instance><production-environment> | 2024-07-18 07:18:50 | 1 | 380 | Sachin Das |
78,762,664 | 7,802,751 | When using Google Colab, Python package 'datasets' just disappeared from virtualenv directory 'site-packages' | <p>I'm using Google Colab and trying make a virtual environment to work.</p>
<p>My code is:</p>
<pre><code> from google.colab import drive
drive.mount('/content/drive')
!pip install virtualenv
myenv_dir = '/content/drive/MyDrive/virtual_env/'
!virtualenv {myenv_dir}
!chmod +x {myenv_dir}bin/pip;
!chmod +... | <python><google-drive-api><google-colaboratory><virtualenv><google-cloud-colab-enterprise> | 2024-07-18 06:12:13 | 2 | 997 | Gustavo Mirapalheta |
78,762,448 | 1,818,935 | Unable to load JSONATA into duktape JavaScript engine | <p>I'm trying to use <a href="https://pypi.org/project/jsonata/" rel="nofollow noreferrer">jsonata for python</a> in a Jupyter notebook running in Visual Studio Code. I have installed jsonata via <code>%pip install jsonata</code>, and have imported it via <code>import jsonata</code>. However, when I try to run a comman... | <python><visual-studio-code><jupyter-notebook><jsonata> | 2024-07-18 04:46:15 | 0 | 6,053 | Evan Aad |
78,762,421 | 445,345 | Can you put target value in input x in keras lstm model? | <p>In keras documentation:</p>
<p>Arguments x:</p>
<ul>
<li>A tf.data.Dataset. Should return a tuple of either (inputs, <strong>targets</strong>) or (inputs, <strong>targets</strong>, sample_weights).</li>
<li>A keras.utils.PyDataset returning (inputs, <strong>targets</strong>) or (inputs, <strong>targets</strong>, sam... | <python><tensorflow><keras> | 2024-07-18 04:33:15 | 0 | 3,464 | tipsywacky |
78,762,359 | 16,869,946 | Solving system of integral equations using fsolve and quad in python scipy | <p>I am trying to solve the following system of integral equations with unknowns theta1, theta2, theta3: <a href="https://i.sstatic.net/zOkKCrX5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zOkKCrX5.png" alt="enter image description here" /></a></p>
<p>where Phi and phi are the cdf and pdf of the stan... | <python><scipy><quad><fsolve> | 2024-07-18 04:03:14 | 1 | 592 | Ishigami |
78,761,783 | 2,475,195 | XGBoostError: value -1 for Parameter verbosity exceed bound [0,3] | <p>Error message as in the title. It doesn't make sense to me, per my code below:</p>
<pre><code>clf = xgboost.XGBClassifier(verbosity=1)
print (clf.__class__, clf.verbosity)
# prints <class 'xgboost.sklearn.XGBClassifier'> 1
clf.fit(X=train_data_iter[features].fillna(0), y=train_data_iter['y']) # the error is r... | <python><machine-learning><xgboost><xgbclassifier> | 2024-07-17 22:12:23 | 1 | 4,355 | Baron Yugovich |
78,761,747 | 1,016,004 | Can you specify a default value for an optional element in structural pattern matching? | <p>I have a class <code>Expr</code> that can contain an array of slugs, the first slug defines a type of operation, and in 1 case it can be followed by either 1 or 2 more slugs. Is there a way to use structural pattern matching in such a way that the last slug gets a default value when it's not given? Here are some clo... | <python><structural-pattern-matching> | 2024-07-17 21:55:05 | 1 | 6,505 | Robin De Schepper |
78,761,659 | 6,029,488 | Spyder: pip under different interpreter is used for installing packages | <p>I started using Spyder recently. I have Python 3.7 and 3.11 installed in my machine. I want to use the second one (3.11), therefore, I have successfully (confirmed by checking in console <code>sys.path</code>) adjusted the interpreter in the preferences:
<a href="https://i.sstatic.net/4af6pt1L.png" rel="nofollow nor... | <python><pip><spyder> | 2024-07-17 21:21:33 | 2 | 479 | Whitebeard13 |
78,761,516 | 926,918 | Generate stable combinations of an unsorted list in python | <p>I have a list made of strings which are <strong>not</strong> in sorted order. I wish to generate combinations but in such a way that the order of the elements is as in the list. However, Python <a href="https://docs.python.org/3/library/itertools.html#itertools.combinations" rel="nofollow noreferrer">documentation</... | <python><python-3.x><combinations><python-itertools> | 2024-07-17 20:31:29 | 0 | 1,196 | Quiescent |
78,761,475 | 5,594,008 | parse js string to python | <p>I have a string with js code</p>
<pre><code> [{label: '&nbsp;', name: 'Confirmed', width: 30, formatter: 'checkbox'},{label: 'ID', name: 'ID', width: 100, key:true},{label: 'E-mail', name: 'F250275', width: null, formatter: clearText},{label: 'Agree', name: 'F250386', width: null, formatter: clearText},]
</code>... | <python><parsing> | 2024-07-17 20:18:37 | 2 | 2,352 | Headmaster |
78,761,143 | 13,226,563 | Streaming audio to Amazon Connect through Kinesis Video Streams | <p>What I am trying to achieve is the following.</p>
<p>In Amazon Connect, when I create a Flow with Start Streaming Data block, it starts streaming to a Kinesis Video Stream, and I can call a lambda function with the streams information.</p>
<p>Next, I want this lambda function to stream some audio into the Kinesis Vi... | <python><amazon-web-services><amazon-kinesis><amazon-connect><amazon-kinesis-video-streams> | 2024-07-17 18:42:33 | 1 | 570 | Andy_ye |
78,761,023 | 11,402,025 | fastapi : "GET /docs HTTP/1.1" 404 Not Found | <p>I recently updated fast api from v0.89.1 to v0.110.0 and I am getting the following error.</p>
<p>"GET /docs HTTP/1.1" 404 Not Found</p>
<p>There is no other error to help me debug the issue.</p>
<pre><code>INFO: Uvicorn running on http://0.0.0.0:portNumber (Press CTRL+C to quit)
INFO: Started relo... | <python><python-3.x><fastapi><openapi> | 2024-07-17 18:10:58 | 1 | 1,712 | Tanu |
78,760,980 | 3,724,318 | creating hexagonal lattice graph in networkx | <p>I need to create a hexagonal lattice network based on another researcher's work. The researcher describes describes the structure of their network in the yellow highlighted section of text here.</p>
<p><a href="https://i.sstatic.net/jyB7d7fF.png" rel="noreferrer"><img src="https://i.sstatic.net/jyB7d7fF.png" alt="en... | <python><networkx><graph-theory> | 2024-07-17 17:59:00 | 1 | 1,023 | J.Q |
78,760,916 | 1,284,735 | Difference between integer division vs floating point division + int conversion | <p>Assuming <code>x ≥ 0</code> and <code>y > 0</code> are both 64-bit unsigned integers would there be any correctness difference between below implementation and <code>x // y</code>?</p>
<pre class="lang-py prettyprint-override"><code>def int_divide(x, y):
return int(x / float(y))
</code></pre>
| <python><floating-point> | 2024-07-17 17:42:35 | 1 | 1,587 | petabyte |
78,760,822 | 11,357,695 | pytest import errors - module not found | <p>I have this directory structure:</p>
<pre><code>app/
pyproject.toml
src/
app/
__init__.py
app.py
functions1.py
functions2.py
tests/
test_functions1.py
test_functions2.py
</code></pre>
<p>If I run this on command line from the app d... | <python><import><module><package><pytest> | 2024-07-17 17:14:44 | 1 | 756 | Tim Kirkwood |
78,760,634 | 4,687,531 | Setting the return type of a custom namedtuple | <p>I have a <code>sample_config.json</code> file with potentially an arbitrary number of the parameters. An example of the <code>sample_config.json</code> is as follows:</p>
<pre class="lang-json prettyprint-override"><code>{
"tableA_ID": "tableA.csv",
"tableB_ID": "tableB.csv&quo... | <python><json><namedtuple> | 2024-07-17 16:21:31 | 0 | 1,131 | user4687531 |
78,760,601 | 11,626,909 | Iteration an object in Python | <p>I am new to python. I am trying to parse some 10-Ks from Edgar using <code>edgartools</code> and <code>sec-parsers</code> module of python. Here is my code -</p>
<pre><code>import pandas as pd
# pip install edgartools
from edgar import *
# Tell the SEC who you are
set_identity("Your Name myemail@outlook.com&qu... | <python><edgar> | 2024-07-17 16:15:05 | 3 | 401 | Sharif |
78,760,584 | 1,371,481 | Polars match element counts in List columns before exploding | <p>I have a dataframe with multiple columns containing list items.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
"a": [[1, 2], [3], [4, 5], [1]],
"b": [[4, 5, 7], [6], [4, 5], [3, 2]]
})
</code></pre>
<pre><code>shape: (4, 2)
┌───────────┬─────... | <python><dataframe><python-polars> | 2024-07-17 16:11:11 | 2 | 1,254 | DOOM |
78,760,560 | 447,426 | How to read / restore a checkpointed Dataframe - across batches | <p>I need to "checkpoint" certain information during my batch processing with pyspark that are needed in the next batches.</p>
<p>For this use case, DataFrame.checkpoint seems to fit. While I found many places that explain how to create the one, I did not find any how to restore or read a checkpoint.</p>
<p>F... | <python><pyspark> | 2024-07-17 16:05:57 | 1 | 13,125 | dermoritz |
78,760,550 | 16,869,946 | Permutation summation in Pandas dataframe growing super exponentially | <p>I have a pandas dataframe that looks like</p>
<pre><code>import pandas as pd
data = {
"Race_ID": [2,2,2,2,2,5,5,5,5,5,5],
"Student_ID": [1,2,3,4,5,9,10,2,3,6,5],
"theta": [8,9,2,12,4,5,30,3,2,1,50]
}
df = pd.DataFrame(data)
</code></pre>
<p>And I would like to create a new colum... | <python><pandas><dataframe><algorithm><group-by> | 2024-07-17 16:04:20 | 1 | 592 | Ishigami |
78,760,340 | 17,800,932 | QML layout and padding working in Qt Design Studio but not Qt Creator with Python | <p>I have the following QML code:</p>
<pre><code>import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
Window {
visible: true
width: 300
height: 300
title: "Padding test"
Frame {
anchors.centerIn: parent
padding: 20
ColumnLayout {
... | <python><qt><qml><pyside><qtquick2> | 2024-07-17 15:24:16 | 0 | 908 | bmitc |
78,760,314 | 9,421,213 | Python Locust using raw socket requests | <p>I am using the Locust library to load test a server that listens to TCP/IP socket requests and expecting custom protobuf messages. I have a similator sending message to the server and with locust I am able to create multiple instances and send requests simultaneous. However the statistics of my requests are not show... | <python><python-3.x><locust> | 2024-07-17 15:16:58 | 1 | 681 | Jiren |
78,760,313 | 11,684,473 | Assign DataFrame to particular cell in DataFrame | <p>I have the case when I want to nest DataFrame into another one. The problem is, I want to handle it one by one due to the way data is populated.</p>
<p>Some sources of documentation recommend using an <code>.at</code> operator to set value of particular cell. While this works well with scalar types, it causes a prob... | <python><pandas> | 2024-07-17 15:16:22 | 3 | 1,565 | majkrzak |
78,760,141 | 11,815,097 | Python: List containers in the Azure Data Lake Storage | <p>I'm trying to list the containers inside a specific directory within Azure Data Lake Storage account, but it doesn't seem to be any function that can handle this:</p>
<p>Here is my hierarchy:</p>
<pre><code>assets
root
container1
container2
container3
container4
container5
</code></pre>
<p>I wrote the fol... | <python><azure><storage><azure-data-lake><azure-storage-account> | 2024-07-17 14:40:54 | 1 | 315 | Yasin Amini |
78,759,990 | 10,749,925 | How do install these packages on Ubuntu? | <p>I'm trying to install 2 packages that were no issue on Anaconda virtual environment. But on an AWS EC2 instance of Ubuntu (v24.04 LTS GNU/Linux 6.8.0-1010-aws x86_64), it's not working.</p>
<p>Typically i would just run <code>pip3 install langchain</code> and <code>pip3 install langchain-community</code> but i get t... | <python><linux><ubuntu><amazon-ec2><langchain> | 2024-07-17 14:06:55 | 2 | 463 | chai86 |
78,759,930 | 893,254 | Is it possible to implement RAII with Python in the context of ensuring that the close() function is called on opened files? | <p>I asked a question earlier today, <a href="https://stackoverflow.com/questions/78758529/is-it-important-to-call-close-on-an-file-opened-with-open-if-flush-i"><em><strong>Is it important to call <code>close()</code> on an file opened with <code>open()</code> if <code>flush()</code> is called after each write() operat... | <python><contextmanager><raii> | 2024-07-17 13:54:48 | 1 | 18,579 | user2138149 |
78,759,927 | 16,436,095 | Raising NotImplementedError in abstract methods | <p>While studying the source code of the <code>numbers.py</code> module from build-in lib, I came across two variants of <code>@abstractmethod</code> (with and without the <code>NotImplementedError</code> raise). Example:</p>
<pre class="lang-py prettyprint-override"><code>class Complex(ABC):
@abstractmethod
de... | <python><abc> | 2024-07-17 13:53:58 | 0 | 370 | maskalev |
78,759,886 | 12,439,683 | Add additional class to Interpreted Text Roles in Sphinx | <p>What I am trying to achieve is to (manually) insert a html-class to certain elements using <a href="https://www.sphinx-doc.org/en/master/usage/domains/python.html#" rel="nofollow noreferrer">sphinx' python domain</a></p>
<p>For example I have this string:</p>
<pre class="lang-none prettyprint-override"><code>Lore Ip... | <python><python-sphinx><restructuredtext><docutils> | 2024-07-17 13:45:57 | 2 | 5,101 | Daraan |
78,759,751 | 1,867,328 | Dropping rows of a dataframe where selected columns has na values | <p>I have below code</p>
<pre><code>df = pd.DataFrame(dict(
age=[5, 6, np.nan],
born=[pd.NaT, pd.Timestamp('1939-05-27'), pd.Timestamp('1940-04-25')],
name=['Alfred', 'Batman', np.nan],
toy=[np.nan, 'Batmobile', 'Joker']))
</code></pre>
<p>Now I want to drop those rows where columns <code>name</code> OR... | <python><pandas> | 2024-07-17 13:16:33 | 1 | 3,832 | Bogaso |
78,759,613 | 14,833,503 | AttributeError: module 'keras.src.activations' has no attribute 'get' | <p>I am running the following error when I try to optimize a LSTM using keras tuner in Python: AttributeError: module 'keras.src.activations' has no attribute 'get'.</p>
<p>I am using the following versions: | Python version: 3.11.7 | Keras version: 3.4.1 | TensorFlow version: 2.16.2 | Keras Tuner version: 1.0.5</p>
<p... | <python><tensorflow><keras><deep-learning> | 2024-07-17 12:48:24 | 0 | 405 | Joe94 |
78,759,142 | 665,335 | performance issue converting csv file to xlsx in python | <p>I use the code below to convert csv file to xlsx file.</p>
<p>For a csv file that is 61MB in size, contains 18 columns and 438,000 rows,
it took 3:30 mins, the xlsx file is 29MB in size.</p>
<p>For a csv file that is 480 MB in size, contains 95 columns and 760,000 rows,
it took 30mins, the xlsx file is 276MB in size... | <python><xlsxwriter> | 2024-07-17 11:01:35 | 1 | 8,097 | Pingpong |
78,759,111 | 18,769,241 | How to install Python 3.8.7 using Pip (or easy_install) only in a virtualenv | <p>I have created a virtualenv and want to install python v.3.8.7 using either pip or easy_install tools without affecting the python version installed on the system which Python 2.7.</p>
<p>I tried using:</p>
<pre><code>pip install python3 --upgrade #in the virtual environment
</code></pre>
<p>But the error states tha... | <python><python-3.x><pip> | 2024-07-17 10:54:45 | 1 | 571 | Sam |
78,759,049 | 515,028 | Using Sparse Categorical CrossEntropy, the loss becomes negative (tensorflow/keras) | <p>I am doing the Tensorflow TF tutorial (<a href="https://www.tensorflow.org/text/tutorials/transformer" rel="nofollow noreferrer">https://www.tensorflow.org/text/tutorials/transformer</a>) but with my own data. My data is not related to text, but it is sequences of tokens anyway, with a start token, and an end token.... | <python><tensorflow><keras><transformer-model> | 2024-07-17 10:40:58 | 0 | 1,638 | Dr Sokoban |
78,758,991 | 2,393,472 | Parallel calculation of several custom formulas in LibreOfficeCalc | <p>I wrote a custom formula in Python (for example, the name <strong>Formula 1</strong>) and added it as an extension of LibreOfficeCalc.</p>
<p>There can be a lot of such formulas on the sheet and with different parameters.</p>
<p>Is it possible to somehow force LibreOffice Calc to execute these formulas in any way no... | <python><libreoffice-calc><uno> | 2024-07-17 10:26:48 | 0 | 333 | Anton |
78,758,736 | 8,282,251 | How does toml.TomlPreserveInlineDictEncoder() work? | <p>I had a look on the toml library source code and I think I understand that this encoder should format dictionaries in one line instead of classic dictionary toml format.</p>
<p>My expected behavior is the following :</p>
<pre><code>import toml
data = {'a': 1, 'b': 2, 'c': 3}
# Default Encoder
toml_string = toml.du... | <python><python-3.x><toml> | 2024-07-17 09:34:51 | 1 | 623 | Gautitho |
78,758,686 | 2,351,481 | Schedule Firebase Functions in Python | <p>I'm trying to schedule this function to run every week on Monday at 00:05 AM.</p>
<p>But it doesn't run at that time. Using <code>@scheduler_fn.on_schedule</code> has no effect on my function.</p>
<pre><code>@https_fn.on_request()
@scheduler_fn.on_schedule(
schedule="5 0 * * 0",
timezone=scheduler_... | <python><firebase><google-cloud-platform><google-cloud-functions> | 2024-07-17 09:22:46 | 1 | 365 | Cosmin Mihu |
78,758,644 | 9,877,065 | Python argparse parse_known_args(namespace=); use of namespace? | <p>Trying to understand <a href="https://github.com/schrodinger/pymol-open-source/blob/master/setup.py" rel="nofollow noreferrer">pymol-open-source setup.py</a>, I came accross this use of
<code>argparse.parse_know_args()</code> <code>namespace</code> keyword:</p>
<pre><code>import argparse
...
class options:
os... | <python><argparse><argv> | 2024-07-17 09:16:00 | 2 | 3,346 | pippo1980 |
78,758,574 | 13,765,728 | How to retrive which DAG has updated a Composer Airflow Dataset | <p>Regarding Google Cloud Composer, I have defined a DAG in this way:</p>
<pre><code>dataset = Dataset("//my_Dataset")
dag = DAG(
dag_id='my_dag',
default_args=default_args,
schedule=[dataset],
catchup=False)
</code></pre>
<p>The Dataset (//my_Dataset) can be updated by 2 different DAGs. My aim is to retri... | <python><airflow><directed-acyclic-graphs><google-cloud-composer> | 2024-07-17 08:59:50 | 1 | 457 | domiziano |
78,758,529 | 893,254 | Is it important to call `close()` on an file opened with `open()` if `flush()` is called after each write() operation? | <p>I have read that it is important to call <code>close()</code> on a file which has been opened with <code>open(filename, 'w'|'a')</code> because otherwise changes made to the opened file may not be persisted. I believe this is due to buffering.</p>
<p>My understanding is that the GC mechanism cannot be relied on to p... | <python><garbage-collection><raii> | 2024-07-17 08:48:57 | 1 | 18,579 | user2138149 |
78,758,516 | 8,946,188 | Where to put checks on the inputs of a class? | <p>Where should I put checks on the inputs of a class. Right now I'm putting it in <code>__init__</code> as follows, but I'm not sure if that's correct. See example below.</p>
<pre><code>import numpy as np
class MedianTwoSortedArrays:
def __init__(self, sorted_array1, sorted_array2):
# check input... | <python><python-3.x><validation> | 2024-07-17 08:46:43 | 1 | 462 | Amazonian |
78,758,511 | 1,982,032 | How can convert the dataframe into desired new dataframe effectively? | <p><code>x</code> is a dataframe:</p>
<pre><code>x
year mar 31, 2024 mar 31, 2023
0 net income 306.000 524.0000
1 net income growth -0.416 -0.0455
2 retained rate NaN NaN
3 pe 419.930 0.0000
</code></pre>
<p>It's ro... | <python><pandas><dataframe> | 2024-07-17 08:45:27 | 1 | 355 | showkey |
78,757,840 | 16,527,170 | Converting 1H OHLC Data to 3H OHLC Data using Pandas Dataframe | <p>I have <code>1hr</code> data in <code>df</code> from <code>yfinance</code>. I need to convert that data into <code>3h</code> interval.</p>
<p>Sample Code:</p>
<pre><code>pip install yfinance
import yfinance as yf
ticker_symbol = '^NSEI' # Nifty index symbol on Yahoo Finance
df = yf.download(ticker_symbol, start='20... | <python><pandas><dataframe> | 2024-07-17 05:51:37 | 1 | 1,077 | Divyank |
78,757,696 | 1,176,573 | Python - Check if the last value in a sequence is relatively higher than the rest | <p>For a list of percentage data, I need to check if the last value (<code>90.2</code>) is <em>somehow higher</em> and <em>somewhat "abnormal"</em> than the rest of the data. Clearly it is in this sequence.</p>
<p><code>delivery_pct = [59.45, 55.2, 54.16, 66.57, 68.62, 64.19, 60.57, 44.12, 71.52, 90.2]</code>... | <python><statistics> | 2024-07-17 04:54:24 | 2 | 1,536 | RSW |
78,757,552 | 342,553 | Work out the correct path for Python mock.patch | <p>I am aware the basics of the path for mock.path, but it's increasingly difficult to work out the correct path when the object is encapsulated by layers of dynamic construction, eg. <a href="https://stackoverflow.com/questions/76250086/django-viewflow-how-to-mock-viewflow-handlers">django viewflow how to mock viewflo... | <python><python-mock><django-viewflow> | 2024-07-17 03:47:46 | 1 | 26,828 | James Lin |
78,757,328 | 4,420,797 | Log file: Selection of specific log content inside log file by start and end date | <p>I am working on log analysis where I need to analyze a log file by first extracting the dates within the file. Then, I need to use these dates to define a start date and an end date. Based on the selected start and end dates, only the specific content within that range should be available, effectively filtering the ... | <python><linux><ubuntu><azure-log-analytics> | 2024-07-17 01:57:00 | 1 | 2,984 | Khawar Islam |
78,757,257 | 4,576,447 | Plotly figure with subplots and dropdown hides second plot when non-default option selected | <p>I am trying to generate a Plotly figure with two sub plots and has dropdown menu. The default option works fine (Fig. <a href="https://i.sstatic.net/iU1zCFj8.png" rel="nofollow noreferrer">1</a>) but when other values are selected the second plot disappears (Fig. <a href="https://i.sstatic.net/E4BfwMyZ.png" rel="nof... | <python><button><plotly><dropdown><scatter-plot> | 2024-07-17 01:16:15 | 1 | 6,536 | Tom Kurushingal |
78,757,230 | 8,761,448 | Can Cloud Function HTTP Trigger Logging other info Excluding Http Response | <p><a href="https://i.sstatic.net/2fHhtgdM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2fHhtgdM.png" alt="enter image description here" /></a>I am new to cloud function HTTP trigger,
I wrote a simple function for:</p>
<pre><code>import functions_framework
import logging
@functions_framework.http
def... | <python><google-cloud-platform><google-cloud-functions> | 2024-07-17 00:52:52 | 0 | 573 | YihanBao |
78,757,198 | 6,498,757 | AWS CodeBuild Fails with YAML_FILE_ERROR When Running Python Script in buildspec.yml | <p>I’m trying to run a Python script in AWS CodeBuild using a <code>buildspec.yml</code> file. The Python script is supposed to send an email using AWS SES. Here’s the relevant part of my <code>buildspec.yml</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>version: 0.2
phases:
install:
runtime-versi... | <python><yaml><cicd><amazon-ses><aws-codebuild> | 2024-07-17 00:25:59 | 1 | 351 | Yiffany |
78,757,188 | 1,609,514 | Symbolic conversion of transfer function to state-space model using Sympy looks incorrect | <p>I'm trying out the new <a href="https://docs.sympy.org/latest/modules/physics/control/lti.html" rel="nofollow noreferrer">Sympy control module</a> and a bit puzzled by the output of this symbolic conversion of a Laplace transfer function to a continuous-time state-space model:</p>
<pre class="lang-python prettyprint... | <python><sympy><state-space><python-control> | 2024-07-17 00:19:58 | 0 | 11,755 | Bill |
78,757,169 | 3,949,008 | Python pandas read_sas with chunk size option fails with value error on index mismatch | <p>I have a very large SAS file that won't fit in memory of my server. I simply need to convert to parquet formatted file. To do so, I am reading it in chunks using the <code>chunksize</code> option of the <code>read_sas</code> method in pandas. It is mostly working / doing its job. Except, it fails with the following ... | <python><pandas><sas> | 2024-07-17 00:10:50 | 1 | 10,535 | Gopala |
78,757,088 | 2,009,558 | How can I model the curve of asymmetric peaks using scipy.stats.beta? | <p>I am trying to integrate chromatographic peaks. I need to be able to model the peak shape to consistently determine when the peaks begin and end. I can model Gaussian peaks but many peaks are asymmetrical, as in this example data, and would be better modelled with a Beta distribution. I can fit Gaussian models to th... | <python><scipy><curve-fitting><gaussian><beta-distribution> | 2024-07-16 23:34:11 | 2 | 341 | Ninja Chris |
78,756,920 | 2,170,917 | Stop execution of a python script as if it ran to the end | <p>I want to stop the execution of a Python (3.12) script with a behaviour that is identical to the script running to completion in ideally all contexts, such as:</p>
<ul>
<li>run with <code>python script.py</code>;</li>
<li>run with <code>python -i script.py</code>;</li>
<li>run inside Thonny's shell (or any other IDE... | <python><exit> | 2024-07-16 22:05:38 | 0 | 2,801 | Nikola Benes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.