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,188,730 | 1,398,979 | Does polars load the entire parquet into the memory if we want to retrive certain column? | <p>I am new to the data science. I am working on the Polars to read the parquet files. Total size of all these parquet files is 240 GB. I have an EC2 machine with 64 GB and 8 vCP.</p>
<p>I was under the assumption that as Parquet is a columnar file format so whenever I retrieve columns from the Parquet files then it do... | <python><dataframe><data-science><parquet><python-polars> | 2024-11-14 12:25:42 | 1 | 917 | Bhaskar Dabhi |
79,188,715 | 9,530,017 | Adjusting axe position after applying constrained_layout | <p>Using constrained_layout, I can get this plot:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
import numpy as np
N = 200
var_xx = 1**2 # var x = std x squared
var_yy = 1**2
cov_xy = 0.5
cov = np.array([[var_xx, cov_xy], [cov_xy, var_yy]])
rng = np.random.default_rng()
pairs = ... | <python><matplotlib> | 2024-11-14 12:19:25 | 2 | 1,546 | Liris |
79,188,710 | 19,003,861 | Django - Custom Error Templates not rendering | <p>I have some custom templates in my django app. But these are not being rendered and instead displays the basic template:</p>
<pre><code>500 Internal Server Error
Exception inside application.
Daphne
</code></pre>
<p>Edit: If I move my dev.py (used on local to DEBUG = False), then the template is rendered.</p>
<p>Th... | <python><django><heroku> | 2024-11-14 12:18:13 | 1 | 415 | PhilM |
79,188,702 | 1,398,979 | How does polars load parquet files into dataframe? | <p>I am trying to load a parquet files where total size of the data (Total size of the parquet files) is 240 GB. I calculated the size of the columns using duckdb using the following <a href="https://stackoverflow.com/a/74267046/1398979">query</a>:</p>
<pre><code>import duckdb
con = duckdb.connect(database=':memory:')
... | <python><dataframe><parquet><python-polars><duckdb> | 2024-11-14 12:15:40 | 0 | 917 | Bhaskar Dabhi |
79,188,659 | 1,021,060 | Host server that runs python script with preloaded data | <p>I have a python script (let's suppose it's a single file) that has 3 sections:<br />
(1) load external libraries<br />
(2) load a large file's contents<br />
(3) algorithm<br />
While section (3) takes 100 milliseconds, sections (1) and (2) take 10 seconds.</p>
<p>I have a C# program that executes the Python script ... | <python><c#><.net><server><python.net> | 2024-11-14 11:59:21 | 1 | 360 | Jack |
79,188,601 | 3,732,793 | Most simple config not working for locust | <p>This command works fine</p>
<pre><code>locust --headless --users 10 --spawn-rate 1 -H http://localhost:3000
</code></pre>
<p>locustfile.py looks like that</p>
<pre><code>from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/health"... | <python><locust> | 2024-11-14 11:43:49 | 1 | 1,990 | user3732793 |
79,188,565 | 250,962 | How to update requirements.txt file using uv | <p>I'm using <a href="https://github.com/astral-sh/uv" rel="noreferrer">uv</a> to manage my Python environment locally, but my production site still uses pip. So when I update packages locally (from <code>pyproject.toml</code>, updating the <code>uv.lock</code> file) I also need to generate a new <code>requirements.txt... | <python><uv> | 2024-11-14 11:32:47 | 4 | 15,166 | Phil Gyford |
79,188,493 | 2,950,747 | Why does the TSP in NetworkX not return the shortest path? | <p>I'm trying to use NetworkX's <code>traveling_salesman_problem</code> to find the shortest path between nodes, but it seems to return a longer path than is necessary. Here's a minimal example:</p>
<pre><code>import shapely
import networkx as nx
import matplotlib.pyplot as plt
# Make a 10x10 grid
vert = shapely.geom... | <python><networkx> | 2024-11-14 11:09:40 | 1 | 725 | user2950747 |
79,188,419 | 13,762,083 | Numerical instability in forward-backward algorithm for Hidden Markov Models | <p>I am implementing the forward algorithm for Hidden Markov Models (see below for the algorithm). To prevent over/underflow, I work with log-probabilities instead, and use the log-sum-exp trick to compute each forward coefficient.</p>
<p>I plotted the computed forward coefficient and compared it with the states I used... | <python><statistics><numerical-methods><hidden-markov-models> | 2024-11-14 10:47:35 | 1 | 409 | ranky123 |
79,188,310 | 4,050,510 | Enforcing matplotlib tick labels not wider than the axes | <p>I need to make a very compact plot with shared y-axis using matplotlib. To make it compact and neat, I will not have any wspace. It looks good with my data.</p>
<p>But the x-tick labels overlap, making them unreadable.</p>
<p>Is there a way to make the x tick locator not place ticks at the 'edge' of the axes, make t... | <python><matplotlib> | 2024-11-14 10:24:54 | 1 | 4,934 | LudvigH |
79,188,069 | 1,082,349 | Pandas checking if value in column actually checks if value in index? | <pre><code>"490100" in df_exp['ucc'].astype(str).str.strip()
Out[337]: False
(df_exp['ucc'].astype(str) == "490100").any()
Out[339]: True
"490100" in df_exp['ucc'].astype(str).str.strip().values
Out[340]: True
</code></pre>
<p>Apparently the check <code>foo in df[column]</code> no longer c... | <python><pandas> | 2024-11-14 09:30:00 | 1 | 16,698 | FooBar |
79,188,039 | 16,721,393 | From memory buffer to disk as fast as possible | <p>I would like to present a scenario and discuss suitable design patterns to address it.</p>
<p>Consider a simple situation: a camera records to a memory buffer for ten seconds before stopping. Once recording ends, a binary file descriptor opens, and data is transferred to disk.</p>
<p>A major limitation of this appro... | <python><design-patterns><raspberry-pi><camera><bufferedwriter> | 2024-11-14 09:19:45 | 1 | 371 | rober_dinero |
79,188,007 | 6,930,340 | Polars equivalent of numpy.tile | <pre><code>df = pl. DataFrame({"col1": [1, 2, 3], "col2": [4, 5, 6]})
print(df)
shape: (3, 2)
ββββββββ¬βββββββ
β col1 β col2 β
β --- β --- β
β i64 β i64 β
ββββββββͺβββββββ‘
β 1 β 4 β
β 2 β 5 β
β 3 β 6 β
ββββββββ΄βββββββ
</code></pre>
<p>I am looking for the <code>polars</code> eq... | <python><python-polars> | 2024-11-14 09:11:39 | 1 | 5,167 | Andi |
79,187,982 | 1,082,019 | "ValueError: zero-size array to reduction operation maximum which has no identity" error when calling a Python function from R | <p>I'm trying to use the <a href="https://github.com/FelSiq/DBCV" rel="nofollow noreferrer">Fast Density-Based Clustering Validation (DBCV)</a> Python package from R through the <a href="https://cran.r-project.org/web/packages/reticulate/vignettes/calling_python.html" rel="nofollow noreferrer">reticulate</a> R library,... | <python><r><reticulate> | 2024-11-14 09:01:11 | 1 | 3,480 | DavideChicco.it |
79,187,730 | 1,802,693 | How to parallelize long-running IO operations in a multi-threaded Python application with asyncio? | <p>I am building a Python application that uses an event loop (via the asyncio library) to listen for tick data from a cryptocurrency exchange via a WebSocket. The tick data comes for various symbols, and Iβm putting these ticks into a queue.Queue (which is thread-safe but not asyncio-compatible).</p>
<p>A separate thr... | <python><python-3.x><multithreading><architecture><python-asyncio> | 2024-11-14 07:21:55 | 0 | 1,729 | elaspog |
79,187,647 | 3,296,786 | Pytest - reordeing the test files | <p>In the existing projects PyTests runs the files in alphabetical order one after other.
The file name are <code>archive_test.py, config_test.py, controller_test.py</code> ...etc.
I want the controller_test.py to be ran before config_test.py when I execute pytest -s. How to achieve this? Is there any other logical ap... | <python><testing><pytest> | 2024-11-14 06:49:22 | 0 | 1,156 | aΨVaN |
79,187,315 | 8,143,104 | Unzip file in Azure Blob storage from Databricks | <p>I am trying to unzip a file that is in an Azure ADLS Gen2 container through Azure Databricks Pyspark. When I use ZipFile, I get a <code>BadZipFile</code> error or a <code>FileNotFoundError</code>.</p>
<p>I can read CSVs in the same folder, but not the zip files.</p>
<p>The zip filepath is the same filepath I get fro... | <python><azure-blob-storage><databricks><azure-data-lake-gen2> | 2024-11-14 03:28:38 | 2 | 396 | Mariah Akinbi |
79,187,232 | 4,038,747 | How to get all Pagerduty incident notes via Pdpyras library | <p>I know how to make a GET request to the <a href="https://developer.pagerduty.com/api-reference/a1ac30885eb7a-list-notes-for-an-incident" rel="nofollow noreferrer">incident notes API end</a> but how do I leverage the <code>pdpyras</code> library to do so? I can get all <code>incidents</code></p>
<pre><code>from pdpyr... | <python><pagerduty> | 2024-11-14 02:34:11 | 1 | 1,175 | lollerskates |
79,187,131 | 270,043 | How to optimize PySpark code to calculate Jaccard Similarity for a huge dataset | <p>I have a huge PySpark dataframe that contains 250 million rows, with columns <code>ItemA</code> and <code>ItemB</code>. I'm trying to calculate the Jaccard Similarity <code>M_ij</code> that can run efficiently and takes a short amount of time to complete. My code is as follows.</p>
<pre><code># Group by ItemA and co... | <python><pyspark><optimization><jaccard-similarity> | 2024-11-14 01:27:48 | 0 | 15,187 | Rayne |
79,186,983 | 6,036,549 | How to render LaTeX in Shiny for Python? | <p>I'm trying to find if there is a way to render LaTeX formulas in <a href="https://shiny.posit.co/py/" rel="nofollow noreferrer">Shiny for Python</a> or any low-hanging fruit workaround for that.</p>
<p>Documentation doesn't have any LaTeX mentions, so looks like there's no dedicated functionality to support it.
Also... | <python><latex><py-shiny> | 2024-11-13 23:39:04 | 1 | 537 | VladKha |
79,186,624 | 3,621,143 | Multiple "applications" in CherryPy producing 404s? | <p>I am posting this question, because all the other posts regarding the issue I am facing are all 11 years old. I am sure quite a bit has changed between now and them, so I do not trust those articles.</p>
<p>I was able to successfully deploy a CherryPy configuration using the cherrypy.quickstart method, and all wor... | <python><cherrypy> | 2024-11-13 20:47:22 | 0 | 1,175 | jewettg |
79,186,512 | 4,508,605 | pyspark trimming all fields bydefault while writing into csv in python | <p>I am trying to write the dataset into csv file using <code>spark 3.3 , Scala 2</code> <code>python</code> code and bydefault its trimming all the String fields. For example, for the below column values :</p>
<pre><code>" Text123"," jacob "
</code></pre>
<p>the output in csv is:</p>
<pre><code>&qu... | <python><apache-spark><pyspark><aws-glue><apache-spark-3.0> | 2024-11-13 20:13:12 | 1 | 4,021 | Marcus |
79,186,378 | 1,700,890 | Detect row change by group and bring result back to original data frame | <p>Here is my example. I am grouping, ordering and detecting change from one row to another.</p>
<pre><code>import pandas as pd
import datetime
my_df = pd.DataFrame({'col1': ['a', 'a', 'a', 'a', 'b', 'b', 'b'],
'col2': [2, 2, 3, 2, 5, 5, 5],
'col3': [datetime.date(2023, 2, 1... | <python><pandas><group-by><apply> | 2024-11-13 19:25:29 | 2 | 7,802 | user1700890 |
79,186,344 | 3,280,613 | Cancel current pipeline job "from within" in Azure ML sdk v2 | <p>I am porting a sdk v1 machine learning pipeline to SDK v2. We have a step which, under certain conditions, cancels the whole pipeline job (ie, the other steps won't run). Its code is like this:</p>
<pre><code>from azureml.core import Run
from azureml.pipeline.core import PipelineRun
run = Run.get_context()
ws = run... | <python><azure><azure-machine-learning-service><azureml-python-sdk><azure-ml-pipelines> | 2024-11-13 19:15:14 | 1 | 659 | Celso |
79,186,201 | 1,014,841 | Converting pl.Duration to human string | <p>When printing a polars data frame, <code>pl.Duration</code> are printed in a "human format" by default. What function is used to do this conversion? Is it possible to use it? Trying <code>"{}".format()</code> returns something readable but not as good.</p>
<pre><code>import polars as pl
data = {... | <python><python-polars> | 2024-11-13 18:19:02 | 2 | 3,125 | Yves Dorfsman |
79,186,139 | 4,755,229 | In Jupyter/VSCode running conda envs, how do I make it run activation scripts in activate.d? | <p>Conda or Mamba provides a way to set shell environment variables upon activating the environment -- <code>.sh</code> scripts stored in <code>/path/to/env/etc/conda/activate.d/</code> or <code>.../deactivate.d/</code> run upon activating and deactivating the environment. This is utilized by many packages to link thei... | <python><linux><visual-studio-code><conda><jupyter> | 2024-11-13 18:04:00 | 0 | 498 | Hojin Cho |
79,186,053 | 4,963,334 | peewe upgrade to 3.1.5.x | <p>We are upgarding peewe to 3.15.x</p>
<p>when we setup peewe connection and every api request we disabled autocommit and add some manual changes in proxy intilaization.</p>
<pre><code> def begin(self):
self.execute_sql('set autocommit=0')
self.execute_sql('begin')
def configure_proxy(cls, proxy):
... | <python><peewee><flask-peewee> | 2024-11-13 17:37:35 | 0 | 1,525 | immrsteel |
79,186,037 | 54,873 | What is the pandas version of np.select? | <p>I feel very silly asking this.</p>
<p>I want to set a value in a DataFrame depending on some other columns.</p>
<p>I.e:</p>
<pre><code>(Pdb) df = pd.DataFrame([['cow'], ['dog'], ['trout'], ['salmon']], columns=["animal"])
(Pdb) df
animal
0 cow
1 dog
2 trout
3 salmon
(Pdb) df["animal"... | <python><pandas> | 2024-11-13 17:33:25 | 2 | 10,076 | YGA |
79,185,962 | 1,700,890 | Assigning column from different data frame - role of index | <pre><code>import pandas as pd
df_1 = pd.DataFrame({'col1': ['a', 'a', 'a']})
df_2 = pd.DataFrame({'col1': ['b', 'b', 'b']})
df_2.index = [4,5,6]
df_1['col2'] = df_2.col1
</code></pre>
<p>I expect a simple copy in the above example, but 'col2' in df_1 is all NAs. I find it strange. What is the rational for this choic... | <python><pandas><indexing><copy> | 2024-11-13 17:08:05 | 1 | 7,802 | user1700890 |
79,185,792 | 11,010,254 | Mypy doesn't detect a type guard, why? | <p>I am trying to teach myself how to use type guards in my new Python project in combination with pydantic-settings, and mypy doesn't seem to pick up on them. What am I doing wrong here?</p>
<p>Code:</p>
<pre><code>import logging
from logging.handlers import SMTPHandler
from functools import lru_cache
from typing impo... | <python><python-typing><mypy><pydantic> | 2024-11-13 16:19:39 | 1 | 428 | Vladimir Vilimaitis |
79,185,787 | 2,405,663 | Parse string as XML and read all elements | <p>I have a string variable that contains XML:</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<osm attribution="http://www.openstreetmap.org/copyright" copyright="OpenStreetMap and contributors" gener... | <python> | 2024-11-13 16:18:21 | 1 | 2,177 | bircastri |
79,185,754 | 11,840,002 | Snowflake connector with pyspark JAR packages error | <p>I have read multiple thread on this but not found definitive answer.</p>
<p>I have running in container locally (<code>mac os + podman</code>)</p>
<pre><code>scala: 'version 2.12.17'
pyspark: 3.4.0
spark-3.4.0
python 3.11.4
</code></pre>
<p>I am running a container which is defined in compose (source: <a href="h... | <python><apache-spark><pyspark><conda> | 2024-11-13 16:06:44 | 0 | 1,658 | eemilk |
79,185,718 | 17,059,458 | How to prevent a user freezing python by interacting with the console window? | <p>I am making a retro-style GUI in (semi)pure python using ascii characters. The script works by printing and clearing to the console while using the users mouse and keyboard data to create a fully interactive GUI.</p>
<p>However, upon creating the click detection system, I have noticed that python freezes running whe... | <python><console> | 2024-11-13 15:58:07 | 1 | 374 | Martin |
79,185,543 | 9,251,158 | Curly brace expansion fails on bash, in Linux, when called from Python | <p>Consider this curly brace expansion in bash:</p>
<pre class="lang-bash prettyprint-override"><code>for i in {1..10}; do
echo $i;
done;
</code></pre>
<p>I call this script from the shell (on macOS or Linux) and the curly brace does expand:</p>
<pre class="lang-none prettyprint-override"><code>$ ./test.sh
1
2
... | <python><bash> | 2024-11-13 15:19:14 | 2 | 4,642 | ginjaemocoes |
79,185,339 | 2,451,238 | extended help based on argument groups using Python's argparser module | <p>Consider the following toy example:</p>
<pre class="lang-bash prettyprint-override"><code>cat extended_help.py
</code></pre>
<pre class="lang-py prettyprint-override"><code>import argparse
ap = argparse.ArgumentParser()
ap.add_argument("-H", "--help-all", action = "version",
... | <python><command-line><command-line-interface><command-line-arguments><argparse> | 2024-11-13 14:24:30 | 2 | 1,894 | mschilli |
79,185,240 | 22,437,609 | Anaconda: Unable to install Kivy 2.3 | <p>I want to install Kivy to my Anaconda tutorialEnv.</p>
<p>According to <a href="https://kivy.org/doc/stable/gettingstarted/installation.html#install-conda" rel="nofollow noreferrer">https://kivy.org/doc/stable/gettingstarted/installation.html#install-conda</a>
I have used <code>conda install kivy -c conda-forge</cod... | <python><python-3.x><kivy><conda> | 2024-11-13 14:01:17 | 1 | 313 | MECRA YAVCIN |
79,185,191 | 1,323,014 | How do we use custom Python module in Langflow? | <p>Ok, if we try to use the hosted version from Datastax, I don't see any way to install python modules into it and all custom components cannot be made due to the module not being installed.</p>
<p>Hosted by Datastax: <a href="https://astra.datastax.com/langflow/" rel="nofollow noreferrer">https://astra.datastax.com/l... | <python><cassandra><datastax><datastax-astra><langflow> | 2024-11-13 13:45:36 | 1 | 7,550 | Marcus Ataide |
79,185,168 | 1,219,317 | RuntimeError: r.nvmlDeviceGetNvLinkRemoteDeviceType_ INTERNAL ASSERT FAILED at | <p>I am writing a Python code that trains a classifier to classify samples (10 sentences per sample). I am using <code>Sentence_Transformer</code> with <a href="https://github.com/socsys/GASCOM" rel="nofollow noreferrer">additional layers</a> and running the model training on a linux server. The code is below. The part... | <python><pytorch><gpu><nvidia><sentence-transformers> | 2024-11-13 13:41:04 | 2 | 2,281 | Travelling Salesman |
79,185,128 | 10,277,250 | Why does `ConversationalRetrievalChain/RetrievalQA` include prompt in answer that cause recursive text growth? | <p>I am building RAG Chatbot on my own data using <a href="https://python.langchain.com/docs/introduction" rel="nofollow noreferrer">langchain</a>. There are a lot of guidelines how to do it, for example <a href="https://medium.com/@murtuza753/using-llama-2-0-faiss-and-langchain-for-question-answering-on-your-own-data-... | <python><langchain><large-language-model><llama><rag> | 2024-11-13 13:33:04 | 0 | 363 | Abionics |
79,185,022 | 6,197,439 | Changing background color of inidividiual row (verticalHeader) labels in PyQt5 QTableView? | <p>In my application, I would like to conditionally change the text and background color of arbitrary row labels (verticalHeader) of <code>QTableView</code>.</p>
<p>In the example below, to simplify things, all I'm trying to do is to change the row (verticalHeader) label of the second row (i.e. row with index or sectio... | <python><pyqt5><qt5> | 2024-11-13 13:08:15 | 1 | 5,938 | sdbbs |
79,184,742 | 22,407,544 | How to bold text in template using django template tags | <p>For example if I want to put an 'About' section or a 'Terms of Use' section in my website and want some of the subheadings to be bolded or made into headers. How could I use template tags to achieve this? My plan is to write the About section or Terms of Use in my <code>models</code> and use template tags to format ... | <python><django> | 2024-11-13 11:46:29 | 1 | 359 | tthheemmaannii |
79,184,672 | 6,681,932 | plotly is not updating the info correctly with dropdown interactivity | <p>I'm facing an issue with updating the median line on a <code>plotly</code> scatter plot when interacting with a <code>dropdown</code>. The dropdown allows the user to select a column (Y-axis), and I want the median of the selected Y-axis to update accordingly. However, when I select a new variable from the dropdown,... | <python><plotly><visualization><interactive> | 2024-11-13 11:24:28 | 1 | 478 | PeCaDe |
79,184,502 | 12,932,447 | Optional type annotation string in SQLModel | <p>I'm working on a FastAPI/SQLModel project and, since we've deprecated Python 3.9, I'm replacing each <code>Optional[X]</code> with <code>X | None</code>.</p>
<p>I have a problem with <a href="https://sqlmodel.tiangolo.com/tutorial/relationship-attributes/type-annotation-strings/" rel="nofollow noreferrer">Type annot... | <python><fastapi><python-typing><sqlmodel> | 2024-11-13 10:41:37 | 1 | 875 | ychiucco |
79,184,437 | 16,171,413 | How to parse the result of applicant__count in Model.objects.values("applicant", 'counter').annotate(Count("applicant")) to counter field? | <p>I have a model with these fields although there are other fields but this is my MRE:</p>
<pre><code>class Application(models.Model):
applicant = models.ForeignKey(User, on_delete=models.CASCADE, to_field='email')
company = models.CharField(max_length=100)
counter = models.PositiveIntege... | <python><django><django-models><django-views><django-signals> | 2024-11-13 10:24:50 | 1 | 5,413 | Uchenna Adubasim |
79,184,247 | 578,822 | Best practices for using @property with Enum values on a Django model for DRF serialization | <p><strong>Question:</strong> I'm looking for guidance on using @property on a Django model, particularly when the property returns an Enum value and needs to be exposed in a Django REST Framework (DRF) serializer. Hereβs my setup:</p>
<p>Iβve defined an Enum, AccountingType, to represent the possible accounting types:... | <python><python-3.x><django><django-rest-framework> | 2024-11-13 09:36:07 | 2 | 33,805 | Prometheus |
79,184,226 | 10,618,857 | Unexpected Exception using Concurrent Futures | <p>I am working on an evolutionary algorithm in Python. To speed things up, I am parallelizing the evaluation of the population using <code>concurrent.futures</code> and its class <code>ProcessPoolExecutor</code>.</p>
<p>The algorithm works for networks with up to 6 inputs. I tried to run it on networks with 8 inputs b... | <python><multithreading><concurrent.futures><evolutionary-algorithm> | 2024-11-13 09:31:13 | 0 | 945 | Eminent Emperor Penguin |
79,183,942 | 4,451,521 | Why the max_iter parameter has no effect (or the contrary effect) on this logistic regression? | <p>I have this code that does logistic regression</p>
<pre><code>import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessi... | <python><logistic-regression> | 2024-11-13 08:12:21 | 1 | 10,576 | KansaiRobot |
79,183,403 | 2,019,874 | aspectlib: make an aspect from an instance method | <p>Iβm using Pythonβs <strong>aspectlib</strong>. If I try to declare an <em>instance</em> method as an aspect like so</p>
<pre class="lang-py prettyprint-override"><code>from aspectlib import Aspect
class ClassAspect:
@Aspect
def instance_method{self, *args, **kwargs):
</code></pre>
<p>with this corresponding c... | <python><python-3.x><aop> | 2024-11-13 04:15:44 | 0 | 518 | juanchito |
79,183,375 | 9,061,561 | Chroma from_documents Crashes with Exit Code -1073741819 (0xC0000005) Without Error Message | <p>I'm working with LangChain and Chroma to perform embeddings on a DataFrame. My DataFrame shape is (1350, 10), and the code for embedding is as follows:</p>
<pre><code>def embed_with_chroma(persist_directory=r'./vector_db/',
db_directory=r'./sql/sop_database.sqlite',
collec... | <python><langchain><chromadb> | 2024-11-13 03:55:08 | 1 | 429 | vincentlai |
79,183,315 | 12,242,085 | How to remove duplicates and unify values in lists where values are very close to each other in Python? | <p>I have in Python lists like below:</p>
<pre><code>x1 = ['lock-service',
'jenkins-service',
'xyz-reporting-service',
'ansible-service',
'harbor-service',
'version-service',
'jira-service',
'kubernetes-service',
'capo-service',
'permission-service',
'artifactory-service',
'vault-service',
'harbor-service-p... | <python><pandas><list><duplicates> | 2024-11-13 03:16:58 | 3 | 2,350 | dingaro |
79,183,206 | 8,229,029 | How to properly open NARR Grib1 file in Python using MetPy | <p>I am trying to properly open and read a GRIB1 NARR data file as obtained from <a href="https://thredds.rda.ucar.edu/thredds/catalog/files/g/d608000/3HRLY/catalog.html" rel="nofollow noreferrer">https://thredds.rda.ucar.edu/thredds/catalog/files/g/d608000/3HRLY/catalog.html</a>.</p>
<p>I have tried using xr.open_data... | <python><metpy><grib> | 2024-11-13 02:08:24 | 1 | 1,214 | user8229029 |
79,183,143 | 14,024,634 | Driver syntax error when using python sql alchemy. I have driver installed | <p>I keep getting a pyodbc error.</p>
<p>Here is my error:</p>
<pre><code>(pyodbc.Error) ('IM012', '[IM012] [Microsoft][ODBC Driver Manager] DRIVER keyword syntax error (0) (SQLDriverConnect)')
</code></pre>
<p>Here is my code:</p>
<pre><code>import pyodbc
from sqlalchemy import create_engine
connection_string = (
... | <python><sqlalchemy><pyodbc> | 2024-11-13 01:20:04 | 1 | 331 | Zachary Wyman |
79,183,136 | 555,129 | SSH connect to network appliance and run command | <p>I have a network appliance that can be connected to with username and password.
On logging in, it shows a login banner (several lines) and then shows a custom shell where one can run only a preset of commands provided by the manufacturer.</p>
<p>What is the best way to connect to this appliance from python script, r... | <python><ssh><fabric> | 2024-11-13 01:13:37 | 2 | 1,462 | Amol |
79,182,975 | 17,653,423 | Dependency issues installing python package from Artifact Registry | <p>I'm trying to install a private Python package from Artifact Registry in GCP, but I'm getting some dependency errors that only happens when I try to install it using <code>pip</code> and <code>keyrings</code>.</p>
<p>I'm able to download the <code>.tag.gz</code> file from the artifactory and then install it manually... | <python><pip><python-poetry><google-artifact-registry> | 2024-11-12 23:04:53 | 0 | 391 | Luiz |
79,182,953 | 10,140,821 | UnboundLocalError: cannot access local variable in python | <p>I have the below <code>python</code> code like below.</p>
<p>From a date I am trying to findout first and last calendar days of the month.</p>
<pre><code>import datetime
import calendar
def calendar_days_month(run_date):
"""
:param run_date: date on which the process is running
:return:
... | <python> | 2024-11-12 22:50:38 | 1 | 763 | nmr |
79,182,873 | 219,153 | How to get original indicies of a polygon after applying shapely.simplify? | <p>This Python script:</p>
<pre><code>from shapely import simplify, points, contains, Point
circle = Point(0, 0).buffer(1.0, quad_segs=8).exterior
simple = simplify(circle, 0.1)
</code></pre>
<p>simplifies polygon <code>circle</code> (red) and produces polygon <code>simple</code> (blue) with a subset of <code>circle</... | <python><shapely><simplify> | 2024-11-12 22:10:19 | 2 | 8,585 | Paul Jurczak |
79,182,841 | 2,856,552 | How do I link my values to a specific column of a shapefile for coloring the map in python? | <p>I am trying to color a map based on on values from a csv file. One shapefile works very well, linking the csv to the shapefile based on the header "ADM1_EN" as per per shap shapefile example row 1 and 2 below</p>
<pre><code> ADM1_EN ADM1_PCODE ADM1_TYPE geo... | <python> | 2024-11-12 22:00:04 | 0 | 1,594 | Zilore Mumba |
79,182,682 | 13,392,257 | Nodriver: 'NoneType' object has no attribute 'closed' | <p>I am learning nodriver (version 0.37) library <a href="https://ultrafunkamsterdam.github.io/nodriver/nodriver/quickstart.html" rel="nofollow noreferrer">https://ultrafunkamsterdam.github.io/nodriver/nodriver/quickstart.html</a></p>
<p>My actions</p>
<pre><code>python3.11 -m venv venv
source venv/bin/activate
pip ins... | <python><nodriver> | 2024-11-12 20:54:54 | 1 | 1,708 | mascai |
79,182,670 | 13,395,230 | Sorting numbers into bins of the same sum | <p>I am trying to find the optimal way to sort a collection of integers into bins that all have the same sum. For simplicity we can subtract the average so we are only interested in bins that add to zero.</p>
<p>Take for example,</p>
<pre><code>X = np.array([-2368, -2143, -1903, -1903, -1888, -1648, -1528, -1318, -1213... | <python><sorting><optimization><combinatorics> | 2024-11-12 20:50:32 | 1 | 3,328 | Bobby Ocean |
79,182,637 | 236,681 | Convert blob to bytes SQLite3 Python | <p>Have a requirement of storing/retrieving bytes as a blob in SQLite3;
The column definition in as follows:<code>"bytes_as_blob " BLOB,</code>
Byte data is stored in the table using the following construct <code>sqlite3.Binary(some_data)</code> and the data when visualized via DB Browser is as below:</p>
<pr... | <python><pandas><blob><sqlite3-python> | 2024-11-12 20:31:30 | 1 | 416 | rahul |
79,182,495 | 785,400 | When running my Django test suite in VS Code, I get `AF_UNIX path too long` | <p>I'm having a problem with the VS Code test runner. It has worked as expected, but not when I load my nix environment in VS Code.</p>
<p>I'd like to be able to:</p>
<ul>
<li>Have direnv load the nix environment in the VS Code environment, to mirror my shell setup</li>
<li>Have the VS Code test runner discover and ru... | <python><visual-studio-code><django-testing><nix><direnv> | 2024-11-12 19:34:08 | 0 | 4,189 | Brian Dant |
79,182,472 | 8,183,621 | Force subclass to implement a class property in Python | <p>I want to force all subclasses of a class to implement a property. As I understand it, I have to use abc methods for this use case. I tried the following:</p>
<pre class="lang-py prettyprint-override"><code>from abc import ABC, abstractmethod
class BaseClass(ABC):
@property
@classmethod
@abstractmethod
... | <python><oop><abstract-class> | 2024-11-12 19:25:23 | 0 | 625 | PascalIv |
79,182,471 | 7,991,581 | Pymysql badly formats parameters | <p>I just moved to a new venv with pymysql version upgraded from v1.1.0 to v1.1.1 and I now have SQL errors when parameters are formatted by the <code>Cursor.execute</code> function</p>
<hr />
<p>Here is an example</p>
<pre class="lang-py prettyprint-override"><code>client_id = float(2)
params = (client_id)
print(f&quo... | <python><sqlalchemy><pymysql> | 2024-11-12 19:25:14 | 1 | 924 | Arkaik |
79,182,265 | 732,570 | how can I recover (or understand the h5debug output of) my hdf5 file? | <p>I have a hdf5 file that is so large I have to use my home fileserver to write the data (4.04TB, according to macOS's Finder). It is a collection of logits that takes several hours to calculate, and for some reason, after calculating the last chunk of data, it failed in a bad way.</p>
<p>I now see:</p>
<pre><code>h5d... | <python><hdf5> | 2024-11-12 18:06:19 | 0 | 4,737 | roberto tomΓ‘s |
79,182,217 | 735,926 | How to define two versions of the same TypedDict, one total and one not? | <p>Iβm trying to define two versions of a typed dict for an API client, one <code>total=False</code> for a partial-update route input and another <code>total=True</code> for the response. Any dict with a subset of the fields is valid as an input, but output dicts must have all the fields present.</p>
<p>I tried this:</... | <python><python-typing> | 2024-11-12 17:53:27 | 2 | 21,226 | bfontaine |
79,182,050 | 3,404,377 | How can I satisfy mypy when I have a potential callable that involves Self? | <p>I have a dataclass that has a field that might be a constant or might be a function taking <code>Self</code>. There's a helper function that just does the right thing -- if the field contains a constant, it returns the constant. If the field contains a function, it calls the function using <code>self</code>:</p>
<pr... | <python><python-typing><mypy> | 2024-11-12 16:54:13 | 2 | 1,131 | ddulaney |
79,181,977 | 1,739,725 | In python (pytz), how can I add a "day" to a datetime in a DST-aware fashion? (Sometimes the result should be 23 or 25 hours in in the future) | <p>I'm doing some datetime math in python with the pytz library (although I'm open to using other libraries if necessary). I have an iterator that needs to increase by one day for each iteration of the loop. The problem comes when transitioning from November 3rd to November 4th in the Eastern timezone, which crosses th... | <python><datetime><timezone><python-datetime><pytz> | 2024-11-12 16:33:01 | 2 | 2,186 | Pwnosaurus |
79,181,967 | 357,313 | What should df.plot(sharex=True) do? | <p>I have trouble understanding <code>sharex</code> in pandas plotting. I can make it work using matplotlib, however I also tried the <code>sharex</code> argument to <code>df.plot()</code>. I don't know <em>what</em> it does, but it is not what I expect.</p>
<p>A simple example (with a Series, but the same happens with... | <python><pandas><matplotlib> | 2024-11-12 16:29:18 | 1 | 8,135 | Michel de Ruiter |
79,181,960 | 10,452,700 | Problem with symbol opacity of errorbar within legend | <p>I'm trying to indicate perfectly symbols within legend once I want to plot complicated combinations of line and errorbar in grid plots. I noticed that it's not easy to apply desired opacity for any symbol kinds when they are error bar.</p>
<p>I have tried following checking this <a href="https://stackoverflow.com/q/... | <python><matplotlib><seaborn><legend><opacity> | 2024-11-12 16:27:16 | 1 | 2,056 | Mario |
79,181,706 | 66,191 | SQLAlchemy nested query depending on parent query | <p>How do I write a sqlalchemy subquery which depends on the parent query tables.</p>
<p>I have the following SQLAlchemy models.</p>
<pre><code>class BaseModel( DeclarativeBase ):
pass
class ABC( BaseModel ):
__tablename__ = "ABC"
__table_args__ = (
Index( "index1", "ac... | <python><mysql><sqlalchemy> | 2024-11-12 15:15:31 | 1 | 2,975 | ScaryAardvark |
79,181,689 | 13,175,203 | Polars `read_csv()` to read from string and not from file | <p>Is it possible to read from string with <code>pl.read_csv()</code> ? Something like this, which would work :</p>
<pre class="lang-py prettyprint-override"><code>content = """c1, c2
A,1
B,3
C,2"""
pl.read_csv(content)
</code></pre>
<p>I know of course ... | <python><python-polars> | 2024-11-12 15:11:23 | 1 | 491 | Samuel Allain |
79,181,429 | 1,469,465 | Django not found in Github actions | <p>I have the following CI pipeline defined in Github Actions. It is using the same container as which the production server is using. The pipeline was running fine last week, but this week it suddenly stopped working. Some observations from the run logs:</p>
<ul>
<li>We start with upgrading pip, but this doesn't seem ... | <python><django><pip><github-actions> | 2024-11-12 13:56:27 | 0 | 6,938 | physicalattraction |
79,181,422 | 1,614,355 | How to add tools in navigation bar of slack using slack python sdk? | <p>I am using Python SDK for slack. I would like to know how can I add a tool in slack navigation bar using the python sdk. Please see the image below for reference
<a href="https://i.sstatic.net/AJtMEUs8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AJtMEUs8.png" alt="Slack navigation bar tool" /></a>... | <python><slack><slack-api> | 2024-11-12 13:55:48 | 0 | 357 | Tiklu Ganguly |
79,181,238 | 3,357,352 | Selectively calling test functions with capsys | <p>I can selectively run <code>test_function_1</code>, overriding instrumentation from my <code>conftest.py</code> fixtures<sup>1</sup></p>
<pre class="lang-py prettyprint-override"><code>def test_function_1(instrumentation: dict[str, float]) -> None:
assert instrumentation['a'] > instrumentation['b']
def te... | <python><pytest> | 2024-11-12 13:08:26 | 2 | 7,270 | OrenIshShalom |
79,181,224 | 3,266,704 | Snakemake fails to execute the preample when executing --edit-notebook inside a virtualenv | <p>I have the python packages <code>notebook</code> and <code>snakemake</code> installed in my user <code>site-packages</code>.
To use snakemake with different setups, I use virtualenvs. In this virtualenv I installed <code>snakemake</code> and all the requirements of my workflow.</p>
<p>When I try to edit a notebook u... | <python><jupyter-notebook><virtualenv><snakemake> | 2024-11-12 13:04:19 | 1 | 454 | LittleByBlue |
79,181,180 | 15,913,281 | Subprocess Error When Trying to Pip Install Fastparquet on Windows 10 & Python 3.13 | <p>I am trying to pip install Fastparquet and get the error below. I have searched but cannot find anything on this specific issue. I've tried running CMD as administrator but that does not help. I've also tried installing the visual studio build tools and upgrading pip but, again, it has not helped.</p>
<pre><code>C:\... | <python><fastparquet> | 2024-11-12 12:52:30 | 1 | 471 | Robsmith |
79,181,010 | 9,749,124 | Jupyter Notebook is crashing when I want to run HuggingFace models | <p>I am using Jupyter Notebook for running some ML models from HuggingFace.
I am using Mac (M2 Chip, Memory 32 GB)</p>
<p>This is my code:</p>
<pre><code>import torch
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
# Step 1: Choose a pre-trained NER model from Hugging Face's Model Hub... | <python><machine-learning><jupyter-notebook><huggingface> | 2024-11-12 12:02:09 | 0 | 3,923 | taga |
79,180,785 | 649,920 | How to create a continous conversation between two OpenAI chatbots | <p>I want two independent instances of OpenAI chatbots to play a wordgame via python API. At this moment I only know how to create a single instance and ask it a single set of user messages. I thus have two main considerations:</p>
<ul>
<li>how can I have an ongoing conversation with a given instance? it seems like thi... | <python><openai-api> | 2024-11-12 10:51:35 | 1 | 357 | SBF |
79,180,617 | 2,092,975 | How to load a .sql file of sql statements to Snowflake | <p>I have a .sql file which contains Snowflake sql statements.</p>
<p>Eg.</p>
<pre><code>DROP TABLE IF EXISTS EMPLOYEES;
CREATE TABLE EMPLOYEES (ID INTEGER, NAME STRING, AGE INTEGER, DEPARTMENT_ID INTEGER);
INSERT INTO EMPLOYEES(ID,NAME,AGE,DEPARTMENT_ID) VALUES (1,'Steve',48,123),(2,'Mary',41,456);
</code></pre>
<p>Th... | <python><sql><snowflake-cloud-data-platform> | 2024-11-12 10:01:49 | 2 | 306 | s.bramblet |
79,180,528 | 14,113,504 | Draw a circle with periodic boundary conditions matplotlib | <p>I am doing a project that involves lattices. A point of coordinates (x0, y0) is chosen randomly and I need to color blue all the points that are in the circle of center (x0, y0) and radius R and red all the other points and then draw a circle around.</p>
<p>The tricky part is that there is periodic boundary conditio... | <python><matplotlib> | 2024-11-12 09:37:14 | 1 | 726 | Tirterra |
79,180,373 | 848,510 | DataprocPySparkBatchOp - Pass component's output to runtime_config_properties as dictionary | <p>I am creating a Dataproc batch job from VertexAI pipeline.</p>
<pre><code> get_stores_and_discount_data = (DataprocPySparkBatchOp(
project=PROJECT_ID,
location=REGION,
batch_id=f"dataproc-job-{file_date}",
main_python_file_uri=get_data_file,
python_file_uris=[
os.path.join(&q... | <python><google-cloud-platform><google-cloud-vertex-ai> | 2024-11-12 08:47:58 | 0 | 3,340 | Tom J Muthirenthi |
79,179,957 | 5,790,653 | Iterating over two lists just uses the first five members and others are not used | <p>I'm so sorry, I couldn't simplify the sample (I may make it less by your hints).</p>
<p>This is my code.</p>
<p>The base view is: I have around 100 IPs and 10 tokens in real-world example (but the sample, I intentionally added 28 tokens). Each token can be used 4 times per minute (in fact, it should be used each 25 ... | <python> | 2024-11-12 06:07:47 | 2 | 4,175 | Saeed |
79,179,598 | 178,750 | how to configure installation location pyproject.toml (python PEP517) | <p>This is a python package installation question. If I have a project named <strong>foo</strong>, how can I configure create a setuptools-based project using pyproject.toml (PEP517) to install to a subdirectory (AKA namespace?) in site-packages/ named <strong>foo2</strong>?</p>
<p>Two ways I can think of:</p>
<ol>
<li... | <python><python-import><setuptools><python-packaging><pyproject.toml> | 2024-11-12 02:07:17 | 2 | 1,391 | Juan |
79,179,586 | 8,190,068 | How do I position buttons in a vertical box layout? | <p>I have a sample app written in Python using the Kivy UI framework. There is an <code>Accordion</code> widget, and each item in the <code>Accordion</code> should display an entry with several <code>TextInput</code> fields and on the left side I would like a couple of buttons - one to edit and one to remove the entry.... | <python><kivy> | 2024-11-12 01:59:06 | 1 | 424 | Todd Hoatson |
79,179,426 | 4,013,571 | Why does flask stringify integer keys in a response JSON | <p>Why does flask stringify the integer keys in this JSON response?</p>
<p><code>app.py</code></p>
<pre class="lang-py prettyprint-override"><code>from flask import Flask
app = Flask(__name__)
@app.route('/test', methods=['GET'])
def test_endpoint():
return {1: "test"}, 200
if __name__ == '__main__':
... | <python><json><flask> | 2024-11-11 23:47:52 | 0 | 11,353 | Alexander McFarlane |
79,179,323 | 4,444,546 | How to define hypothesis strategies for custom dataclasses | <p>I am currently using <a href="https://hypothesis.readthedocs.io/en/latest/" rel="nofollow noreferrer">hypothesis</a> for fuzzing my test but I then need to generate random dataclasses, and so to build strategies for each, like</p>
<pre class="lang-py prettyprint-override"><code># Base types
uint64 = st.integers(min_... | <python><fuzzing><python-hypothesis> | 2024-11-11 22:29:43 | 1 | 5,394 | ClementWalter |
79,179,291 | 54,873 | With openpyxl, how do I collapse all the existing groups in the resultant excel? | <p>I am using <code>openpyxl</code> with a worksheet that has a lot of grouped columns at different levels. I would like the resultant output to simply collapse all the groups.</p>
<p>This is different than hiding the relevant columns and rows; I want them to be non-hidden, but just have the outlines collapsed to leve... | <python><excel><openpyxl> | 2024-11-11 22:12:11 | 1 | 10,076 | YGA |
79,179,223 | 14,122 | Can Python TypeAliases or Annotated objects be used in generics? | <p>Consider the following:</p>
<pre><code>import pydantic
def buildTypeAdapter[T](cls: type[T]) -> pydantic.TypeAdapter[T]:
return pydantic.TypeAdapter(cls)
ta1 = buildTypeAdapter(list[str]) # GOOD: pyright sees this as a TypeAdapter[list[str]]
out1 = ta1.validate_python(None) # GOOD: pyright sees this as a l... | <python><generics><python-typing><pyright> | 2024-11-11 21:45:16 | 0 | 299,045 | Charles Duffy |
79,179,193 | 7,700,802 | Calculating the correlation coefficient of time series data of unqual length | <p>Suppose you have a dataframe like this</p>
<pre><code>data = {'site': ['A', 'A', 'B', 'B', 'C', 'C'],
'item': ['x', 'x', 'x', 'x', 'x', 'x'],
'date': ['2023-03-01', '2023-03-10', '2023-03-20', '2023-03-27', '2023-03-5', '2023-03-12'],
'quantity': [10,20,30, 20, 30, 50]}
df_sample = pd.DataF... | <python><pandas><statistics> | 2024-11-11 21:30:09 | 3 | 480 | Wolfy |
79,179,125 | 15,848,470 | Polars read_database_uri() failing on `NULL as col` column in sql query | <p>I am able to read data from SQL with nulls, unless a column is created like <code>NULL as col</code>. This causes a Rust panic:</p>
<pre><code>thread '<unnamed>' panicked at 'not implemented: MYSQL_TYPE_NULL', /__w/connector-x/connector-x/connectorx/src/sources/mysql/typesystem.rs:119:18
note: run with `RUST_B... | <python><null><mysql-connector><python-polars> | 2024-11-11 21:03:15 | 1 | 684 | GBPU |
79,179,062 | 929,732 | How can I reference methods defined in my main Flask File when I start dividing things into Blueprints? | <p>So I started with</p>
<pre><code>mainfolder/
main.py <--- the entire flask app was in there but it got unruly so I though abou dividing things up in to blueprints...
</code></pre>
<p>the new way I was doing it is"</p>
<pre><code>mainfolder/
main.py <--- the entire flask app was in there but it got... | <python><flask><methods> | 2024-11-11 20:36:16 | 1 | 1,489 | BostonAreaHuman |
79,179,017 | 5,312,606 | Overloading matrix multiplication as function composition | <p>I played a bit around and wanted to try to overload the matrix multiplication operator for function composition.
Instead of writing:
<code>f(g(x))</code> I would like <code>(f @ g)</code> to return a new function as the composition of f and g.</p>
<p><strong>I am well aware that this most likely not a good idea for ... | <python><functional-programming><operator-overloading> | 2024-11-11 20:16:12 | 0 | 1,897 | mcocdawc |
79,178,956 | 2,199,439 | How to type a generic proxy class | <p>How do I tell <code>mypy</code> that my proxy class has the same attributes as the proxied class?</p>
<pre class="lang-py prettyprint-override"><code>import typing as t
from dataclasses import dataclass
class Proxy(t.Generic[C]):
def __init__(self, obj: C):
self.obj = obj
def __getattr__(self, name... | <python><generics><python-typing><mypy> | 2024-11-11 19:56:47 | 0 | 372 | volferine |
79,178,919 | 8,964,393 | Count elements in a row and create column counter in pandas | <p>I have created the following pandas dataframe:</p>
<pre><code>import pandas as pd
ds = {'col1' : ['A','A','B','C','C','D'],
'col2' : ['A','B','C','D','D','A']}
df = pd.DataFrame(data=ds)
</code></pre>
<p>The dataframe looks like this:</p>
<pre><code>print(df)
col1 col2
0 A A
1 A B
2 B C
... | <python><pandas><dataframe><count> | 2024-11-11 19:39:46 | 4 | 1,762 | Giampaolo Levorato |
79,178,876 | 943,978 | How to explode comma separated values in data frame using pyspark | <p>I have data like the below :</p>
<pre><code>ID ID1 ID2
32336741 ["32361087"] ["36013040"]
32290433 ["32223150-32223653"] ["36003347-36003348"]
32299856 ["32361087"... | <python><dataframe><pyspark> | 2024-11-11 19:19:46 | 1 | 8,885 | mohan111 |
79,178,838 | 398,348 | How to import and run a Python project in an IDE (VSCode) that refers to modules? | <p>I am learning Python and wanted to run one of Cormen's textbook examples that are in Python.
I downloaded Python.zip from <a href="https://mitpress.mit.edu/9780262046305/introduction-to-algorithms/" rel="nofollow noreferrer">https://mitpress.mit.edu/9780262046305/introduction-to-algorithms/</a> Resources tab.
I extr... | <python><visual-studio-code> | 2024-11-11 19:03:45 | 3 | 3,795 | likejudo |
79,178,832 | 1,542,011 | Cannot place whatIfOrder with ib_insync | <p>I'm trying to place a what-if-order with <code>ib_insync</code>, but I get an error related to asyncio's event loop when calling <code>whatIfOrder</code>:</p>
<blockquote>
<p>This event loop is already running.</p>
</blockquote>
<p>Placing regular orders instead of what-if-orders works. The following example reprodu... | <python><python-asyncio><ib-insync> | 2024-11-11 18:59:29 | 1 | 1,490 | Christian |
79,178,807 | 8,587,712 | How to make new pandas DataFrame with columns as old index_column pairs | <p>I have two pandas DataFrames:</p>
<pre><code>object_1df = pd.DataFrame(
[['a', 1], ['b', 2]],
columns=['letter', 'number'])
object_2df = pd.DataFrame(
[['b', 3, 'cat'], ['c', 4, 'dog']],
columns=['letter', 'number', 'animal'])
</code></pre>
<pre><code> letter number
0 a 1
1 b ... | <python><pandas><dataframe> | 2024-11-11 18:47:03 | 2 | 313 | Nikko Cleri |
79,178,578 | 1,174,784 | pandas fails to hide NaN entries from stacked line graphs | <p>Say I have the following data:</p>
<pre class="lang-none prettyprint-override"><code>Date,release,count
2019-03-01,buster,0
2019-03-01,jessie,1
2019-03-01,stretch,74
2019-08-15,buster,25
2019-08-15,jessie,1
2019-08-15,stretch,49
2019-10-07,buster,35
2019-10-07,jessie,1
2019-10-07,stretch,43
2019-10-08,buster,40
2019... | <python><pandas><matplotlib><nan> | 2024-11-11 17:22:42 | 1 | 6,357 | anarcat |
79,178,255 | 2,915,050 | Validate JSON Schema which has fixed keys and user defined keys in Python | <p>I'm trying to validate a JSON file that is provided by a user. The JSON will contain certain fixed keys, but also contain some user-defined keys too. I want to validate that this JSON object contains these fixed keys, in a certain format, and the user-defined keys are in a certain format too (as these keys will alwa... | <python><json><jsonschema> | 2024-11-11 15:34:43 | 2 | 1,583 | RoyalSwish |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.