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 ⌀ |
|---|---|---|---|---|---|---|---|---|
79,313,217 | 11,141,816 | python sympy does not simplify the complex roots of unity | <p>Consider the following sympy expression</p>
<pre><code>(1 - (-1)**(Rational(1,3)) + exp(2*I*pi/3))/(3*(1 + exp(I*pi/3)))
</code></pre>
<p>the <code>.simplify()</code> and <code>.rewrite(exp)</code> does not lead to the identity <code>0</code>.</p>
<p>Basically, the simplification function does not response to the co... | <python><sympy> | 2024-12-28 04:27:20 | 1 | 593 | ShoutOutAndCalculate |
79,313,134 | 200,783 | How do I import from a package in a subdirectory? | <p>I have <a href="https://ics.uci.edu/%7Eeppstein/PADS/" rel="nofollow noreferrer">David Eppstein's PADS</a> library of Python Algorithms and Data Structures in a subdirectory next to my Python script:</p>
<pre><code>- my-script.py
- PADS
- __init__.py
- Automata.py
- Util.py
- ...
</code></pre>
<p>How... | <python><module><package><python-import> | 2024-12-28 02:53:32 | 1 | 14,493 | user200783 |
79,313,103 | 8,116,305 | asof-join with multiple inequality conditions | <p>I have two dataframes: <strong>a (~600M rows)</strong> and <strong>b (~2M rows)</strong>. What is the best approach for joining b onto a, when using 1 equality condition and <strong>2 inequality conditions</strong> on the respective columns?</p>
<ul>
<li>a_1 = b_1</li>
<li>a_2 >= b_2</li>
<li>a_3 >= b_3</li>
<... | <python><dataframe><python-polars><numba><duckdb> | 2024-12-28 02:24:15 | 2 | 343 | usdn |
79,313,033 | 10,941,410 | How to repair a PDF file that was transmitted with a wrong MIME type | <p>I have a service A (flask) that transmits a file to service B (Django) using python's <code>requests</code> library.</p>
<pre class="lang-py prettyprint-override"><code>from typing import TYPE_CHECKING
import magic
if TYPE_CHECKING:
from werkzeug.datastructures import FileStorage
from backendssc.access.vie... | <python><pdf><mime-types><corruption><corrupt-data> | 2024-12-28 00:44:56 | 0 | 305 | Murilo Sitonio |
79,312,947 | 8,276,973 | PyCharm creates new thread when I attach debugger to running process | <p>About three months ago I wrote a set of steps to attach the PDB debugger to a running process in Python (in Ubuntu 20.04). These instructions worked well, but I haven't used them in about three weeks. Today I tried this again, and instead it created a new thread, and I can't debug.</p>
<p>These are the instruction... | <python><python-3.x><pycharm> | 2024-12-27 23:03:26 | 0 | 2,353 | RTC222 |
79,312,881 | 3,990,451 | boost:python expose const std::string& | <p>I understand std::string is exposed to python by implicit converters that don't need to be registered.
However, const std::string& isn't</p>
<p>I have</p>
<pre><code>class Cal {
const std::string& get_name() const;
};
</code></pre>
<p>and the eqv python class</p>
<pre><code>namespace bp=boost::python;
bp::... | <python><c++><boost><boost-python> | 2024-12-27 22:13:02 | 0 | 982 | MMM |
79,312,664 | 10,607,049 | How the memory usage is calculated in function calling in Python's `tracemalloc`? | <p>I want to ask a question regarding Python's memory usage calculation in <code>tracemalloc</code>. I will give an example. I have a Python code structured in this way.</p>
<pre class="lang-py prettyprint-override"><code>def measure_performance(func):
@wraps(func)
def wrapper_func(*args, **kwargs):
tr... | <python><memory-management> | 2024-12-27 19:42:15 | 0 | 477 | Pritam Sinha |
79,312,644 | 5,561,472 | Extracting substring between optional substrings | <p>I need to extract a substring which is between two other substrings. But I would like to make the border substrings optional - if no substrings found then the whole string should be extracted.</p>
<pre class="lang-py prettyprint-override"><code>patt = r"(?:bc)?(.*?)(?:ef)?"
a = re.sub(patt, r"\1"... | <python><regex><regex-greedy> | 2024-12-27 19:26:05 | 1 | 6,639 | Andrey |
79,312,245 | 17,309,108 | How to know the simultaneous query number limit of an HTTP ClickHouse connection? | <p>I used the following code in a Jupyter notebook to send several queries simultaneously:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
import clickhouse_connect
async def query(order: int):
await asyncio.sleep(0.2 * order)
return await client.query(sleep_query)
n = 10
client = await ... | <python><python-asyncio><clickhouse> | 2024-12-27 15:56:55 | 0 | 782 | Vovin |
79,312,159 | 8,229,029 | How to run a parallel for loop in Python when filling an array? | <p>I am using the metpy package to calculate many different weather parameters for many different locations across North America for many different hours. I want to fill arrays containing these weather parameters that look like: [hrs,stns]. I am not able to vectorize these operations, unfortunately (see metpy package... | <python><numpy><for-loop><parallel-processing> | 2024-12-27 15:18:05 | 1 | 1,214 | user8229029 |
79,312,133 | 10,474,998 | Getting all leaf words (reverse stemming) into one Python List | <p>On the same lines as the solution provided <a href="https://stackoverflow.com/questions/65559962/get-all-leaf-words-for-a-stemmed-keyword">in this link</a>, I am trying to get all leaf words of one stem word. I am using the community-contributed (@Divyanshu Srivastava) package <code>get_word_forms</code></p>
<p>Imag... | <python><nlp><nltk> | 2024-12-27 15:04:05 | 1 | 1,079 | JodeCharger100 |
79,311,933 | 179,581 | How to solve multiple and nested discriminators with Pydantic v2? | <p>I am trying to validate Slack interaction payloads, that look like these:</p>
<pre class="lang-yaml prettyprint-override"><code>type: block_actions
container:
type: view
...
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>type: block_actions
container:
type: message
...
</code></pre>
<pre class="... | <python><slack><pydantic> | 2024-12-27 13:33:19 | 1 | 11,136 | Andy |
79,311,930 | 7,082,564 | Empty Plotly Candlestick chart with yfinance.download() | <p>I am trying to plot a simple Candlestick chart from OHLCV data retrieved by yfinance.</p>
<p>This is my code:</p>
<pre><code>import yfinance as yf
import pandas as pd
import plotly.graph_objects as go
from datetime import datetime
tf = '1d' # Time frame (daily)
asset = 'AAPL' # Asset ticker (e.g., Apple)
start = ... | <python><pandas><plotly><yfinance><candlestick-chart> | 2024-12-27 13:30:59 | 1 | 346 | soo |
79,311,873 | 2,386,113 | Vertical lines from 3D surface plot to 2D contour plot | <p>I have a 3D surface plot and a 2D contour plot in the xy plane. I want to create a few vertical lines from the surface plot to the computer plot (ideally, one vertical line per contour).</p>
<p><strong>Sample requirement (copied from <a href="https://docs.tibco.com/pub/stat/14.1.0/doc/html/UserGuide/6-working-with-g... | <python><matplotlib><plot> | 2024-12-27 13:04:19 | 1 | 5,777 | skm |
79,311,809 | 12,415,855 | Automate Chrome Extension using Selenium? | <p>i try to autoamte a chrome-extension using the following code:</p>
<p>This is the chrome-extension:
<a href="https://chromewebstore.google.com/detail/email-hunter/mbindhfolmpijhodmgkloeeppmkhpmhc" rel="nofollow noreferrer">https://chromewebstore.google.com/detail/email-hunter/mbindhfolmpijhodmgkloeeppmkhpmhc</a></p>... | <python><selenium-webdriver><pyautogui> | 2024-12-27 12:27:03 | 1 | 1,515 | Rapid1898 |
79,311,792 | 6,312,979 | Set column names using values from a specific row in Polars | <p>I am bringing in the data from an Excel spreadsheet.</p>
<p>I want to make all the info from <code>df.row(8)</code> into the column header names.</p>
<p>In pandas it was just:</p>
<pre><code>c = [ 'A', 'B', 'C', 'D', 'E', 'F' ]
df.columns = c
</code></pre>
<p>Using the rename does not seem very practical here. Is th... | <python><excel><dataframe><python-polars> | 2024-12-27 12:19:48 | 1 | 2,181 | diogenes |
79,311,706 | 7,052,505 | How to properly use poetry with different versions of python on windows? | <p>I am trying to migrate our projects to using Poetry. What I want to achieve is when people open the project using PyCharm, it will automatically create the environment using Poetry and install dependencies. PyCharm does support this, however, when a different Python version is being specified on <code>pyproject.toml... | <python><pycharm><python-poetry><pyenv> | 2024-12-27 11:41:49 | 0 | 350 | Monata |
79,311,355 | 9,960,809 | Dynamically create modules inside __init__ if they don't exist | <p>I would like to dynamically create and import modules inside an inner <code>__init__.py</code> file, if one or several of a set of indexed submodules doesn't exist.</p>
<p>I have a set of module layers, say;</p>
<pre><code>top_module/
__init__.py
sub_module/
__init__.py
a1/
__init... | <python><python-internals> | 2024-12-27 08:59:39 | 0 | 1,420 | Skenvy |
79,311,280 | 12,411,536 | dask `var` and `std` with ddof in groupby context and other aggregations | <p>Suppose I want to compute variance and/or standard deviation with non-default <code>ddof</code> in a groupby context, I can do:</p>
<pre class="lang-py prettyprint-override"><code>df.groupby("a")["b"].var(ddof=2)
</code></pre>
<p>If I want that to happen together with other aggregations, I can us... | <python><dask><dask-dataframe> | 2024-12-27 08:18:04 | 2 | 6,614 | FBruzzesi |
79,311,210 | 418,246 | Why is Python Rich printing in green? | <p>Using <a href="https://github.com/Textualize/rich" rel="nofollow noreferrer">Rich</a> I get what I think is a spurious green output in the console.</p>
<p>In the following code, the "d:c" is coloured green, the rest of the text is as expected.</p>
<pre><code>from rich.logging import RichHandler
import logg... | <python><logging><escaping><rich> | 2024-12-27 07:41:46 | 1 | 4,641 | Daniel James Bryars |
79,310,820 | 2,941,322 | Error: Explicit Conversion from Data Type ntext to vector Not Allowed in Azure SQL Database | <p>I'm working on implementing hybrid search functionality using Azure SQL Database. I am trying to execute <a href="https://github.com/Azure-Samples/azure-sql-db-vector-search/blob/main/Hybrid-Search/hybrid_search.py" rel="nofollow noreferrer">https://github.com/Azure-Samples/azure-sql-db-vector-search/blob/main/Hybri... | <python><sql><azure><vector><azure-sql-database> | 2024-12-27 03:01:46 | 1 | 541 | UVData |
79,310,810 | 943,222 | windows pip cant install concurrent due to 'could not find a version that satisfies the requirement' but pycharm can | <p>I am writing a small script to do multithreading examples, but I can't get it to work outside the pycharm environment. When I run it in pycharm (community edition) it is able to install the <a href="https://docs.python.org/3.11/library/concurrent.html" rel="nofollow noreferrer">concurrent.futures</a> and execute the... | <python><pycharm><pypi><concurrent.futures> | 2024-12-27 02:52:13 | 1 | 816 | D.Zou |
79,310,713 | 5,567,893 | How to apply the capitalize with condition? | <p>I'm wondering how to use the capitalize function when another column has a specific value.<br />
For example, I want to change the first letter of students with Master's degree.</p>
<pre class="lang-py prettyprint-override"><code># importing pandas as pd
import pandas as pd
# creating a dataframe
df = pd.DataFra... | <python><dataframe> | 2024-12-27 01:06:54 | 2 | 466 | Ssong |
79,310,511 | 352,403 | How do I point to specific Python libraries? | <p>In our environment Ansible is installed on one of the servers that I have access to. However, I do not have access to root so I can only install packages etc as my account.</p>
<p>I installed the packages like requests, pywinrm and few others as my user in a venv but when I execute ansible, it does not pick these up... | <python><ansible> | 2024-12-26 21:57:53 | 1 | 6,134 | souser |
79,310,353 | 2,180,332 | How to wait for page loading in evaluated code with Playwright? | <p>I want to fill a two-steps login form with Playwright.
The Playwright execution is controlled by a library, so I cannot change the execution context.
To fill my form, I can only use some Javascript code that will be executed by <code>evaluate</code>. I have no access to the <code>page</code> object.</p>
<p>In the fo... | <python><playwright><playwright-python> | 2024-12-26 20:02:48 | 1 | 4,656 | azmeuk |
79,310,312 | 3,264,147 | Mojo not recognizing Python types | <p>Looking at <a href="https://docs.modular.com/mojo/manual/python/types#mojo-wrapper-objects" rel="nofollow noreferrer">this document</a>, I realize that this feature may not be supported yet, but I will give it a try. Here is my dilemma. I have a tiny mojo file (magic intiated inside a Python project) which imports a... | <python><mojo> | 2024-12-26 19:41:22 | 0 | 1,002 | vasigorc |
79,310,169 | 2,422,705 | How to read character input, in a terminal, without blocking, in Python? | <p>I have a loop that I need to keep looping. Meanwhile I want to know <em>if</em> the user has pressed a key within the loop, but I don't want to have to wait before continuing.</p>
<p>This also needs to work in a terminal session.</p>
<p>Libraries like <a href="https://pypi.org/project/readchar/" rel="nofollow norefe... | <python><input><keypress> | 2024-12-26 18:14:42 | 0 | 1,559 | Daniele Procida |
79,310,043 | 1,358,829 | vscode: in python, is there a way to know in code if a script is being run with F5 ("Start Debugging") or Ctrl+F5 ("Run Without Debugging") | <p>I run a lot of scripts using VSCode interface and its launch configurations. Since my scripts all produce a lot of artefacts from running, it would be very useful to have an automated way to know if the script is running in debug mode (with F5 in vscode) as oposed to running without debugging (Ctrl+F5 in vscode), so... | <python><python-3.x><visual-studio-code> | 2024-12-26 17:13:47 | 2 | 1,232 | Alb |
79,309,886 | 1,358,308 | Parsing units out of column | <p>I've got some data I'm reading into Python using Pandas and want to keep track of units with the <a href="https://pint.readthedocs.io/en/stable/" rel="nofollow noreferrer">Pint package</a>. The values have a range of scales, so have mixed units, e.g. lengths are mostly meters but some are centimeters.</p>
<p>For ex... | <python><pandas><pint> | 2024-12-26 16:08:46 | 1 | 16,473 | Sam Mason |
79,309,520 | 227,317 | Trying to invoke the dagster web GUI in Pycharm | <p>Using Pycharm on Windows, I've created a new project, and put dagster and dagster-webserver into my requirements file. I can successfully import dagster into scripts, and write code - it looks good.</p>
<p>However, I can't use the terminal to invoke 'dagster dev' to run the web GUI for example. It says it is not a v... | <python><pycharm><dagster> | 2024-12-26 12:47:39 | 0 | 993 | Peter Schofield |
79,309,271 | 1,487,336 | Pandas Series subtract Pandas Dataframe strange result | <p>I'm wondering why pandas Series subtract a pandas dataframe produce such a strange result.</p>
<pre><code>df = pd.DataFrame(np.arange(10).reshape(2, 5), columns='a-b-c-d-e'.split('-'))
df.max(axis=1) - df[['b']]
</code></pre>
<p>What are the steps for pandas to produce the result?</p>
<pre><code> b 0 1
0 NaN ... | <python><pandas><dataframe> | 2024-12-26 10:47:40 | 2 | 809 | Lei Hao |
79,309,252 | 28,063,240 | Typehint a method that returns new instance using a superclass classmethod | <pre class="lang-py prettyprint-override"><code>from typing import Self, Union
class Superclass:
@classmethod
def from_dict(cls, dict_: dict[str, str]) -> Self:
return cls(**dict_)
class Subclass(Superclass):
def __init__(self, name: Union[str, None] = None):
self.name = name
def... | <python><python-typing> | 2024-12-26 10:32:37 | 1 | 404 | Nils |
79,309,217 | 2,856,552 | How can I plot polygon numbers from a shapefile in python? | <p>I would like to plot each polygon's number within the polygon (not usually done). I am able to write the polygon names to a csv file with the following code;</p>
<pre><code>import geopandas as gpd
gdf1 = gpd.read_file("path/to/shapefile")
gdf= = gpd.read_file("path/to/shapefile")
gdf = gdf['geo... | <python><pandas> | 2024-12-26 10:09:28 | 1 | 1,594 | Zilore Mumba |
79,309,190 | 2,013,747 | numpy convention for storing time series of vectors and matrices - items in rows or columns? | <p>I'm working with discrete-time simulations of ODEs with time varying parameters. I have time series of various data (e.g. time series of state vectors generated by <code>solve_ivp</code>, time series of system matrices generated by my control algorithm, time series of system matrices in modal form, and so on).</p>
<... | <python><numpy> | 2024-12-26 09:54:39 | 1 | 4,240 | Ross Bencina |
79,309,183 | 1,913,554 | Python projects with pick-and-choose submodules | <p>I am building a database management project. I want it to be able to work with MariaDB and SQLServer, but I don't want the MariaDB users to have to install SQLServer drivers and libraries, or vice-versa. I've seen this done with, for instance, SQLAlchemy, but their approach doesn't look very straightforward.</p>
<p>... | <python><build><project> | 2024-12-26 09:51:51 | 0 | 669 | Robert Rapplean |
79,308,624 | 3,099,733 | python subprocess pending on running a nohup bash script | <p>Given the following code example:</p>
<pre class="lang-py prettyprint-override"><code># save as test.py
import subprocess as sp
import time
script = '''#!/bin/bash
nohup sleep 10 &
'''
with open('test.sh', 'w') as f:
f.write(script)
start_ts = time.time()
cp = sp.run('bash test.sh', shell=True, capture_ou... | <python><bash><subprocess><nohup> | 2024-12-26 03:46:21 | 0 | 1,959 | link89 |
79,308,396 | 1,112,406 | Does colab misunderstand type hints? | <p>The following code produces a colab error marker, but it runs properly.</p>
<pre><code>str1 = 'abcde'
zipped: List[Tuple[int, str]] = [(intgr, ltr) for intgr, ltr in enumerate(str1)]
# This is a clever way to "unzip"
(tuple3, _) = zip(*zipped)
lst3a: list = list(tuple3)
</code></pre>
<p>Everything is fine... | <python><google-colaboratory><python-typing> | 2024-12-25 22:20:53 | 1 | 2,758 | RussAbbott |
79,308,356 | 12,350,600 | FPDF2 render_toc spans multiple pages it writes over page headers | <p>Basically if my table of contents exceeds one-page then it the contents of the 2nd page overlaps with the document header.</p>
<p>I tried adding</p>
<pre><code>self.set_y(15)
</code></pre>
<p>at the end of the header function. However this didn't help.</p>
<p>(Submitted the issue : <a href="https://github.com/py-pdf... | <python><python-3.x><fpdf><fpdf2> | 2024-12-25 21:36:24 | 0 | 394 | Kruti Deepan Panda |
79,308,265 | 19,626,271 | Fast(est) method to iterate through pairs of indices in Python, using numpy | <p>I'm constructing a graph with ~10000 nodes, each node having metadata that determine which other nodes it will be connected to, using an edge.<br>
Since the number of edge possibilities (~50M) is far greater than the actual number of edges that will be added (~300k), it is suboptimal to just iterate through node-pai... | <python><arrays><numpy><iteration><runtime> | 2024-12-25 20:13:14 | 0 | 395 | me9hanics |
79,308,202 | 6,462,301 | How to improve responsiveness of interactive plotly generated line plots saved as html files? | <p>I have some very long time series data (millions of data points) and generate interactive plotly html plots based on this data. I am using <code>Scattergl</code> from plotly's <code>graphical_obects</code>.</p>
<p>When I attempt to zoom in on these plots, the browser (both chrome and firefox) will go unresponsive.<... | <python><plotly><zooming><large-data> | 2024-12-25 19:16:20 | 1 | 1,162 | rhz |
79,308,067 | 893,254 | Which Python or SQL Alchemy datatypes should be used for interfacing with databases containing hash values? | <p>SQL Alchemy supports multiple ways of specifying datatypes for SQL database columns. If regular Python datatypes are used, SQL Alchemy will try to sensibly map these to datatypes supported by the connected to database.</p>
<p>There is also the possibility of using more precicely defined types which are supplied by t... | <python><postgresql><sqlalchemy> | 2024-12-25 17:21:18 | 2 | 18,579 | user2138149 |
79,308,033 | 893,254 | Which Python or SQL Alchemy datatype should be used to store the Python `bytes` datatype as a fixed width field? | <p>I want to store some data into a SQL database. (In this case, Postgres, however this may not be relevant.)</p>
<p>Some of the columns I want to store contain binary data. The Python datatype is <code>bytes</code>.</p>
<p>What datatype should I use to specify the <code>bytes</code> datatype with SQL Alchemy? (With th... | <python><sqlalchemy> | 2024-12-25 16:51:12 | 1 | 18,579 | user2138149 |
79,307,990 | 893,254 | How to specify a fixed length string for an SQL Alchemy column data type? | <p>The following code snippet is an SQL Alchemy ORM table definition class.</p>
<pre><code>class HtmlData(MyBase):
__tablename__ = 'html_data_table_name'
html_id: Mapped[int] = mapped_column(primary_key=True)
html_div: Mapped[str]
html_div_md5: Mapped[str]
</code></pre>
<p>If I run the <code>create_all... | <python><sqlalchemy> | 2024-12-25 16:33:47 | 1 | 18,579 | user2138149 |
79,307,720 | 7,512,296 | FastAPI: The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async | <p>I'm learning FastAPI from their official tutorial guide and I've reached currently at chapter 5 (Databases with SQLModel). I'm using neon db as stated in the docs.</p>
<p>my code are as follows:</p>
<p><code>src/__init__.py</code></p>
<pre><code>from sqlmodel import create_engine, text
from sqlalchemy.ext.asyncio im... | <python><fastapi><python-3.9><sqlmodel> | 2024-12-25 13:59:46 | 2 | 1,596 | psudo |
79,307,527 | 13,392,257 | Calling AIOKafkaConsumer via FastAPI raises "object should be created within an async function or provide loop directly" error | <p>I have a FastAPI application that subscribes to Kafka topic using <em>asynchronous</em> code (i.e., <code>async</code>/<code>await</code>). I have to create a unit test for my application.</p>
<p>My code:</p>
<pre class="lang-py prettyprint-override"><code>def create_consumer() -> AIOKafkaConsumer:
"&quo... | <python><apache-kafka><fastapi><kafka-consumer-api><aiokafka> | 2024-12-25 12:07:59 | 2 | 1,708 | mascai |
79,307,099 | 1,325,861 | Add links in dash-leaflet geojson popups that have a callback when clicked | <p>I've created an interactive map using dash-leaflet using the geojson module (hope module is the right word).</p>
<p>I have created custom html popups for each marker. I need to incorporate links in the popup that trigger a callback so that the app can fetch a file and provides a download through the user's browser.<... | <python><plotly-dash><geojson><dash-leaflet> | 2024-12-25 07:54:48 | 1 | 535 | Gaurav Suman |
79,306,936 | 1,307,905 | how to fix ruff error on module level docstring between from future and normal imports | <p>Many of my Python files start with a future import and a module level docstring:</p>
<pre><code>from __future__ import annotations
"""
module level docstring
"""
from datetime import datetime as DateTime
print(DateTime.today())
</code></pre>
<p>The <code>from __future__</code> import... | <python><ruff> | 2024-12-25 05:41:38 | 1 | 78,248 | Anthon |
79,306,829 | 4,421,975 | MESH created with ezdxf crashed Autodesk Viewer | <p>Here is my code:</p>
<pre><code>import ezdxf
import numpy as np
x,y = np.meshgrid(range(-3,3),range(-3,3))
z = x**2 + y**2
doc = ezdxf.new('R2010', setup=True)
# Add a mesh entity
msp = doc.modelspace()
rows, cols = z.shape
# Add a MESH entity
mesh = msp.add_mesh()
msp.doc.layers.add("3d_surface")
me... | <python><dxf><ezdxf> | 2024-12-25 03:52:23 | 1 | 1,481 | OMRY VOLK |
79,306,481 | 11,751,799 | How can I save a figure to PDF with a specific page size and padding? | <p>I have generated a <code>matplotlib</code> figure that I want to save to a PDF. So far, this is straightforward.</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [3, 5, 4, 7]
plt.scatter(x, y)
plt.savefig(
"example.pdf",
bbox_inches = "ti... | <python><matplotlib><plot><graph> | 2024-12-24 21:00:00 | 3 | 500 | Dave |
79,306,431 | 5,178,381 | Having trouble accessing the values of an ElementTree root.iter object | <p>I have an xml document from the IRS and I'm trying to grab the values of specific tags that interest me. For example, in the following xml data, I'm interested in the value of <strong>CYTotalExpensesAmt</strong>, which is 12345:</p>
<pre><code><returndata>
<irs990>
<CYTotalExpensesAmt>1... | <python><xml> | 2024-12-24 20:17:27 | 1 | 461 | Ryan Oliver Lanham |
79,306,396 | 6,709,460 | Python script deploys smart contract on sandbox local network, but application link fails with "Error: Application failed to load" | <p>Here is my code:</p>
<pre><code>from beaker import *
from pyteal import *
app = Application('Testing123')
if __name__ == '__main__':
# Build the app and export it
app.build().export('./TestFolder')
# Get the accounts (ensure the localnet is defined correctly)
accounts = localnet.get_accounts... | <python><algorand> | 2024-12-24 19:45:00 | 0 | 741 | Testing man |
79,306,325 | 1,103,595 | Cannot instance custom environment with OpenAI Gymnasium | <p>I'm trying to make my own checkers bot to try and teach myself reinforment learning. I decided to try using Gymnasium as a framework and have been following the tutorials at <a href="https://gymnasium.farama.org/introduction/create_custom_env/" rel="nofollow noreferrer">https://gymnasium.farama.org/introduction/cre... | <python><openai-gym> | 2024-12-24 18:50:15 | 0 | 5,630 | kitfox |
79,306,315 | 13,392,257 | Can't create second celery queue | <p>I want to create two celery queues (for different types of tasks)</p>
<p>My celery configuration. I expect that this config creates two queues <code>'celery' and 'celery:1' </code></p>
<pre><code># celery.py
import os
from celery import Celery
from core_app.settings import INSTALLED_APPS
# this code copied from m... | <python><django><celery> | 2024-12-24 18:44:17 | 1 | 1,708 | mascai |
79,306,282 | 8,512,262 | Segmentaiton fault or Trap in pyobjc keyboard hook | <p>I'm trying to write a small application for macOS in Python where opening characters such as <code>[ { ( < " '</code> are paired/closed automatically (similar to how it's handled in editors like VS Code, but globally).</p>
<p>I'm using <code>pyobjc</code> to set up a keyboard hook. So far I've been able to g... | <python><macos><segmentation-fault><hook><pyobjc> | 2024-12-24 18:22:03 | 0 | 7,190 | JRiggles |
79,306,280 | 6,550,398 | Preserving Anchors for Numeric Value 0 in ruamel.yaml | <p>I'm encountering an issue with preserving YAML anchors for numeric value, particularly with the number 0 all the other numeric value works fine, when using <code>ruamel.yaml</code>. Here's what's happening:</p>
<p>Context: I'm using <code>ruamel.yaml</code> to parse and manipulate YAML files in Python. I need to kee... | <python><yaml><ruamel.yaml> | 2024-12-24 18:21:09 | 1 | 462 | Ravi |
79,306,264 | 7,233,155 | Python typing for a generic instance method decorator | <p>I am creating a generic decorator for an instance method:</p>
<pre class="lang-py prettyprint-override"><code>def my_dec(func):
def wrapper(self, *args, **kwargs):
print("do something")
return func(self, *args, **kwargs)
return wrapper
</code></pre>
<p>All works fine, except typing.... | <python><decorator><python-typing><mypy> | 2024-12-24 18:15:29 | 0 | 4,801 | Attack68 |
79,306,155 | 10,474,998 | Move a string from a filename to the end of the filename in Python | <p>If I have documents labeled:</p>
<pre class="lang-none prettyprint-override"><code>2023_FamilyDrama.pdf
2024_FamilyDrama.pdf
2022-beachpics.pdf
2020 Hello_world bring fame.pdf
2019-this-is-my_doc.pdf
</code></pre>
<p>I would like them to be</p>
<pre class="lang-none prettyprint-override"><code>FamilyDrama_2023.pdf
F... | <python><filenames> | 2024-12-24 17:26:57 | 6 | 1,079 | JodeCharger100 |
79,305,935 | 28,063,240 | Generate dataclass for typing programmatically | <p>How can I express</p>
<pre class="lang-py prettyprint-override"><code>@dataclass
class Measurements:
width: int
height: int
head_left: int
head_right: int
head_width: int
head_top: int
head_bottom: int
head_height: int
space_above_head: int
space_below_chin: int
eyes_to_bo... | <python><python-typing><python-dataclasses> | 2024-12-24 15:22:31 | 1 | 404 | Nils |
79,305,824 | 8,229,265 | Efficiently Removing a Single Page from a Large Multi-page TIFF with JPEG Compression in Python | <p>I am working with a large multi-page TIFF file that is JPEG-compressed, and I need to remove a single page from it. I am using the tifffile Python package to process the TIFF, and I already know which page I want to remove based on metadata tags associated with that page. My current approach is to read all pages, mo... | <python><out-of-memory><tiff> | 2024-12-24 14:29:38 | 1 | 310 | Zenquiorra |
79,305,588 | 7,715,250 | Use YOLO with unbounded input exported to an mlpackage/mlmodel file | <p>I want to create an .mlpackage or .mlmodel file which I can import in Xcode to do image segmentation. For this, I want to use the segmentation package within YOLO to check out if it fit my needs.</p>
<p>The problem now is that this script creates an .mlpackage file which only accepts images with a fixed size (640x64... | <python><machine-learning><yolo><coreml><mlmodel> | 2024-12-24 12:23:06 | 1 | 13,448 | J. Doe |
79,305,343 | 12,466,687 | How to move x-axis on top of the plot in plotnine? | <p>I am using <code>plotnine</code> with a <code>date</code> x-axis plot and want to put x-axis <strong>date values on top</strong> of the chart but couldn't find a way to do it.</p>
<p>I have seen in ggplot it can be done using <code>scale_x_discrete(position = "top") </code> but with <code>scale_x_datetime(... | <python><ggplot2><plotnine> | 2024-12-24 10:31:26 | 1 | 2,357 | ViSa |
79,305,311 | 15,018,688 | Keras Attention layer not returning attention scores | <p>I'm using keras=3.7.0 and trying to implement a custom Temporal Convolutional Attention Network (TCAN) block. While the Attention layer works in a standalone test case, I encounter an issue when integrating it into my custom model. Specifically, the error occurs when I attempt to unpack the output of the Attention l... | <python><tensorflow><keras><deep-learning> | 2024-12-24 10:08:47 | 0 | 556 | Furkan Öztürk |
79,305,200 | 561,243 | Static typing of Python regular expression: 'incompatible type "str"; expected "AnyStr | Pattern[AnyStr]" ' | <p>Just to be clear, this question has nothing to do with the regular expression itself and my code is perfectly running even though it is not passing mypy strict verification.</p>
<p>Let's start from the basic, I have a class defined as follows:</p>
<pre class="lang-py prettyprint-override"><code>from __future__ impor... | <python><python-typing><mypy><python-re> | 2024-12-24 09:10:20 | 1 | 367 | toto |
79,304,881 | 10,024,860 | Optimize performance of SubstrateInterface.decode_scale | <p>I am using Python's substrate interface to look at extrinsic for a particular block of a Substrate-based blockchain. However, the decode_scale method is very slow: it takes about 1 second for 500 extrinsics (about 1 million bytes total). A simple baseline with binascii is 100-1000x faster, although it doesn't do the... | <python><substrate> | 2024-12-24 06:23:39 | 0 | 491 | Joe C. |
79,304,770 | 8,772,888 | Python Virtual Environment Activation Not Working | <p>I am trying to activate a Python virtual environment on Windows and it seems like it took OK:</p>
<p><a href="https://i.sstatic.net/JpBMxc02.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JpBMxc02.png" alt="enter image description here" /></a></p>
<p>I installed a module I needed for my venv, but whe... | <python><python-venv> | 2024-12-24 05:10:17 | 1 | 3,821 | ravioli |
79,304,741 | 200,783 | How should I convert this recursive function into iteration? | <p>I have a recursive function in the following form:</p>
<pre><code>def f():
if cond1:
...
f()
elif cond2:
...
</code></pre>
<p>I've "mechanically" converted it to an iterative function like this:</p>
<pre><code>def f():
while True:
if cond1:
...
... | <python><recursion><iteration> | 2024-12-24 04:43:45 | 1 | 14,493 | user200783 |
79,304,665 | 624,533 | In Python Flask new project, cannot Activate the environment as per official doc | <p>I'm new to Python Flask. Here is my terminal commands as per official flask doc.</p>
<p>Official flask link: <a href="https://flask.palletsprojects.com/en/stable/installation/" rel="nofollow noreferrer">https://flask.palletsprojects.com/en/stable/installation/</a></p>
<pre class="lang-bash prettyprint-override"><cod... | <python><flask> | 2024-12-24 03:21:27 | 1 | 960 | Sudhakar Krishnan |
79,304,408 | 28,063,240 | Get top (crown) of the head in Python? | <p>How can I get the pixel coordinates of the top of the head for a headshot image in Python?</p>
<p>I've taken a look at <code>dlib</code> with <a href="https://github.com/codeniko/shape_predictor_81_face_landmarks" rel="nofollow noreferrer">https://github.com/codeniko/shape_predictor_81_face_landmarks</a> as well as ... | <python><face-recognition> | 2024-12-23 22:48:44 | 0 | 404 | Nils |
79,304,389 | 2,751,179 | select dataframe column and replace values by indices if True | <p>Hard to find the right title...here is what I want:</p>
<p>I have a dataframe and a column col1 with values : val1, val2, val3</p>
<p>I want to select the rows with val2 or val3 values for this specific column and replace them with val4 value but not for all of them, just for a "slice" between idx x and y ... | <python><pandas><dataframe> | 2024-12-23 22:31:15 | 4 | 455 | Fabrice |
79,304,247 | 9,759,769 | Polars transform meta data of expressions | <p>Is it possible in python polars to transform the root_names of expression meta data?
E.g. if I have an expression like</p>
<pre class="lang-py prettyprint-override"><code>expr = pl.col("A").dot(pl.col("B")).alias("AdotB")
</code></pre>
<p>to add suffixes to the root_names, e.g. transfor... | <python><python-polars> | 2024-12-23 21:11:17 | 1 | 690 | Max |
79,304,172 | 2,876,983 | Opening all files from S3 folder into dataframe | <p>I am currently opening a csv file as is:</p>
<pre><code>request_csv = s3_client.get_object(Bucket='bucketname', Key='dw/file.csv')
</code></pre>
<p>I'd like to change this to open all files inside <code>dw/folder</code> (they are all CSV) into a single Dataframe. How can I approach this? Any pointers would be apprec... | <python><amazon-s3><boto3> | 2024-12-23 20:39:02 | 1 | 321 | user2876983 |
79,304,160 | 4,352,047 | Use aggregate result again on another | <p>I am trying to use a <code>GROUP BY</code> query with DuckDB. I am having trouble with some nested aggregates and am unsure of how to approach it (in SQL land). For each aggregate group, I want to:</p>
<ol>
<li>Compute the mean of aggregate</li>
<li>Then, in each aggregate, for a given price, subtract that aggregate... | <python><sql><duckdb> | 2024-12-23 20:31:10 | 1 | 379 | Deftness |
79,304,114 | 10,292,638 | Click on button on async website - Unable to locate element: {"method":"css selector","selector":".Icon__oBwY4"} | <p>I am trying to click over this button (which shows when the website is being accessed for the first time) from this website (<a href="https://www.popmart.com/sg/user/login" rel="nofollow noreferrer">https://www.popmart.com/sg/user/login</a>) through the use of <code>selenium</code> :</p>
<p><a href="https://i.sstati... | <python><selenium-webdriver><bots> | 2024-12-23 20:08:14 | 2 | 1,055 | AlSub |
79,304,079 | 15,852,600 | Better way to create column containing sequential values | <p>I have the following dataframe:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({'sku' : ['A','A','A','A', 'B', 'B', 'C','C','C'],
'price': [10,10,10,10, 8,8,9,9,9]})
</code></pre>
<p><strong>out:</strong></p>
<pre class="lang-py prettyprint-override"><code> sku price
0 A... | <python><pandas> | 2024-12-23 19:47:45 | 0 | 921 | Khaled DELLAL |
79,304,055 | 10,140,821 | extract variables from list and run a loop | <p>I have a scenario like below in <code>Python</code>.</p>
<p>contents of <code>run_main.py</code> are below</p>
<pre><code>system_code = 'Ind'
if system_code == 'Ind':
ft_tb = ['B_FT', 'S_FT', 'D_FT']
bt_tb = ['B_BT', 'S_BT', 'D_BT']
else:
ft_tb = ['T_FT', 'T_FT', 'T_FT']
bt_tb = ['T_BT', 'T_BT', 'T_... | <python> | 2024-12-23 19:36:39 | 1 | 763 | nmr |
79,304,021 | 3,008,410 | Pyspark getting date from struct field with dollar sign in it | <p>Using Pyspark and this is a pyspark.sql.dataframe.DataFrame
I am trying to get to this value "entrytimestamp.$date" (can be null) from a Mongo JSON file that has this schema. I can get everything else but this field. Any suggestions?</p>
<pre><code> root
|-- ENTRY: struct (nullable = true)
| |-- log: ... | <python><mongodb><apache-spark><pyspark> | 2024-12-23 19:22:37 | 1 | 856 | user3008410 |
79,303,980 | 338,479 | Can you override the default formatter for f-strings? | <p>Reading through <a href="https://peps.python.org/pep-3101/#user-defined-formatting" rel="nofollow noreferrer">PEP 3101</a>, it discusses how to subclass string.Formatter to define your own formats, but then you use it via <code>myformatter.format(string)</code>. Is there a way to just make it work with f-strings?</p... | <python><formatting> | 2024-12-23 18:59:46 | 1 | 10,195 | Edward Falk |
79,303,873 | 3,696,153 | Programmatically add an alias to an enum | <p>Consider the following:</p>
<pre class="lang-py prettyprint-override"><code> class DayOfWeek( Enum ):
SUN = 0
MON = 1
TUE = 2
WED = 3
THU = 4
FRI = 5
SAT = 6
</code></pre>
<p>I now need to add an alias but the <code>_add_alias_</code> member function only accepts 1 ... | <python><enums> | 2024-12-23 18:01:42 | 1 | 798 | user3696153 |
79,303,820 | 6,046,760 | Camelot won't import even though its in sys.path | <p>Having a nightmare installing camelot-py for jupyter notebook</p>
<p>Tried installing with pip inside the notebook, then through powershell, then through Anaconda miniconda terminal.
The package finally installs with powershell, pip list shows it while in the powershell.</p>
<p>Go to the notebook, pip list doesnt sh... | <python><python-camelot> | 2024-12-23 17:38:23 | 2 | 524 | user6046760 |
79,303,657 | 12,671,057 | Why is bytes(lst) slower than bytearray(lst)? | <p>With <code>lst = [0] * 10**6</code> I get times like these:</p>
<pre><code> 5.4 ± 0.4 ms bytearray(lst)
5.6 ± 0.4 ms bytes(bytearray(lst))
13.1 ± 0.7 ms bytes(lst)
Python:
3.13.0 (main, Nov 9 2024, 10:04:25) [GCC 14.2.1 20240910]
namespace(name='cpython', cache_tag='cpython-313', version=sys.version_info(ma... | <python><performance><python-internals> | 2024-12-23 16:20:31 | 1 | 27,959 | Kelly Bundy |
79,303,456 | 1,471,980 | insert into MS Access table using .to_sql() | <p>I am currently using ms sql server to insert and/or select data using podbc library. I need to be able to do the samething using MS Access db. Any ideas how I could insert into ms access table using pydobc.</p>
<p>I am currently doing this in ms sql server:</p>
<pre><code>import pyodbc
try
engine = create_eng... | <python><pandas><ms-access><pyodbc> | 2024-12-23 15:03:34 | 1 | 10,714 | user1471980 |
79,303,440 | 5,627,817 | How do I implement 2 different builds for my python project? One for uploading to pypi and another for local usage and mypycify optimizations | <p>I have built a basic python project. The project at its core is using a <code>toml</code> file to store all the configurations and build rules (see below):</p>
<pre><code>[project]
authors = [{ name = "name", email = "email@email.com" }]
name = "name"
version = "0.0.0"
descrip... | <python><setuptools><mypy><python-wheel> | 2024-12-23 14:57:13 | 0 | 399 | Death_by_Ch0colate |
79,303,258 | 7,646,621 | Where are Qt tools after installing PySide6 on macOS? | <p>After running <code>pip3 install pyside6</code> on Windows, we can see many Qt tools under PySide6.</p>
<p><a href="https://i.sstatic.net/kIPPUqb8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kIPPUqb8.png" alt="enter image description here" /></a>
Where are these tools after installing PySide6 on m... | <python><qt><pyside> | 2024-12-23 13:39:54 | 1 | 3,639 | qg_java_17137 |
79,303,139 | 7,403,431 | maptloblib, adjust_text and errorbar | <p>I use <code>adjust_text</code> to properly place text on the plot.</p>
<p>I don't want to have text placed on the connection lines between the points or the error bars.</p>
<p>My current best version for example code is:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib as mpl
import matplotlib.p... | <python><matplotlib> | 2024-12-23 12:50:28 | 0 | 1,962 | Stefan |
79,303,054 | 2,006,921 | Python/pybind11 environment | <p>I would like to start a new project using Python and pybind11 and OpenGL on windows. Can you give me some guidance as to how to set up an environment for that? On Linux that would be no problem, but on Windows I don't know what would be a good, convenient option. A long time ago I cobbled something together using MS... | <python><windows><pybind11> | 2024-12-23 12:21:23 | 0 | 1,105 | zeus300 |
79,302,883 | 1,183,071 | How to define local dependencies for deployment using Poetry? | <p>As I've been building my app, I separated various utilities into their own packages that I may publish later if they turn out to be useful. My project structure ended up as:</p>
<pre><code>root
[app]
..main.py
[lib]
..[lib_a]
..[lib_b]
..
pyproject.toml
</code></pre>
<p>I'm guessing the relative path is the problem,... | <python><deployment><python-poetry><replit><pyproject.toml> | 2024-12-23 11:03:04 | 1 | 8,092 | GoldenJoe |
79,302,863 | 1,517,782 | How to use python to create ORC file compressed with ZLIB compression level 9? | <p>I want to create an ORC file compressed with ZLIB compression level 9.
Thing is, when using pyarrow.orc, I can only choose between "Speed" and "Compression" mode,
and can't control the compression level</p>
<p>E.g.</p>
<pre><code>orc.write_table(table, '{0}_zlib.orc'.format(file_without_ext),
... | <python><compression><zlib><orc> | 2024-12-23 10:57:00 | 1 | 1,862 | Y.S |
79,302,825 | 122,792 | How do you insert a map-reduce into a Polars method chain? | <p>I’m doing a bunch of filters and other transform applications including a <code>group_by</code> on a polars data frame, the objective being to count the number of html tags in a single column per date per publisher. Here is the code:</p>
<pre><code>120 def contains_html3(mindate, parquet_file = default_file, fieldna... | <python><dataframe><python-polars> | 2024-12-23 10:40:59 | 2 | 25,088 | Thomas Browne |
79,302,793 | 17,795,398 | How to reduce unnecessary white spaces in matplotlib subplot2grid? | <p>I'm creating some plots with histograms and a color bar, but I'm struggling with the huge white gaps between subplots and I don't know how to reduce them. This an example of a more complex code:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
ihist = np.array([
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0... | <python><matplotlib> | 2024-12-23 10:22:25 | 2 | 472 | Abel Gutiérrez |
79,302,693 | 7,218,871 | Do Not Print Plot | <p>I have a requirement to create multiple plots, one such plot's code is here.</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame({'Label': ['a', 'b', 'c', 'd', 'e', 'f'],
'Val': [np.random.rand() for _ in range(6)],
})
sns.set_style('whitegrid')... | <python><seaborn> | 2024-12-23 09:35:42 | 2 | 620 | Abhishek Jain |
79,302,589 | 6,234,139 | Passing on a variable created in a class to a function in that class in which the variable is defined as a global variable | <p>Initially, before using a class, I could easily pass on a variable <code>a</code> to the function <code>fit_func_simple_a_fixed()</code> as follows (<code>a</code> is defined as a global variable in the function):</p>
<pre><code>import pandas as pd
import math
from scipy.optimize import curve_fit
import numpy as np
... | <python> | 2024-12-23 08:42:38 | 1 | 701 | koteletje |
79,302,542 | 2,695,990 | How to process and update (change attribute, add node, etc) XML file with a DOCTYPE in Python, without removing nor altering the "DOCTYPE" | <p>I have couple of xml files which I would like to process and update their nodes/attributes. I have couple of examples of scripts which can do that, but all of them change a bit the xml structure, remove or alter the DOCTYPE.
The simplified example of xml is:</p>
<pre><code><?xml version="1.0" encoding=&... | <python><xml><xml-parsing><dtd><doctype> | 2024-12-23 08:17:34 | 2 | 3,174 | fascynacja |
79,302,514 | 17,174,267 | inspect.signature: invalid method signature for lambda in class member | <p>The following code throws a ValueError ('invalid method signature')</p>
<pre class="lang-py prettyprint-override"><code>import inspect
class Foo:
boo = lambda: 'baa'
print(inspect.signature(Foo().boo))
</code></pre>
<p>Why? Changing it to <code>boo = lambda x: 'baa'</code> does not throw an error. It seems ... | <python><python-inspect> | 2024-12-23 08:07:27 | 4 | 431 | pqzpkaot |
79,302,301 | 14,149,761 | Regex: get all matches in between two set substrings | <p>If I have a sentence similar to the following:</p>
<p><code>aabcadeaaabbacababe</code></p>
<p>and I want to get all of the text where it starts with <code>c</code> and ends with <code>e</code>, so that it matches like:</p>
<p><code>['ad', 'abab']</code></p>
<p>is it possible to achieve this? I have tried using looka... | <python><regex> | 2024-12-23 06:18:12 | 1 | 303 | skoleosho97 |
79,302,105 | 1,512,250 | Query length in Custom Search API | <p>I'm sending requests to Custom Search API like this:</p>
<pre class="lang-py prettyprint-override"><code>GOOGLE_SEARCH_URL=f'https://www.googleapis.com/customsearch/v1?key={GOOGLE_SEARCH_API_KEY}&cx={SEARCH_ENGINE_ID}&q={encoded_text}'
</code></pre>
<p>The text in encoded_text could be very large sometimes, ... | <python><google-custom-search> | 2024-12-23 03:58:35 | 1 | 3,149 | Rikki Tikki Tavi |
79,302,087 | 8,947,822 | GCP Cloudbuild Git Submodule Python Installation Failing in Docker Build | <p>I'm trying to use GCP Cloudbuild to deploy a python project managed with UV. The project has a private git submodule that I'm cloning with an ssh setup in cloudbuild yaml (taken from <a href="https://cloud.google.com/build/docs/access-github-from-build#configure_the_build" rel="nofollow noreferrer">this example</a>)... | <python><docker><git-submodules><google-cloud-build> | 2024-12-23 03:44:10 | 1 | 423 | Connor |
79,302,073 | 825,227 | Dealing with `StopIteration` return from a next() call in Python | <p>I'm using the below to skip a group of records when a certain condition is met:</p>
<pre><code>if (condition met):
...
[next(it) for x in range(19)]
</code></pre>
<p>Where <code>it</code> is an <code>itertuples</code> object created to speed up looping through a large dataframe (yes, the loop is necessary).<... | <python><python-itertools> | 2024-12-23 03:33:22 | 2 | 1,702 | Chris |
79,302,069 | 328,347 | How to save and resume state for a chess exploration script | <p>I have a small python script that uses the chess library. It simply iterates all possible games from the starting set of legal moves. It ends a branch when the maximum plies is hit, or when a check mate is found. Additionally, it will log the game if it was a checkmate.</p>
<pre><code>import chess
import chess.pgn
i... | <python><recursion><chess> | 2024-12-23 03:30:15 | 0 | 3,532 | Roge |
79,301,958 | 26,579,940 | Changing the size of TransformedBbox in matplotlib | <p>When zooming, it is done by changing xlim and ylim.
But this is very slow.</p>
<p>Even if xlim and ylim are changed, restore_region is based on the size of the axes, so it does not affect previously created backgrounds.</p>
<p>It is possible to change the xy coordinates exposed by restore_region or the created backg... | <python><matplotlib> | 2024-12-23 01:22:05 | 0 | 404 | white.seolpyo.com |
79,301,659 | 3,952,885 | AssertionError: 'detection' in self.models Using InsightFace on Linux Docker Container | <p>I’m developing a Python application that uses Flask, running in a Docker container on a Linux server with NGINX. The application works perfectly on my local machine, but when I deploy it on the server, I encounter the following error:</p>
<blockquote>
<p>ERROR:app:Exception: Traceback (most recent call last): Fil... | <python><docker><insightface> | 2024-12-22 20:12:25 | 1 | 2,762 | Amir Dora. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.