QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,676,556 | 2,955,827 | What's the correct way to use user local python environment under PEP668? | <p>I have tried to install any python packages on Ubuntu 24.04, but found I cannot do that as in 22.04, with <code>--user</code></p>
<p><a href="https://peps.python.org/pep-0668/" rel="nofollow noreferrer">PEP668</a> said it is for avoiding package conflict between system-wide package and user installed package.</p>
<p... | <python> | 2023-12-18 01:23:40 | 6 | 3,295 | PaleNeutron |
77,676,553 | 10,200,497 | Finding the first row that meets conditions of a mask and selecting one row after it that meets a condition | <p>This is an extension to this <a href="https://stackoverflow.com/questions/77651219/finding-the-first-row-that-meets-conditions-of-a-mask-and-selecting-one-row-afte">post</a>.</p>
<p>My dataframe is:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [100, 1123, 123, 100, 1, 0, 1],
'b':... | <python><pandas><dataframe> | 2023-12-18 01:21:22 | 2 | 2,679 | AmirX |
77,676,414 | 3,929,525 | How to train a model for a dataset of images with 12 bands using TensorFlow's pix2pix notebook? | <p>I'm using TensorFlow's <a href="https://www.tensorflow.org/tutorials/generative/pix2pix" rel="nofollow noreferrer">pix2pix: Image-to-image translation with a conditional GAN notebook</a> to train a model for my dataset that consists of <strong>multispectral satellite images with 12 bands like 512 x 512 x 12</strong>... | <python><tensorflow><deep-learning><generative-adversarial-network><cgan> | 2023-12-17 23:59:46 | 1 | 1,312 | Naser.Sadeghi |
77,676,117 | 6,394,617 | why does Python read(3) seek to end of file | <p>I am trying to understand file IO in Python, with the different modes for open, and reading and writing to the same file object (just self learning).</p>
<p>I was surprised by the following code (which was just me exploring):</p>
<pre class="lang-py prettyprint-override"><code>with open('blah.txt', 'w') as f:
#... | <python><io> | 2023-12-17 21:43:59 | 1 | 913 | Joe |
77,675,936 | 6,272,006 | Extracting Discount Factors with reference from Bond Settlement Date instead of Evaluation Date in QuantLib | <p>I have bootstrapped a yield curve and I have managed to extract discount factors from this yield curve but the discount factors are referencing from the Evaluation Date. These discount factors are used to calculate the PV of the bond but they can not be used to calculate the Dirty Price of the bond if the Evaluation... | <python><quantitative-finance><quantlib><quantlib-swig> | 2023-12-17 20:39:24 | 1 | 303 | ccc |
77,675,878 | 20,803,947 | Circular import Python flask (docker-compose) | <p>Im getting this error in my flask container while starts with docker-compose up:</p>
<pre><code>web_1 | Traceback (most recent call last):
web_1 | File "/app/app.py", line 3, in <module>
web_1 | from presentation.controllers.notifications import notifications_ro... | <python><docker><flask><docker-compose><circular-reference> | 2023-12-17 20:17:35 | 1 | 309 | Louis |
77,675,830 | 16,425,029 | channel_layer.send() not sending messages to unique channel_names based on username - Django channels | <p>I am trying to implement a way to send messages to users that are user specific. I have seen the docs where they advice to store the channel_name in the database and remove it on disconnect, but I think that will be a burden on the database as channel_name keeps on changing whenever the user connects to the consumer... | <python><django><django-rest-framework><django-channels> | 2023-12-17 20:02:17 | 1 | 776 | Ritankar Bhattacharjee |
77,675,824 | 16,988,223 | Unable to apply otsu thresholding on gpu, opencv throws this: errorthreshold.cu:105: error: (-215:Assertion failed) type <= 4 in function 'threshold' | <p>I'm trying to do all my image processing in the GPU and not cpu processing:</p>
<pre><code># coding=utf8
import cv2
# Leer la imagen en la GPU
image = cv2.cuda_GpuMat()
image.upload(cv2.imread("sutil.jpeg"))
original = image
# Convertir la imagen de BGR a HSV en la GPU
image = cv2.cuda.cvtColor(image, c... | <python><opencv><cuda><image-thresholding> | 2023-12-17 19:59:59 | 1 | 429 | FreddicMatters |
77,675,755 | 12,285,101 | Cannot install quarto with nbdev_install_quarto - ImportError: cannot import name 'uname' from 'os' | <p>I'm trying to install nbdev in my jupyter notebook <a href="https://nbdev.fast.ai/tutorials/tutorial.html" rel="nofollow noreferrer">as described in this tutorial</a> .<br />
I'm trying to run in my CLI this command (after completeing the previous steps that described there):</p>
<pre><code>nbdev_install_quarto
</co... | <python><windows><fast-ai><nbdev> | 2023-12-17 19:40:57 | 1 | 1,592 | Reut |
77,675,694 | 5,822,695 | Extract list from a Pandas ExponentialMovingWindow | <p>Is there a way to extract the underlying list/array from a Pandas ExponentialMovingWindow?</p>
<pre><code>window = pd.Series.ewm(df, alpha)
window.mean() // works
window.sum() // works
window.getattr('array') // does NOT work
</code></pre>
| <python><pandas> | 2023-12-17 19:23:23 | 1 | 4,148 | Anshul Kai |
77,675,693 | 6,447,123 | FID and custom feature extractor | <p>I would like to use a custom feature extractor to calculate FID</p>
<p>according to <a href="https://lightning.ai/docs/torchmetrics/stable/image/frechet_inception_distance.html" rel="nofollow noreferrer">https://lightning.ai/docs/torchmetrics/stable/image/frechet_inception_distance.html</a> I can use <code>nn.Module... | <python><pytorch><pytorch-lightning><torchmetrics> | 2023-12-17 19:23:17 | 1 | 4,309 | A.A |
77,675,560 | 13,180,560 | Flask app throws 403 forbiden after refreshing the page | <p>My react app starts smoothly on first opening , then after any refresh i start getting 403 forbidden error , which makes my development super slow. any solution will be welcomed !</p>
<p>Backend running on Python Flask following are configs for CORS :</p>
<pre><code>CORS(app, resources={r"/*": {"origi... | <python><reactjs><flask><cors> | 2023-12-17 18:43:07 | 1 | 1,416 | Amir Doreh |
77,675,439 | 3,623,537 | Kill python process from itself and run code after | <p>I have this use case when during one script I want to use one .pyd library but generally I want to use another version of the same .pyd.</p>
<p>To accomplish this I switch .pyd files when python script starts and then import lib imports correct version.</p>
<p>At the end of python script (using atexit) I've attached... | <python><process><system> | 2023-12-17 18:01:48 | 1 | 469 | FamousSnake |
77,675,385 | 587,650 | Sqlalchemy order_by hybrid_property orders by something else | <p>So, I have a Product class and a User class. A User is the seller of a Product, and can have many products. The <code>Product.price</code> is the price without VAT, and each User have a flag in the User table <code>is_vat</code>, to state if the price showed externally shall have VAT added to it or not.</p>
<p>So I ... | <python><flask><sqlalchemy><flask-sqlalchemy> | 2023-12-17 17:42:47 | 1 | 719 | Drublic |
77,675,126 | 18,125,313 | How does numpy gain speed when the number of elements is less than 3-5 million? | <p>Some numpy operations suddenly improve performance when the number of elements drops below a certain amount.</p>
<p>This is a function that uses numpy to find the maximum value of an array.</p>
<pre class="lang-py prettyprint-override"><code>def np_max(arr):
return np.max(arr)
</code></pre>
<p>For comparison, he... | <python><numpy><performance><optimization><numba> | 2023-12-17 16:15:13 | 1 | 3,446 | ken |
77,674,793 | 6,713,310 | "Error: ENOENT: no such file or directory" but file exists | <p>I am trying to download a <code>.wav</code> file from an Azure server (Ubuntu 20.04.6 LTS) using Visual Studio, but I get</p>
<p><code>"Error: ENOENT: no such file or directory</code></p>
<p>In addition, the Python code I am runnining cannot load this file, as I get</p>
<p><code>FileNotFoundError: [Errno 2] No ... | <python><visual-studio> | 2023-12-17 14:38:50 | 1 | 528 | Phys |
77,674,636 | 19,125,840 | Overload a Function that accepts Any Number of Positional Arguments and returns int or Tuple[int] | <p>I am trying to type hint a function that accepts any number of positional arguments and returns int if size is 1 and returns tuple of same size if it is more than 1.</p>
<p>This is what I have right now:</p>
<pre class="lang-py prettyprint-override"><code>def timestamp(*date: Union[datetime, str, int]) -> int | T... | <python><mypy><python-typing> | 2023-12-17 13:49:10 | 2 | 460 | demetere._ |
77,674,542 | 354,051 | tkinter scrolled window in dynamic(add/delete widgets at runtime) environment | <p><a href="https://i.sstatic.net/mOXWV.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mOXWV.jpg" alt="enter image description here" /></a></p>
<pre class="lang-py prettyprint-override"><code>import tkinter as tk
from tkinter import ttk
import random
import string
def id_generator(size=6, chars=string.... | <python><tkinter> | 2023-12-17 13:14:57 | 0 | 947 | Prashant |
77,674,409 | 6,439,229 | How to fully implement custom right mousebutton functionality for QCheckBox | <p>When a normal <code>QCheckbox</code> is in <code>PartiallyChecked</code> state and you left-click on it, it will change to <code>Checked</code> state. Right-clicking on a checkbox does nothing.</p>
<p>I want to modify a checkbox so that right-clicking does the same as left-clicking except when clicking in <code>Part... | <python><pyqt><pyqt6><qcheckbox> | 2023-12-17 12:34:26 | 1 | 1,016 | mahkitah |
77,674,134 | 501,266 | Where can I find a Python method to clearly and concisely initialize lists? | <p>Creating lists is a very common task for me, and when those lists need to be initialized, the Python code needed to do so feels overly complex and low level. I would like to find a method something like this:</p>
<pre class="lang-py prettyprint-override"><code>def create_list(size = 0, initial_value = None, initiali... | <python><list><function> | 2023-12-17 11:01:04 | 2 | 5,010 | Keith Bennett |
77,674,033 | 969,724 | How to pass a callback function from Rust to Python with pyo3 | <p>Here is an example what I would like to achieve, of course this is just a psudo code that doesn't work.</p>
<p>Python class with a function that should be called from rust with a callback parameter.</p>
<pre><code>class Test:
def test_fn(callback):
a = 1
print(f"value a from python {a}&... | <python><rust><pyo3> | 2023-12-17 10:23:15 | 0 | 1,793 | V.Rashkov |
77,673,792 | 10,200,497 | groupby streak of numbers and one row after it then check the first value of a column for each group and create a new column | <p>This is my dataframe:</p>
<pre><code>df = pd.DataFrame(
{
'a': [0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0],
'b': [1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1]
}
)
</code></pre>
<p>And this is the output that I want. I want to create column <code>c</code>:</p>
<pre><co... | <python><pandas><dataframe> | 2023-12-17 08:52:32 | 2 | 2,679 | AmirX |
77,673,595 | 11,831,138 | Problems serving staticfiles(css and javascripts) on django project using digital ocean spaces | <p>i built a project using django 4.2 and i configured django storage and digital ocean spaces on it. the project is also hosted on digital ocean using droplets. the problem i'm having now is that i'm able to collect static and all files are uploaded to digital ocean space, the images are displaying but it doesn't serv... | <python><django><digital-ocean><digital-ocean-spaces> | 2023-12-17 07:21:17 | 0 | 349 | Abayomi Olowu |
77,673,353 | 9,357,484 | How to use adapter transformers with a Huggingface Pipeline | <p>I tried to run the model "AdapterHub/bert-base-uncased-pf-conll2003" (<a href="https://huggingface.co/AdapterHub/bert-base-uncased-pf-conll2003" rel="nofollow noreferrer">Model description here</a>) for token classification in NLP.</p>
<p>First I tried to install the adapter transformers</p>
<pre><code>pip... | <python><machine-learning><nlp><huggingface-transformers> | 2023-12-17 04:49:28 | 1 | 3,446 | Encipher |
77,673,233 | 1,131,293 | What is more pythonic? attribute querying or subclassing? | <p>I want to create class than can take either a float for epsilion or an epsilion that has some decaying method.</p>
<pre class="lang-py prettyprint-override"><code>class DoSomething:
def __init__(self, epsilion):
self.epsilion = epsilion
def something(self):
# other code
# then call d... | <python> | 2023-12-17 03:33:12 | 2 | 543 | jcjustesen |
77,673,182 | 6,676,101 | What Python script will find the locations of every backslash inside of an HTML tag and replace the backslash with a forward slash? | <p>Input:</p>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
<title>This is a title</title>
<\head>
<body>
<div>
<p>H/e/l/l/o \a\b\c\d\e\f\gw/o/r/l/d!</p>
</div>
<\body>
<\html>
</c... | <python><html><regex> | 2023-12-17 03:02:16 | 2 | 4,700 | Toothpick Anemone |
77,672,938 | 826 | pip unusable in Python 3.12 virtual environment | <p>I've created a blank, brand-new Python project using PyCharm. From the command line, going into that project correctly activates the virtual environment.</p>
<pre><code>$ [~/Developer] cd pythonProject
Switching pipenv: pythonProject-IbA-tQW [🐍Python 3.12.0]
$ [~/Developer/pythonProject]
</code></pre>
<p>In that v... | <python><python-3.x><pip><python-3.12> | 2023-12-17 00:11:25 | 0 | 12,020 | Andrew |
77,672,931 | 9,135,359 | How to get KerrasRegressor to work? I keep getting an AttributeError | <p>I'm trying to optimize hyperparameters for a simple sequential neural-network using the KerasRegressor as part of a learning exercise. This is my code:</p>
<pre><code>from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
from scipy.stats import randint as sp_randint
from keras.wrappers.scikit_learn im... | <python><tensorflow><keras> | 2023-12-17 00:08:41 | 1 | 844 | Code Monkey |
77,672,825 | 12,853,184 | SQLAlchemy relationship or association_proxy through several models(tables) | <p>I have several tables, connected as a chain with One-to-many relationships (names are changed to emphasise, there is a chain):</p>
<p>Country <- City <- Street <- House</p>
<p>I need to have an attribute in House model to access it's only one Country.</p>
<p>Street is connected to House using relationship, ... | <python><flask-sqlalchemy><relationship> | 2023-12-16 23:12:12 | 2 | 674 | Anton Makarov |
77,672,702 | 46,503 | Flask app: how to handle multiple requests that should be responded in no time | <p>My Flask application is built around some third-party API, I have hundreds of thousands requests.
The problem is their API requires responses to be sent very fast whereas I need to do many things: check the request parameters, verify the webhook request, search for a user in our database, etc. which takes time. Eve... | <python><amazon-web-services><multithreading><flask><amazon-elastic-beanstalk> | 2023-12-16 22:20:00 | 0 | 5,287 | mimic |
77,672,656 | 6,237,093 | How to update pip in all environments created by pyenv | <p>Python warns to update the <code>pip</code> version when I try to upgrade <code>jupyterlab</code> in my <code>jupyter3</code> environment created using <code>pyenv</code>. I followed the instructions in the output log:</p>
<pre><code>[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update,... | <python><python-3.x><pip><pyenv> | 2023-12-16 22:02:39 | 0 | 6,798 | David Leal |
77,672,632 | 7,930,118 | RuntimeError When Modifying Node Count in Networkx Graph for Graph Neural Network Training | <p>I'm encountering a runtime error while manipulating the node count in a Networkx-generated graph passed through a Graph Neural Network (GNN). Here's my GNN code, which seems independent of the graph's node count:</p>
<pre><code>class GCN(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
... | <python><networkx><graph-neural-network> | 2023-12-16 21:49:54 | 0 | 529 | Protik Nag |
77,672,545 | 3,142,695 | Cannot run python3 script, which uses another package | <p>I am trying to run a simple python script on my macOS terminal. The scripts starts with</p>
<pre><code>import wfdb #WaveForm-Database package. A library of tools for reading, writing, and processing WFDB signals and annotations.
import pandas as pd
import numpy as np
import glob
</code></pre>
<p>But it fails with th... | <python><macos> | 2023-12-16 21:19:21 | 0 | 17,484 | user3142695 |
77,672,116 | 11,908,063 | Python TypeVar bound to a class is not compatible with bound class | <p>This is a fairly contrived example, but in summary:</p>
<ul>
<li>I have a <code>Store</code> responsible for returning values of type <code>T</code> (a specific sub-class of <code>Model</code></li>
<li>The <code>Store</code> can contain any subclass of <code>Model</code> but allows you to register coverters such tha... | <python><generics><mypy><python-typing> | 2023-12-16 18:50:22 | 1 | 632 | Sam Broster |
77,672,055 | 1,473,517 | How to shade above a plotted line? | <p>I have a grid with a line drawn on it as follows.</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
# Draw squares with random integers between -3 and 3 in each square
np.random.seed(42) # Setting a seed for reproducibility
square = np.zeros((10, 10), dtype=np.int_)
for x in np.arange(0.5, 10, 1):... | <python><matplotlib> | 2023-12-16 18:31:41 | 1 | 21,513 | Simd |
77,671,877 | 7,959,614 | How to merge two xarray.Datasets based on common coordinates | <p>I want to merge two <code>xarray.Dataset</code>-objects.</p>
<p>My code looks as follows:</p>
<pre><code>import numpy as np
import xarray as xr
N_CHAINS = 4
N_DRAWS = 1000
N_PLAYERS = 5
player_idx = [1, 1, 2, 3, 4, 4, 0, 0, 2, 2]
opponent_idx = [0, 3, 1, 4, 1, 1, 1, 4, 3, 3]
h2h_idx = pd.MultiIndex.from_tuples(
... | <python><python-xarray> | 2023-12-16 17:38:37 | 1 | 406 | HJA24 |
77,671,804 | 13,801,302 | How to solve: RuntimeError: CUDA error: device-side assert triggered? | <p>I want to use the <em>paraphrase-multilingual-mpnet-base-v2</em> model to build embeddings and I got this error:</p>
<p><strong>RuntimeError: CUDA error: device-side assert triggered</strong></p>
<p>The error occurs by executing <code>string = {k: v.to(device=device) for k, v in string.items()}</code>.</p>
<p><stron... | <python><pytorch><transformer-model> | 2023-12-16 17:17:20 | 1 | 621 | Christian01 |
77,671,478 | 1,180,930 | How can I detect and "fix" URLs in a body of text if they have spaces? | <p>Suppose I have the following submitted text. Note the spaces in most of the URLs:</p>
<blockquote>
<p>According to NASA (htt ps://www.nasa. gov) and the New York Times (<a href="https://www.nytimes.com/topic/organization/national-aeronautics-" rel="nofollow noreferrer">https://www.nytimes.com/topic/organization/nati... | <python><string><replace><python-re><url-parsing> | 2023-12-16 15:31:01 | 2 | 1,971 | jvriesem |
77,671,360 | 4,556,556 | Docker: Can't Find my_app Module | <p>I am creating an flask app to demo Cloudbuild and Docker.</p>
<p>Here is my file structure:</p>
<p><a href="https://i.sstatic.net/ZoUb2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZoUb2.png" alt="file_structure" /></a></p>
<p>When I build and try to run my docker image, I keep getting an error:</p... | <python><docker><flask> | 2023-12-16 14:55:24 | 0 | 502 | Patrick Bentley |
77,671,277 | 5,687,866 | ValueError: Invalid pattern: '**' can only be an entire path component | <p>I am trying to fine tune a LLM</p>
<p>My code so far:</p>
<pre><code>from datasets import load_dataset, DatasetDict, Dataset
from transformers import (
AutoTokenizer,
AutoConfig,
AutoModelForSequenceClassification,
DataCollatorWithPadding,
TrainingArguments,
Trainer)
from peft import P... | <python><large-language-model><huggingface-datasets> | 2023-12-16 14:30:38 | 5 | 1,080 | Hitesh Somani |
77,671,246 | 5,986,907 | jax.jit my whole program or just parts of it? | <p>Suppose I have a JAX program like</p>
<pre><code>def f(x: jnp.array) -> jnp.array:
...
def g(x: jnp.array) -> jnp.array:
# use f lots of times
# do other stuff
...
</code></pre>
<p>where <code>f</code> and <code>g</code> are fully <code>jit</code>-compatible, what should I <code>jit</code>?</p>
<... | <python><jit><jax> | 2023-12-16 14:23:17 | 1 | 8,082 | joel |
77,670,915 | 1,473,517 | How to place the tick label between grid lines | <p>I am plotting a grid and I want two changes. The first is that I want the y-axis tick labels to be descending starting from the top. I have managed to do it but I was wondering if there was a simpler way. The second is that I want the tick labels to be between the grid lines and not at the location of the grid line... | <python><matplotlib> | 2023-12-16 12:29:12 | 1 | 21,513 | Simd |
77,670,629 | 2,919,585 | Python type hints: List of allowed objects (not literals) | <p>Say I have a function <code>foo(f)</code> where <code>f</code> should be one of <code>np.sin</code> or <code>np.cos</code>. What would be the correct way to type hint this?</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
def foo(f: Literal[np.sin, np.cos]):
...
</code></pre>
<p>looks about... | <python><python-typing> | 2023-12-16 10:49:06 | 5 | 571 | schtandard |
77,670,495 | 1,413,798 | Vertex AI - Sample Notebook Authentication | <p>Vertex AI created the below sample notebook. When I run it I get a unauthorized error. I don't see any exmaples on what the authentication setup would be like. Would it be a API key, username/password, etc? What would the code consist of?</p>
<pre><code>!pip install --upgrade google-cloud-aiplatform
import base64
i... | <python><google-cloud-platform><jupyter-notebook><google-cloud-vertex-ai> | 2023-12-16 09:55:27 | 2 | 947 | Pie |
77,670,084 | 10,654,749 | How to modify a structured numpy arrray using pybind11 | <p>I've got a few structs</p>
<pre><code>/* Ray structure for a single ray */
struct RTC_ALIGN(16) RTCRay
{
float org_x; // x coordinate of ray origin
float org_y; // y coordinate of ray origin
float org_z; // z coordinate of ray origin
float tnear; // start of ray segment
float d... | <python><c++><arrays><numpy><pybind11> | 2023-12-16 07:06:22 | 0 | 525 | Dave Fol |
77,669,790 | 13,097,194 | Why do Backspace and Ctrl + Backspace produce different bytestrings within Linux and Windows, and how can this discrepancy be resolved within my code? | <p>I am working on a typing game in Python that uses <code>getch()</code> to read in characters, then performs different actions depending on which character has been entered.</p>
<p>The code for reading in characters and assigning them to bytestrings (if needed) is as follows:</p>
<pre><code>character = getch() # Impo... | <python><linux><windows><encoding><getch> | 2023-12-16 04:14:36 | 1 | 974 | KBurchfiel |
77,669,753 | 11,280,068 | python loguru outputs error to terminal but not to log file | <p>I'm running into an issue with loguru for logging where everything works for stdout but only partially for stderr.</p>
<p>The problem is:</p>
<ul>
<li><p>For my Local Terminal:</p>
<ul>
<li>Regular logs - do output</li>
<li>Errors - do output</li>
</ul>
</li>
<li><p>For the log file</p>
<ul>
<li>Regular logs - do di... | <python><python-3.x><bash><logging><loguru> | 2023-12-16 03:49:31 | 1 | 1,194 | NFeruch - FreePalestine |
77,669,723 | 7,050,789 | numpy: elision versus in-place | <p>I'm aware of the <a href="https://numpy.org/doc/stable/release/1.13.0-notes.html" rel="nofollow noreferrer">elision that numpy can do</a>, but in the following situation I'd expect that (at best) neither approach has to allocate any new storage and hence they'd perform at the same speed:</p>
<pre class="lang-py pret... | <python><numpy><performance> | 2023-12-16 03:32:21 | 0 | 894 | stephematician |
77,669,659 | 10,200,497 | Replacing second row of each group with first row of another dataframe | <p>I have two dataframes:</p>
<pre><code>import pandas as pd
df1 = pd.DataFrame(
{
'sym': ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'c'],
'open': [99, 22, 34, 63, 75, 86, 1800, 82],
'high': [3987, 41123, 46123, 6643, 75, 3745, 72123, 74],
'x': ['gd', 'ed', 'we', 'vt', 'de', 'sw', 'ee', '... | <python><pandas> | 2023-12-16 03:02:09 | 4 | 2,679 | AmirX |
77,669,563 | 699,211 | Pandas: apply date_range() to a group of rows that share a fixed date? | <p>I have a csv file of WTA matches that are structured like this:</p>
<pre><code>season,date,name,location,level,surface,draw,round,winner,loser,status
1987,1986-12-01,Argentine Open,Buenos Aires,C1,clay,56,R64,Maria Lindstrom,Patrizia Murgo,f
1987,1986-12-01,Argentine Open,Buenos Aires,C1,clay,56,R64,Gabriela Mosca,P... | <python><pandas><dataframe> | 2023-12-16 01:52:11 | 0 | 709 | vmorph |
77,669,406 | 8,661,071 | SharePoint programatically access error: AADSTS65001 DelegationDoesNotExist The user or administrator has not consented to use the app with ID X | <p>I’m using office365-rest-python-client to programmatically access a SharePoint site in Office365 online.</p>
<p>The application I’m acceding this is just a Python script that will run in a backend
For that, I went to <a href="https://entra.microsoft.com/" rel="nofollow noreferrer">https://entra.microsoft.com/</a> ... | <python><sharepoint><office365> | 2023-12-16 00:27:14 | 1 | 1,349 | MasterOfTheHouse |
77,669,288 | 4,251,301 | How to execute GPU-related heavy task in the background? | <p>I have a <strong>server-client</strong> project with <code>/analyze</code> URL to analyze something with <em><strong>GPU</strong></em>. The <strong>client</strong> application sends a request with the name of a file to the server through Python's <code>requests</code> module.</p>
<pre><code># client.py
import reques... | <python><multithreading><flask><parallel-processing><multiprocessing> | 2023-12-15 23:35:19 | 1 | 852 | jislam |
77,669,205 | 226,081 | pytest 5.x+ upgrade and use a command line flag to run/skip decorated tests | <p>I'm trying to upgrade from pytest 4.x to something newer. However, I'm running into issues where <code>pytest.config</code> was removed and I'm not sure how to accommodate the new syntax. Specifically, I'm trying to specify a command line flag that can run or skip specific decorated tests depending on whether or not... | <python><python-3.x><pytest><pytest-fixtures> | 2023-12-15 22:58:27 | 1 | 10,861 | Joe Jasinski |
77,669,146 | 8,100,895 | Maximum sum, min length subset | <p>I am trying to solve this popular problem:</p>
<p>"Given an integer array, divide the array into two subsets, A and B, while respecting the following conditions.</p>
<ol>
<li><p>the intersection of A and B is null.</p>
</li>
<li><p>the union A and B is equal to the original array.</p>
</li>
<li><p>the number of... | <python><algorithm><computation-theory> | 2023-12-15 22:39:15 | 2 | 1,966 | Jonathan |
77,668,958 | 13,078,279 | Can a Flask (or other SSR) app receive client-side events without JS? | <p>I am making an app (as an educational exercise) that is purely rendered server-side and uses no client-side JS whatsoever. A key part of the app is that the server needs to be able to intercept <em>client-side</em> events - keyboard input, click, drag, cursor location, etc.</p>
<p>A rough sketch would be something l... | <javascript><python><flask> | 2023-12-15 21:43:20 | 0 | 416 | JS4137 |
77,668,905 | 17,889,328 | pycharm bug? Inspection false positives when import an asynccontextmanager | <p><strong>EDIT</strong>
now a reproduced issue
<a href="https://youtrack.jetbrains.com/issue/PY-65385" rel="nofollow noreferrer">https://youtrack.jetbrains.com/issue/PY-65385</a></p>
<p><strong>EDIT</strong> i made a more minimal reproduction, and discovered it only happens when importing..</p>
<p>As of today Pycharm ... | <python><import><pycharm><praw><asyncpraw> | 2023-12-15 21:27:23 | 0 | 704 | prosody |
77,668,682 | 2,683,447 | Referencing a downstream class in type hinting for a class method | <p>I am building a python game using pygame. Struggling a bit to add typing to things. I have a abstract group class Mobs which I define with:</p>
<pre><code>class Mobs(pygame.sprite.Group):
</code></pre>
<p>I then create individual monsters with:</p>
<pre><code>class Mob(pygame.sprite.Sprite):
</code></pre>
<p>Later i... | <python><class><methods><types><pycharm> | 2023-12-15 20:32:07 | 1 | 4,187 | Math chiller |
77,668,595 | 10,997,667 | Matplotlib pcolormesh() atributes | <p>If I have an existing <code>pcolormesh()</code> object is it possible to change the <code>vmin</code>, <code>vmax</code> values? In other words, are <code>vmin</code> and <code>vmax</code> attributes of the <code>pcolormesh</code> object?</p>
| <python><matplotlib> | 2023-12-15 20:04:41 | 1 | 787 | osprey |
77,668,372 | 9,840,684 | Creating a function to standardize labels for each ID | <p>I am attempting to create a function that standardizes a label column for a given ID for a given criteria.</p>
<p>I would like to standardize the label based on the <em>most commonly used label</em> for that ID, and if there is no common/majority label, then just take the first observation as the default standard.</... | <python><pandas><dataframe><numpy><group-by> | 2023-12-15 19:11:35 | 1 | 373 | JLuu |
77,668,199 | 856,070 | How to have python create log entries when called by postfix | <p>I have configured postfix with <code>mailbox_command = /path/to/my_python_script.py</code>.</p>
<p>If my python script fails, I see the results of the exception in /var/log/mail.log.</p>
<p>When I try to create a logging.error(message), that message does not appear in the mail.log file.</p>
<p>Is there a way to make... | <python><logging><postfix-mta> | 2023-12-15 18:32:34 | 0 | 3,148 | jcfollower |
77,668,127 | 10,545,426 | Find pytests tests that are not marked | <p>We have a lot of tests in our project that it takes forever for it to complete in a single runner. So, I use pytest.mark to group the tests and in github actions I build a matrix based on these marks.
Problem is sometimes we forget to mark tests and they never run.
Is there a way to detect tests that do no have a ma... | <python><python-3.x><pytest> | 2023-12-15 18:14:27 | 1 | 399 | Stalin Thomas |
77,667,916 | 731,351 | Convert Polars string columns into list of integers | <p>I am trying to convert a TSV file in <a href="https://felixfan.github.io/bedtools/" rel="nofollow noreferrer"> BED12 format</a> to a polars data frame. I got two columns encoded as strings containing coma separated integers. My solution (simplified) involves going through structs:</p>
<pre class="lang-py prettyprint... | <python><dataframe><python-polars> | 2023-12-15 17:32:16 | 1 | 529 | darked89 |
77,667,669 | 2,256,700 | Starting or resuming async method/coroutine without awaiting it in Python | <p>In JavaScript (and other languages) an <code>async</code> function is immediately executed upon its invocation until the first <code>await</code> is encountered.
This is not the case in Python. From the <a href="https://docs.python.org/3/library/asyncio-task.html#coroutines" rel="nofollow noreferrer"><code>asyncio</... | <python><asynchronous><async-await><python-asyncio><coroutine> | 2023-12-15 16:46:31 | 3 | 989 | MaPePeR |
77,667,634 | 445,810 | String internment in Python during JSON and XML parsing | <p>Does Python perform string internment to save memory on duplicate keys when deserializing large arrays of dicts read from XML/JSON serialized to disk? (e.g. during <code>xml.dom.minidom.parse</code> / <code>json.load</code>)</p>
<p>Thanks!</p>
| <python><string><deserialization><json-deserialization><xml-deserialization> | 2023-12-15 16:40:34 | 0 | 1,164 | Vadim Kantorov |
77,667,537 | 6,759,459 | arm64 - How do I install sudachiPy - needed for japanese SpaCy | <p>I should preface by saying that I did follow the <code>SpaCy</code> documentation to install the <code>SpaCy</code> library and the models of interest.</p>
<pre><code>pip install -U pip setuptools wheel
pip install -U 'spacy[apple]'
python -m spacy download zh_core_web_sm
python -m spacy download en_core_web_sm
pyth... | <python><docker><spacy><rust-cargo><arm64> | 2023-12-15 16:20:47 | 1 | 926 | Ari |
77,667,507 | 12,775,432 | Iteration not working when using a sampler in Pytorch's data loader | <p>I have this class of sampler that allows me to enter sample my data per different batch sizes.</p>
<pre><code>class VaribleBatchSampler(Sampler):
def __init__(self, dataset_len: int, batch_sizes: list):
self.dataset_len = dataset_len
self.batch_sizes = batch_sizes
self.batch_idx = 0
... | <python><pytorch><pytorch-dataloader> | 2023-12-15 16:15:44 | 1 | 640 | pyaj |
77,667,478 | 6,995,188 | PySpark : Having trouble matching a date column to a dictionary | <p>I am certain this is a simple change but having issues simply matching a date column to a list of items. Example is using the holidays package but the problem can be applied to other use cases, just my experience in PySpark is not great!!</p>
<p>Using the holidays package (<a href="https://pypi.org/project/holidays/... | <python><pyspark><jupyter-notebook> | 2023-12-15 16:08:54 | 1 | 470 | user5004137 |
77,667,269 | 11,483,674 | AWS Python CDK - define the launch template for Batch Compute Environment | <p>In my Python CDK Stack, I'm trying to configure an AWS Batch Compute Environment to be able to use a <code>Launch Template</code> I'm creating in the same stack. Example:</p>
<pre class="lang-py prettyprint-override"><code>launch_template = ec2.CfnLaunchTemplate(
scope=self,
id=f"{stack_id}-EC2LaunchTem... | <python><amazon-ec2><aws-cdk><aws-batch> | 2023-12-15 15:29:48 | 1 | 632 | Luiz Tauffer |
77,667,098 | 13,492,584 | osmnx query OpenStreetMap | <p>I am using <strong>Python</strong> and I am trying to use <strong>osmnx</strong> to query <strong>OpenStreetMap</strong> and get data about the Italian city of <a href="https://www.openstreetmap.org/relation/45144#map=12/45.5354/10.2236" rel="nofollow noreferrer"><strong>Brescia</strong></a>.</p>
<p>Here's the code ... | <python><graph><networkx><openstreetmap><osmnx> | 2023-12-15 14:57:09 | 1 | 644 | hellomynameisA |
77,667,026 | 13,100,938 | AttributeError: 'tuple' object has no attribute 'encode' during stateful DoFn | <p>I am using a stateful and timely DoFn to process data 2 seconds after the end of the fixed window I am implementing.</p>
<p>I have tested a reproducible example of my code inside the Apache Beam playground. My data is in <code>KV[str, str]</code> format as an input to the DoFn. The only difference I can think of bet... | <python><google-cloud-platform><encoding><google-cloud-dataflow><apache-beam> | 2023-12-15 14:43:54 | 1 | 2,023 | Joe Moore |
77,666,811 | 4,715,905 | python logger - log extra arguments | <p>I have got a logger set up in databricks that saves the output as json files in blob storage. This works fine but I would like to add the data I pass into "extra" into the output JSON as top level keys.</p>
<p>This was the suggestion by the databricks AI assistant but extra_fields doesn't seem to ever ret... | <python><python-logging> | 2023-12-15 14:08:08 | 0 | 1,059 | Bee_Riii |
77,666,517 | 1,448,641 | Assign slice to another slice of same data frame | <p>Consider the following pandas dataframe:</p>
<pre><code>df = pd.DataFrame({'a': [1, 2, None, 3, None]}, index=[0, 1, 2, 3, 4])
</code></pre>
<p>I want to replace to the nan values with some other values from the same data frame, for example:</p>
<pre><code>df.loc[[2, 4]] = df.loc[[0, 1]]
</code></pre>
<p>But that do... | <python><pandas><dataframe><assign> | 2023-12-15 13:18:58 | 0 | 5,519 | MaxPowers |
77,666,292 | 11,901,834 | Airflow dependencies with Task decorator | <p>I have an Airflow DAG that I can't figure out how to implement one particular dependency.</p>
<p>The code looks like this:</p>
<pre><code># Setup DAG
@dag(
dag_id="dag_1",
description="Dag 1 desc",
schedule=DAG_SCHEDULE,
start_date=days_ago(0),
catchup=False,
default_args=... | <python><airflow> | 2023-12-15 12:34:31 | 1 | 1,579 | nimgwfc |
77,666,182 | 23,106,915 | Pystray icon inappropriate behavior with Tkinter window withdraw | <p><strong>Description:</strong>
So I am using customtkinter library instead of tkinter, the issue I am facing is that I want my tkinter app to be withdrawn when closed if the minimize window checkbox is checked in settings of the app. The first time I perform this action the app withdraws as well as pystray icon appea... | <python><tkinter><customtkinter><pystray> | 2023-12-15 12:12:42 | 1 | 546 | AshhadDevLab |
77,666,163 | 10,106,578 | Scrapy crawler, 403 error for crawling south wales courses | <p>I have been bashing my head against this for a while and figured I would turn it over to the experts of the internet for a bit of aid.</p>
<p>I am trying to use scrapy to crawl a list of courses from the university of south wales (all public information of course). However whenever I do I get met with a 403 that sto... | <python><web-scraping><scrapy> | 2023-12-15 12:08:16 | 1 | 483 | Kron |
77,666,026 | 8,099,689 | Length of groupby result in pandas | <h2>Problem</h2>
<p>I want to calculate the <strong>number of unique combinations of two columns</strong>. What is the most performant way to achieve this using pandas?</p>
<p>For me, the most intuitive way is to groupby the columns and take the length of the object. However, for a large dataframe, I find the performan... | <python><pandas><dataframe><group-by><aggregate> | 2023-12-15 11:40:40 | 2 | 366 | joba2ca |
77,665,894 | 11,999,452 | VS Code numpy array endlessly expanding in debugger variables section | <p>Given a simple python program like</p>
<pre><code>import numpy as np
my_list = [1,2,3,4,5]
my_array = np.array(my_list)
</code></pre>
<p>I can now use break points and the debugger to watch the variables</p>
<p><a href="https://i.sstatic.net/PCYYF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PCYYF.... | <python><numpy><visual-studio-code><debugpy> | 2023-12-15 11:13:21 | 1 | 400 | Akut Luna |
77,665,538 | 5,589,640 | BERTopic: add legend to term score decline | <p>I plot the <a href="https://maartengr.github.io/BERTopic/api/plotting/term.html" rel="nofollow noreferrer">term score decline</a> for a topic model I created on Google Colab with <a href="https://maartengr.github.io/BERTopic/index.html" rel="nofollow noreferrer">BERTopic</a>. Great function. Works neat! But I need t... | <python><plotly><google-colaboratory><bert-language-model><topic-modeling> | 2023-12-15 10:07:26 | 1 | 625 | Simone |
77,665,453 | 8,278,075 | TypeError: 'DataFrame' object is not callable when using `df = DataFrame()` | <p>I have a Streamlit application which uses Pandas dataframes to show graphs in Altair.</p>
<p>I've exhausted most likely causes but I still get the following errors.</p>
<p>At first the error was showing up with my code:</p>
<pre><code> File "/mnt/c/Users/xxx/Documents/xxx/deps/charts/charts.py", line 131,... | <python><pandas><streamlit> | 2023-12-15 09:50:07 | 1 | 3,365 | engineer-x |
77,665,417 | 5,005,808 | How to find the load directory of keras_nlp model tokenizer? | <p>I'm new to <code>keras_nlp</code>. I failed in running the following code. The following code automatically download the file from <a href="https://storage.googleapis.com/keras-nlp/models/deberta_v3_base_en/v1/vocab.spm" rel="nofollow noreferrer">url</a>.</p>
<pre><code>preprocessor = keras_nlp.models.DebertaV3Prepr... | <python><keras> | 2023-12-15 09:44:26 | 0 | 1,930 | pfc |
77,665,388 | 354,051 | Expending tk.Frame and it's children for an Attribute Editor like GUI | <p>Python 3.12
Windows 10</p>
<p><a href="https://i.sstatic.net/9XOmC.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9XOmC.jpg" alt="enter image description here" /></a></p>
<p>I'm trying to create a property editor using tkinter. Here is the code:</p>
<pre class="lang-py prettyprint-override"><code>imp... | <python><tkinter> | 2023-12-15 09:38:31 | 1 | 947 | Prashant |
77,665,223 | 19,041,863 | Change Ticks on Collorbar (manually) | <p>I would like to display Change cards. I have this database (ChangeEU)</p>
<pre><code> Latitude Longitude Altitude Value O18d
0 30.0 -30.0 0.0 1.262094 1.262094
1 30.0 -29.9 0.0 1.269815 1.269815
2 30.0 -29.8 0.0 1.277522 1.277522
... | <python><matplotlib><colors> | 2023-12-15 09:00:24 | 1 | 303 | Weiss |
77,665,136 | 2,876,079 | How to set font for tick labels with openpyxl? | <p>I created an Excel chart using openpyxl. Now I try configure the font for the tick labels of the x axis. How to do it correctly?</p>
<p>Here is my current code:</p>
<pre><code>from openpyxl import Workbook
from openpyxl.chart import BarChart, Reference
from openpyxl.chart.text import RichText
from openpyxl.drawing.... | <python><excel><charts><openpyxl><styling> | 2023-12-15 08:42:21 | 1 | 12,756 | Stefan |
77,664,680 | 10,829,044 | Pandas convert raw hyperlink to clickable display in excel file | <p>I have a pandas dataframe with the below data</p>
<pre><code>data = {'product_id': [11,11,11,11],
'rec_prod_id':[12,13,14,15],
'product_URL': ['www.example.com','www.example4.com','www.example3.com','www.example2.com']}
data = pd.DataFrame(data)
</code></pre>
<p>My objective is to</p>
<ol>
<li><p>gro... | <python><pandas><excel><dataframe><list> | 2023-12-15 06:49:58 | 1 | 7,793 | The Great |
77,664,652 | 4,808,079 | How can I read input from a numpad while blocking its keystrokes in mac os? | <p>This person has a similar project but for linux: <a href="https://unix.stackexchange.com/questions/343305/disable-keyboard-but-still-allow-reading-from-it">https://unix.stackexchange.com/questions/343305/disable-keyboard-but-still-allow-reading-from-it</a></p>
<p>What I'm trying to do is make a numpad act like a la... | <python><node.js><macos><keystroke><event-capturing> | 2023-12-15 06:42:57 | 1 | 11,464 | Seph Reed |
77,664,391 | 9,542,989 | Python Mocking in Complex Class Structure | <p>I am writing a unit test (with mocking) that looks like this,</p>
<pre><code>def test_1(self):
# define the chat data to return
chat_data = {
'@odata.context': 'test_context',
'id': 'test_id',
'topic': None,
'createdDateTime': '2023-11-20T10:25:19.553Z',
'lastUpdatedDa... | <python><unit-testing><mocking><python-unittest> | 2023-12-15 05:23:25 | 1 | 2,115 | Minura Punchihewa |
77,664,365 | 23,002,898 | In Tkinter, i can't see the vertical scrollbar in an external file | <p>If i select <code>Tab2</code>, i would like to see the vertical scrollbar in the my <code>Verticalbar</code>, but i can't see the vertical scrollbar (in an external file <code>x.py</code>). I specify that the verticalbar is located outside the tabcontrol. Must stay out of tabcontrol. I don't get any errors</p>
<p><a... | <python><python-3.x><tkinter><canvas> | 2023-12-15 05:11:47 | 1 | 307 | Nodigap |
77,664,284 | 414,127 | Flask blueprints with SQLAlchemy for APIs -- what can I do to simplify? | <p>I am designing an app that has a database, a CRUD web interface to manage its content, and exposing a REST API to be called by an external UI written in React. I am using native Flask Blueprints, SQLAlchemy, along with Marshmallow for API serialization.</p>
<p>The way I have structured Blueprints, based on what I le... | <python><rest><flask><sqlalchemy> | 2023-12-15 04:37:09 | 1 | 14,208 | Tom Harrison |
77,664,264 | 4,451,521 | Is there a way to set the legends of matplotlib subplots out of the plot? | <p>Right now I have a plot with two subplots
The problem is that in each subplot I put many traces with different colors so when I put the legend, it covers up some of the points.</p>
<p><a href="https://i.sstatic.net/TZDbr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TZDbr.png" alt="enter image descr... | <python><matplotlib> | 2023-12-15 04:30:52 | 1 | 10,576 | KansaiRobot |
77,664,095 | 2,955,827 | What are the differences between `pipx` and `pip --user`? | <p>I have tried to install any Python packages on <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_24.04_LTS_(Noble_Numbat)" rel="nofollow noreferrer">Ubuntu 24.04</a> (Noble Numbat), but I found I cannot do that as in <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_22.04_LTS_(J... | <python><pip><pipx> | 2023-12-15 03:14:54 | 2 | 3,295 | PaleNeutron |
77,664,085 | 2,414,957 | installing easydict in bundled Python 3.5 in Blender 2.79a in Ubuntu 22.04 using pip | <p>I am not sure if this is a fixable error in Ubuntu 22.04? Blender 2.79a is the non-negotiable here but I am open to using older versions of Ubuntu in docker. Originally, [pvnet-rendering repo][1] used Ubuntu 16.04 which is now EOL.</p>
<pre><code>(pvnet-rendering) (base) mona@ada:~/pvnet-rendering$ pip install easyd... | <python><python-3.x><linux><pip><blender> | 2023-12-15 03:11:20 | 0 | 38,867 | Mona Jalal |
77,663,997 | 5,896,591 | pip2.7 in virtualenv: Python 2.7 reached the end of its life | <p>I created a virtual environment using this command:</p>
<pre><code>/usr/bin/python2.7 -m virtualenv venv
</code></pre>
<p>It mostly works, but using <code>venv/bin/pip2.7</code> prints the following warning:</p>
<blockquote>
<p>DEPRECATION: Python 2.7 reached the end of its life on January 1st,
2020. Please upgrade ... | <python><python-2.7><pip><virtualenv> | 2023-12-15 02:31:19 | 2 | 4,630 | personal_cloud |
77,663,904 | 4,451,521 | How to appropriately set the limit of the Axes in matplotlib | <p>I have a dataframe</p>
<pre><code>import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
data = {
'id': [1, 2, 3, 4, 5,6,7,8,9,10],
'LeftError': [0.1, 0.2, 0.15, 0.3, 0.25,-0.1, -0.2, -0.15, -0.3, -0.25],
'RightError': [0.2, 0.3, 0.25, 0.4, 0.35,-0.2, -0.3, -0.25, -0.4, -0.35],
'NCL'... | <python><matplotlib> | 2023-12-15 01:52:51 | 1 | 10,576 | KansaiRobot |
77,663,885 | 7,380,827 | Strange interaction of time.monotonic_ns and time.sleep | <p>I have noticed that there is some strange behaviour when <code>time.monotonic_ns</code> and <code>time.sleep</code> interact with each other in a small time period.</p>
<p>To investigate this I have wrote the following "test".</p>
<pre><code>import time
def main():
while True:
start = time.mon... | <python><time><sleep> | 2023-12-15 01:45:28 | 1 | 534 | Twistios_Player |
77,663,860 | 1,509,264 | Override return value in str subclass | <p>I am trying to write a string-like class that acts like <code>str</code> but takes the value from the attribute of an object where that value has not been set yet but will have been set before the string-like object is read from.</p>
<pre class="lang-python prettyprint-override"><code>from __future__ import annotati... | <python><python-3.x> | 2023-12-15 01:34:49 | 1 | 172,539 | MT0 |
77,663,834 | 825,227 | Issue with import tensorflow: SystemError: initialization of _pywrap_checkpoint_reader raised unreported exception | <p>Working on a Ubuntu 22.04 machine, within Spyder 3.9, with tensorflow 2.15 installed.</p>
<p>Simply trying to import the package, I run and return the following errors:</p>
<pre><code>import tensorflow as tf
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe
Traceback (most rece... | <python><tensorflow> | 2023-12-15 01:22:01 | 1 | 1,702 | Chris |
77,663,828 | 17,021,151 | Regex Difference between Ruby & Python | <p>I just started Advent of Code 2023 and am trying to use it to learn a few new programming languages. I have (some) familiarity with python, and literally just installed ruby today.</p>
<p>Day 1, part 2, I am using a Regex to search for digits as well as their spelled out versions. The regex in python (which yields t... | <python><ruby> | 2023-12-15 01:19:12 | 2 | 316 | jcodes |
77,663,755 | 1,657,666 | How pass "reason" when we use the HTTPException with FASTAPI? | <p>I have an API based on FAST API that, when something goes wrong raises the following exception.</p>
<pre><code> raise HTTPException(status_code=404, detail="There is no file to created a zip package. Check device name.")
</code></pre>
<p>As you can see I included the detail field, however, obser... | <python><fastapi><httpexception> | 2023-12-15 00:47:51 | 2 | 451 | user1657666 |
77,663,640 | 11,280,068 | Easiest way to automatically add new columns to MySQL database before calling pandas df.to_sql? | <p>I'm encountering an issue where I'm appending a dataframe to a table in my mysql database, but the number of columns in the dataset can be greater than or equal to the number of column currently in the database.</p>
<p>For example, the dataset and the table may both have 10 columns. The next time we want to export t... | <python><sql><mysql><pandas><dataframe> | 2023-12-14 23:56:11 | 1 | 1,194 | NFeruch - FreePalestine |
77,663,563 | 15,332,006 | Create or use a function to find the repeated sequence of items in a list | <p>I am trying to write a function that takes a list/array and finds the repeated sequence of numbers.</p>
<p>Examples:</p>
<ul>
<li><p><code>[111, 0, 3, 1, 111, 0, 3, 1, 111, 0, 3, 1]</code></p>
<p><code>[111, 0, 3, 1]</code> is the block that is being repeated and is what I'm looking for.</p>
</li>
<li><p><code>[11, ... | <python><loops><python-itertools><itertools-groupby> | 2023-12-14 23:24:28 | 1 | 451 | Rashiq |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.