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,115,778 | 9,221,448 | How to start a server on a remote machine? | <p>I'm trying to set up a cluster of EC2 instances that I can use for "big data" modeling. I'm trying to stay close to the metal and would prefer to not use existing frameworks (e.g. dask, DataBricks, etc).</p>
<p>I am able to stand up the instances using boto3, and I'm using paramiko to SSH and copy files t... | <python><bash><amazon-ec2><boto3><paramiko> | 2023-09-15 23:27:08 | 1 | 505 | Steven Scott |
77,115,609 | 9,900,084 | Format time axis to only display tick labels after a certain date | <p>I am attempting to format the time axis in subplots so that the xtick label appears only after the start of the data.</p>
<pre><code>import pandas as pd
import numpy as np
from datetime import date
import matplotlib.pyplot as plt
from matplotlib.dates import MonthLocator, num2date
from matplotlib.ticker import Func... | <python><matplotlib> | 2023-09-15 22:20:43 | 1 | 2,559 | steven |
77,115,542 | 2,975,438 | AgentExecutor and ModuleNotFoundError/NameError | <p><code>AgentExecutor</code> should be able to install python packages.</p>
<p>Here is code snippet:</p>
<pre><code>from langchain.agents import ConversationalChatAgent, AgentExecutor
from langchain.agents import Tool
from langchain.agents import create_pandas_dataframe_agent
from langchain.chat_models import AzureCh... | <python><langchain> | 2023-09-15 21:58:50 | 1 | 1,298 | illuminato |
77,115,394 | 6,658,422 | How to change the headings and column numbers in a pysimplegui Table element | <p>I cannot find out how I can update the headings in a Table element or change the number of columns.</p>
<p>I tried creating two table elements and switching them, but that did not work.</p>
<pre><code>import PySimpleGUI as sg
values = [["John Doe", 30], ["Jane Doe", 25], ["Peter Smith"... | <python><pysimplegui> | 2023-09-15 21:16:57 | 1 | 2,350 | divingTobi |
77,115,274 | 13,968,392 | copy a dataframe to new variable with method chaining | <p>Is it possible to copy a dataframe in the middle of a method chain to a new variable?
Something like:</p>
<pre><code>import pandas as pd
df = (pd.DataFrame([[2, 4, 6],
[8, 10, 12],
[14, 16, 18],
])
.assign(something_else=100)
.div(2)
.cop... | <python><pandas><method-chaining> | 2023-09-15 20:46:27 | 3 | 2,117 | mouwsy |
77,115,046 | 13,562,186 | JVM DLL not found. FileNotFoundError: [Errno 2] | <p>Trying to explore using Tabula in python on a PDF in Visual Studio code on MacOS.</p>
<pre><code>import pandas as pd
import tabula
dfs = tabula.read_pdf("/Users/TEST.pdf", pages = 1)
len(dfs)
</code></pre>
<p>When I run the code however I get the following error:</p>
<p>FileNotFoundError: [Errno 2] JVM DLL... | <python><java><visual-studio-code><dll><jvm> | 2023-09-15 19:56:52 | 1 | 927 | Nick |
77,115,016 | 10,227,815 | how to mock in python API testing | <p>I'm trying to mock a sample function below. Somehow I'm getting error.
For example,
I've a class as below <code>myclass.py</code>:</p>
<pre><code>import os, requests
class MyClass:
def __init__(self, login_url):
self.username = os.environ.get('username')
self.password = os.environ.get('password'... | <python><unit-testing><mocking><python-unittest><python-unittest.mock> | 2023-09-15 19:50:14 | 2 | 303 | SHM |
77,114,915 | 226,081 | python: how to use type annotations and docstring formats together | <p>Now that we have type annotations in Python, I'm wondering how to document code with type annotations AND docstring formats.</p>
<p>Specifically, it seems redundant to specify the argument types as an annotation AND <code>:type:</code> in the docstring, as in the restructured text format example below. The descripti... | <python><python-typing><docstring> | 2023-09-15 19:25:44 | 1 | 10,861 | Joe Jasinski |
77,114,887 | 239,801 | How can I fix this mypy "Incompatible return value type" for my Enum like class in my Python project? | <p>In our project we never use Enum we use SimpleEnum which is defined like this:</p>
<pre><code>class SimpleEnum:
@classmethod
def values(cls):
return {
getattr(cls, name)
for name in dir(cls)
if not name.startswith("_") and not callable(getattr(cls, name))... | <python><python-3.x><mypy> | 2023-09-15 19:18:58 | 2 | 23,198 | AlexV |
77,114,815 | 5,378,816 | Pylint is not suggesting the walrus operator. Why? | <p>I was going to ask if there is a pylint-style code analyzer capable of suggesting the use of the <code>:=</code> operator in places were it might improve the code. However, it looks like such test has been added to the <code>pylint</code> two years ago -> <a href="https://github.com/pylint-dev/pylint/pull/4876" r... | <python><pylint><python-assignment-expression> | 2023-09-15 19:07:11 | 1 | 17,998 | VPfB |
77,114,575 | 22,466,650 | How to consider the nesting level when looping through a nested list? | <p>My input is a nested list :</p>
<pre><code>data = ['aaa', ['eee', ['ccc', 'zzz', ['fff']], 'yyy']]
</code></pre>
<p>And I need to rearange it in a very specific way. Let me put some comments to explain the logic :</p>
<pre><code>expected_output = [
['aaa', 'eee'], # bcz eee is the first non-list item inside the ... | <python> | 2023-09-15 18:11:23 | 4 | 1,085 | VERBOSE |
77,114,567 | 16,717,009 | How do i obtain a key, value pair from a python dictionary referencing by a specific key | <p>Am I missing something obvious?
Given d = {'a': 1, 'b': 2, 'c': 10}
how do I get
{'b': 2} or even ('b', 2) or ['b', 2] just by providing 'b'?
Using a comprehension to iterate through the whole dictionary seems wildly inefficient and unnecessary since the whole point of a dictionary is to provide quick access by key.... | <python><dictionary> | 2023-09-15 18:09:52 | 2 | 343 | MikeP |
77,114,481 | 210,388 | Capturing inner string in lark using regex | <p>Ok, so, this is probably a bit convoluted solution and I should probably use something simple, but it is what is.</p>
<p>I have a huge text I want to parse using python's lark and I'm piecing together certain parts, and now I'm trying to get the text within the quotes.</p>
<p>Using regex that would be something like... | <python><python-3.x><lark-parser> | 2023-09-15 17:53:19 | 0 | 393 | thevoiddancer |
77,114,363 | 2,148,414 | Snowpark UDF with Row input type | <p>I would like to define a Snowpark UDF with input type <a href="https://docs.snowflake.com/en/developer-guide/snowpark/reference/python/latest/api/snowflake.snowpark.Row" rel="nofollow noreferrer">snowflake.snowpark.Row</a>.
The reason for this is that I would like to mimic the <code>pandas.apply</code> approach
wher... | <python><snowflake-cloud-data-platform><user-defined-functions> | 2023-09-15 17:32:51 | 2 | 394 | user2148414 |
77,114,354 | 11,163,122 | Getting base Python interpreter in Makefile on Windows or POSIX | <p>I am trying to make a <code>Makefile</code> that has the path to system Python in an environment variable, that works on Windows and POSIX systems.</p>
<p>The below works on macOS and Windows WSL, but if you have a virtual environment activated, it returns the <code>venv</code>'s path (not system Python's path):</p>... | <python><windows><macos><makefile><gnu-make> | 2023-09-15 17:31:23 | 1 | 2,961 | Intrastellar Explorer |
77,114,337 | 1,584,906 | What does the "RuntimeError: Cannot enter into task ... while another task ... is being executed" mean in Python? | <p>I'm trying to troubleshoot this error in a fairly complex Python 3.9 project with PyQt 5.15 and <code>qasync</code> (error sanitized for privacy):</p>
<pre><code>RuntimeError: Cannot enter into task <Task pending name='Task-11911' coro=<*** running at ***:454> cb=[asyncSlot.<locals>._error_handler() a... | <python><pyqt5><python-asyncio><qasync> | 2023-09-15 17:29:07 | 0 | 1,465 | Wolfy |
77,113,964 | 852,385 | Why does this Python list comprehension give list index out of range error | <pre class="lang-py prettyprint-override"><code>grid = [[]]
[j for j in range(len(grid[i])) for i in range(len(grid))]
</code></pre>
<p>gives <code>IndexError: list index out of range</code>.</p>
<p>I think <code>i</code> can be only <code>0</code> and <code>[j for j in range(len(grid[0]))]</code> runs fine without any... | <python><python-3.x> | 2023-09-15 16:21:03 | 1 | 4,232 | Helin Wang |
77,113,627 | 7,077,532 | Python Function: Loop Through a "Key:Value" Dictionary And Append The Last "Value" Word To an Output String Based on the Dictionary's Key | <p>Let's say I have the following dictionary:</p>
<pre><code>sorted_dict = {1: 'You', 2: 'teeth', 3: 'are', 4: 'mood', 5: 'test', 6: 'helpful'}
</code></pre>
<p>Each word is associated with a number and I want to arrange the words into a pyramid like the example below:</p>
<pre><code>1
2 3
4 5 6
</code></pre>
<p>The... | <python><function><loops><dictionary><number-sequence> | 2023-09-15 15:32:05 | 1 | 5,244 | PineNuts0 |
77,113,617 | 9,900,084 | Format time axis year as number and month as uppercase abbr | <p>I'm trying to find a way to format the datetime axis to display years as numbers and months as uppercase letters. Unfortunately, Python's <code>strptime</code> function doesn't provide uppercase month names (e.g. APR). I need to format it myself, but I haven't been able to figure out how. Since I only want to show A... | <python><matplotlib> | 2023-09-15 15:30:00 | 1 | 2,559 | steven |
77,113,589 | 5,722,359 | The `w.destroy()` method does not eradicate the `tkinter` widget? | <p>I submitted the following commands in the Python interpreter and discovered that the <code>w.destroy()</code> method of a <code>tkinter</code> widget does not eradicate (i.e. wipe out the existence of) the <code>tkinter</code> widget.</p>
<pre><code>>>> root=tk.Tk()
>>> a = ttk.Button(root, text=&q... | <python><tkinter><tcl> | 2023-09-15 15:25:40 | 1 | 8,499 | Sun Bear |
77,113,551 | 3,261,772 | TRL SFTTrainer - llama2 finetuning on Alpaca - datasettext field | <p>I am trying to finetune the Llama2 model using the alpaca dataset. I have loaded the model in 4-bit and apply the peft config to the model for Lora training. Then I am trying to do TRLβs SFTTrainer to fine-tune the model.</p>
<p>The train_dataset is</p>
<pre><code>Dataset({
features: ['instruction', 'input', 'o... | <python><large-language-model><llama> | 2023-09-15 15:18:13 | 1 | 1,205 | Hamid K |
77,113,251 | 1,020,139 | How to get the root directory of the project using pytest? | <p>I have defined the following fixture, which remove everything from the path after the root directory (<code>myapp</code>).</p>
<p>This is necessary as <code>pytest</code> changes the current directory (cwd), when executing the tests (why?).</p>
<p>However, this approach is not great, as it fails whenever more than o... | <python><pytest> | 2023-09-15 14:33:58 | 2 | 14,560 | Shuzheng |
77,113,157 | 718,057 | how to assign users during a data migration in django? | <p>I know this seems like it should be a no-brainer and should work without fail, but I am getting a crazy error during a migration which is currently running during pytest initialization.</p>
<p>The error I am getting is:</p>
<pre><code>ValueError: Cannot assign "<User: redshred_default_contact>": &quo... | <python><django><django-rest-framework><pytest><pytest-django> | 2023-09-15 14:21:08 | 1 | 626 | Skaman Sam |
77,113,085 | 13,508,045 | Table reference in formula breaks excel file | <p>I want to use a formula for a cell. Inside the formula I reference a table called <code>tblTest</code>. After running the script I try to open the excel file but I get an error, that there are problems with the file and if it should be restored or not. So, it seems like the problem is because I reference a table.</p... | <python><excel><openpyxl> | 2023-09-15 14:11:14 | 0 | 1,508 | codeofandrin |
77,113,035 | 3,225,109 | Error when passing audio file to curl command for Whisper Open AI model | <p>Here is my <code>main.py</code> file</p>
<pre><code>from flask import Flask, request, jsonify
from transformers import pipeline
app = Flask(__name__)
# Create a pipeline for automatic speech recognition (ASR)
asr = pipeline("automatic-speech-recognition", model="openai/whisper-large")
@app.rou... | <python><huggingface-transformers><flac> | 2023-09-15 14:04:47 | 1 | 983 | Tomas.R |
77,113,019 | 6,665,586 | Create string enum from IntEnum | <p>I have an IntEnum like this</p>
<pre><code>class TransactionTypeIntEnum(IntEnum):
UNKNOWN = 0
ADMINISTRATIVE = 1
PAYMENT = 2
TRADE = 3
</code></pre>
<p>I want to create a string enum that has the same names of the IntEnum like this</p>
<pre><code>class TransactionType(Enum):
UNKNOWN = "UNKNO... | <python><enums> | 2023-09-15 14:02:38 | 1 | 1,011 | Henrique Andrade |
77,112,968 | 2,123,706 | Remove numerics in column prior to value_counts | <p>I have a string df. I want to find a quick summary of the string columns, and am using describe as below:</p>
<pre><code>df = pd.DataFrame({'col1':['1','2','C','T','A','00400'],
'col2':['3241','H2','C8','T4','123','0000']})
df['col1'].value_counts()
pd.to_numeric(df['col1'], errors='coerce').describe()... | <python><pandas><count> | 2023-09-15 13:56:16 | 3 | 3,810 | frank |
77,112,921 | 10,722,752 | how to get a function return multiple plots as output | <p>So I am performing a time series forecasting using XGBoost. I am using cross validation using TimeSeriesSplit. I am splitting my data into 6 folds.</p>
<p>The requirement is I need to write a function that can output 6 plots, one for each fold.</p>
<p>Sample Data:</p>
<pre><code>import pandas as pd
import numpy as n... | <python><pandas><matplotlib> | 2023-09-15 13:48:45 | 1 | 11,560 | Karthik S |
77,112,878 | 5,552,507 | Annotation in a plotly polar plot | <p>I'm trying to add annotations arrows to a plotly polar plot, but that produces another underlying cartesian plot:</p>
<p><a href="https://i.sstatic.net/ahPxw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ahPxw.png" alt="arrow added to cartesian plot not polar" /></a></p>
<p><strong>Question 1:</stro... | <python><plotly><polar-coordinates><polar-plot> | 2023-09-15 13:44:17 | 2 | 307 | PiWi |
77,112,728 | 8,869,570 | Is there a way to use os.path.exists with a wildcard string? | <p>I have a directory <code>dir</code> and inside the directory there may be files with filenames of the form:</p>
<pre><code>YYYY-MM-DD-data.db
</code></pre>
<p>where <code>YYYY-MM-DD</code> can be any year, month, day.</p>
<p>Usually I use <code>os.path.exists</code> to check for the existence of a path, but in this ... | <python> | 2023-09-15 13:21:58 | 1 | 2,328 | 24n8 |
77,112,343 | 2,051,392 | Wordpress won't run a python script but will execute shell commands | <p>Tried to keep it as simple as possible to understand what the problem is</p>
<p>Test.py</p>
<pre><code>print('It works')
</code></pre>
<p>TestPage.php</p>
<pre><code> /*
* Template Name: My Template
* Does stuff
* @package PackageName
* @author Author
* @copyright Copyright
*/
?>
<?php get_header()... | <python><php><wordpress> | 2023-09-15 12:23:47 | 1 | 9,875 | DotNetRussell |
77,112,120 | 329,829 | How to get non expanded matrix from sympy | <p>I have this sympy code:</p>
<pre><code># Define matrices and vectors using the more straightforward approach
A_matrix = sp.MatrixSymbol('A', 3, 2).as_explicit()
x_vector = sp.MatrixSymbol('x', 2, 1).as_explicit()
y_vector = sp.MatrixSymbol('y', 3, 1).as_explicit()
# Define the summation index symbol
i = sp.Symbol(... | <python><sympy> | 2023-09-15 11:47:45 | 1 | 5,232 | Olivier_s_j |
77,111,993 | 714,122 | Why is pip install libvirt-python failing and saying I need libvirt installed, even though libvirt is installed? | <p>I am running RHEL 9.2 with Python v3.9.16, and I am trying to install the <a href="https://pypi.org/project/libvirt-python/" rel="nofollow noreferrer">libvirt-python</a> Python package. I have tried installing using pip and pipenv, and I get the same error every time.</p>
<p>I have the libvirt and KVM packages insta... | <python><rhel><kvm><libvirt><rhel9> | 2023-09-15 11:30:22 | 0 | 1,135 | Dan Largo |
77,111,961 | 10,101,636 | Identify Duplicate and Non-Dup records in a dataframe | <p>I have a dataframe which contains both duplicate and distinct records in it. I have to identify which are the duplicate records and which are distinct records and split them separately in 2 different dataframes.</p>
<p>Input:</p>
<pre><code>custid | cust_name | loc | prodid
1234 | John | US | P133
1234 | J... | <python><dataframe><apache-spark><pyspark> | 2023-09-15 11:25:43 | 4 | 403 | Matthew |
77,111,916 | 403,425 | Django model validation which uses a ManyToMany field | <p>I have a model like this:</p>
<pre class="lang-py prettyprint-override"><code>class Offer(models.Model):
condition_products = models.ManyToManyField(
"shop.Product",
blank=True,
help_text="User needs to own at least one of these products.",
)
condition_owned_af... | <python><django><django-models><django-validation> | 2023-09-15 11:19:50 | 0 | 5,828 | Kevin Renskers |
77,111,904 | 7,128,910 | Azure http function times out when triggered by other function but works when triggered directly | <p>I have an Azure http function that almost always times out when called by another Azure function but always works when called directly. More info:</p>
<p>I have two Azure functions in Python:</p>
<ul>
<li>a time triggered (scheduled) function</li>
<li>an http triggered function</li>
</ul>
<p>The time triggered funct... | <python><azure><azure-functions> | 2023-09-15 11:17:16 | 1 | 1,261 | Nik |
77,111,774 | 22,466,650 | How to hide horizontal monotonic sequence of numbers? | <p>My input is <code>df</code> :</p>
<pre><code> COLUMN_1 COLUMN_2 COLUMN_3 COLUMN_4
0 0 1 0 2
1 1 1 2 3
2 1 2 3 2
3 1 2 4 5
4 4 5 8 8
</code></pre>
<p>And... | <python><pandas> | 2023-09-15 10:57:16 | 2 | 1,085 | VERBOSE |
77,111,770 | 6,734,243 | How to find subdependency version? | <p>In the pydata-sphinx-theme, we realized that Sphinx version is pinned to 5.3.0 when the latest one is 7.0.2 (<a href="https://github.com/pydata/pydata-sphinx-theme/issues/1441" rel="nofollow noreferrer">https://github.com/pydata/pydata-sphinx-theme/issues/1441</a>).</p>
<p>We checked that we are not pinning it in ou... | <python><dependencies> | 2023-09-15 10:56:51 | 1 | 2,670 | Pierrick Rambaud |
77,111,647 | 2,011,659 | Why does default argument have a value that is not given explicitly? | <p>I have this minimal example:</p>
<pre class="lang-py prettyprint-override"><code>class Foo:
def __init__(self, args = []):
print(args)
self.data = args
for _ in range(2):
foo = Foo()
foo.data.append(True)
</code></pre>
<p>I would expect that variable <code>foo</code> gets assigned a fres... | <python> | 2023-09-15 10:34:27 | 0 | 1,249 | user2011659 |
77,111,621 | 6,884,119 | Create Google Calendar invites using service account securely | <p>I created a service account using my Enterprise Google Workspace account and I need to automate calendar invites creation using Python.</p>
<p>I have added the service account email into the calendar's shared people and when I try to get the calendar using <code>service.calendarList().list().execute()</code> it work... | <python><google-cloud-platform><google-calendar-api><google-api-python-client><service-accounts> | 2023-09-15 10:29:50 | 2 | 2,243 | Mervin Hemaraju |
77,111,486 | 5,422,354 | How to plot a tree in Python with node labels? | <p>I would like to reproduce the following figure using any tool in Python:</p>
<p><a href="https://i.sstatic.net/eVhQS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eVhQS.png" alt="A tree with node labels" /></a></p>
<p>(This is a part of figure 5 page 75 in [^Furnival1974] that I created using Inksca... | <python><plot><tree> | 2023-09-15 10:08:37 | 1 | 1,161 | Michael Baudin |
77,111,482 | 4,245,446 | Calling a common function across multiple files in a directory in Python | <p>I have a python project with the following structure</p>
<pre><code>- my-project/
- my_project/
- __init__.py
- modules_charts/
- chart_a.py
- chart_b.py
- ...
- main.py
- poetry.lock
- pyproject.toml
- README.md
</code></pre>
<p>My goal is to have a dynamic <code>modules_charts... | <python><python-import><python-module> | 2023-09-15 10:08:05 | 1 | 13,964 | Weedoze |
77,111,471 | 3,127,087 | Why a python's yield does not require a 2nd call to resume? | <p>I have some python code :</p>
<pre class="lang-python prettyprint-override"><code># file: your_app/views.py
import contextlib
import inspect
from airium import Airium
from django.http import HttpResponse
@contextlib.contextmanager
def basic_body(a: Airium, useful_name: str = ''):
"""Works like ... | <python><python-3.x> | 2023-09-15 10:06:40 | 1 | 937 | arennuit |
77,111,446 | 1,584,915 | Ensuring that aio_pika consumer runs forever alongside FastAPI | <p>I wrote a <a href="https://aio-pika.readthedocs.io/en/latest/" rel="nofollow noreferrer"><em>aio_pika</em></a> consumer task that is supposed to run forever in a <a href="https://fastapi.tiangolo.com/" rel="nofollow noreferrer"><em>FastAPI</em></a> app. This task is part of a manager object which implement a <a href... | <python><python-asyncio><fastapi><pika><python-pika> | 2023-09-15 10:02:05 | 1 | 1,708 | DurandA |
77,111,442 | 4,417,894 | How to access a user defined QObject that is instantiated in another thread in python | <p>I've never had this issue using c++, but recently i've been using QML/PyQt5/Python and i've run across the following error:</p>
<pre class="lang-bash prettyprint-override"><code>QQmlEngine: Illegal attempt to connect to MyClass(0x1fd42731e50) that is in a different thread than the QML engine QQmlApplicationEngine(0x... | <python><qt><pyqt5><qml> | 2023-09-15 10:01:47 | 1 | 1,010 | emg184 |
77,111,377 | 20,088,885 | Why Do I get Odoo Server Error after creating XML files | <p>I get an error, so after adding my <code>views/xml</code> and enabling the super user to access the <code>custom module</code>. I get an error of</p>
<blockquote>
<p><code>RPC_ERROR Odoo Server Error</code></p>
</blockquote>
<p>I tried creating new database and account, change my odoo.conf</p>
<pre><code>[options]
;... | <python><odoo><erp> | 2023-09-15 09:51:28 | 0 | 785 | Stykgwar |
77,111,328 | 1,797,689 | How do I put a primary key constraint in BigQuery using the Python API? | <p>I am creating a BigQuery table using the Python API. I want to make <code>user_id</code> as the primary key. How do I add this constraint using the Python API?</p>
<pre><code>from google.cloud import bigquery
def create_table():
schema = [
bigquery.SchemaField("user_id", "STRING", mod... | <python><google-bigquery> | 2023-09-15 09:43:12 | 1 | 5,509 | khateeb |
77,111,224 | 1,410,969 | Find path of pip installed package, when it is no longer located at that path | <p>I install a package locally using</p>
<pre><code>python -m pip install -r requirements.txt
</code></pre>
<p>Now, a user (unintentionally) moves or renames a parent folder containing the package.</p>
<p>How can I find the path where the package was installed?</p>
<p>I have tried</p>
<ul>
<li><code>pip list</code></li... | <python><pip><requirements.txt> | 2023-09-15 09:30:33 | 1 | 613 | Atnas |
77,111,096 | 1,959,753 | Dask Distributed - Stateful global parameters shared by worker methods | <p>I am using Dask to setup a cluster. For now I am setting up both the scheduler and the workers on localhost.</p>
<pre><code>cluster = SSHCluster(["localhost", "localhost"],
connect_options={"known_hosts": None},
worker_options={"n_workers&quo... | <python><cluster-computing><dask><dask-distributed> | 2023-09-15 09:10:59 | 2 | 736 | Jurgen Cuschieri |
77,111,073 | 4,139,024 | How to add line breaks to all existing hover texts in a plotly figure | <p>I am computing a plotly figure in an external library, ie I have a function that return a fig object.</p>
<p>However, the hover texts are very long and i want to add line breaks. How can I do that?</p>
<p>The entire code is not so easy to reproduce, but I am using this:</p>
<pre class="lang-py prettyprint-override">... | <python><plotly> | 2023-09-15 09:07:48 | 0 | 3,338 | timbmg |
77,111,066 | 13,508,045 | Outer group removes multiple inner groups | <p>I want to have multiple groups on outline <code>level 1</code> and over these groups I want to have 1 group which is on outline <code>level 2</code>, like this:</p>
<p><a href="https://i.sstatic.net/ZkowQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZkowQ.png" alt="Groups Example" /></a></p>
<p>But... | <python><excel><openpyxl> | 2023-09-15 09:06:26 | 1 | 1,508 | codeofandrin |
77,111,050 | 1,640,614 | How to get the number of leaves and nodes in a trained sklearn.tree.DecisionTreeClassifier? | <p>I have trained a DecisionTreeClassifier and I would like to know how many leaves and nodes it has.</p>
| <python><scikit-learn><decision-tree> | 2023-09-15 09:03:58 | 1 | 2,272 | Ferro |
77,110,893 | 2,673,013 | LineCollection, PatchCollection redrawing | <p>I am trying to have a Jupyter notebook with a matplotlib plot in which a <code>LineCollection</code> and a <code>PatchCollection</code> (of circles) can be changed by a slider:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection, CircleCollection, Patch... | <python><matplotlib><jupyter-notebook> | 2023-09-15 08:40:19 | 1 | 343 | Stefan Witzel |
77,110,748 | 2,998,077 | To extract texts in selected page(s) from PDF | <p>By the use of pdfminer / pdfminer.six, I wish to extract the texts in pdf.</p>
<p>When trying to extract the texts on selected page(s) only, it gives an error:</p>
<pre><code>AttributeError: 'generator' object has no attribute 'seek'
# from this line "parser = PDFParser(page_selected)"
</code></pre>
<p>Wha... | <python><pdf><extract><pdfminer><pdfminersix> | 2023-09-15 08:20:55 | 1 | 9,496 | Mark K |
77,110,705 | 12,415,855 | Scrolling down with selenium on website not possible? | <p>i try to scroll down on a website using selenium with the following code:</p>
<pre><code>import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
if __name__ == '__main__':
os.environ['WDM_LOG'] = '0'
options = Options()... | <python><selenium-webdriver> | 2023-09-15 08:14:12 | 1 | 1,515 | Rapid1898 |
77,110,563 | 12,711,388 | How to set heatmap to grayscale and annotate with a mask | <p>I have a matrix A:</p>
<pre><code>A = np.array([[ 0. , 0.00066748, -0.00097412, -0.00748846, 0.00305338],
[-0.00157652, 0. , 0.0048117 , 0.01069083, -0.0137888 ],
[-0.00713212, -0.00170574, 0. , 0.00096385, 0.00212367],
[-0.00186541, 0.00351104, -0.00590608, 0. ... | <python><matplotlib><seaborn><heatmap><grayscale> | 2023-09-15 07:50:21 | 2 | 377 | user9875321__ |
77,110,560 | 16,420,204 | Polars: Calculate time difference from first element in each group of consecutive labels | <p>I have a <code>polars.DataFrame</code> like:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.from_repr("""
βββββββββββββββββββββββββββ¬ββββββββββ
β timestamp β group β
β --- β --- β
β datetime[ΞΌs, UTC] β str β
ββββββββββ... | <python><dataframe><datetime><group-by><python-polars> | 2023-09-15 07:50:01 | 3 | 1,029 | OliverHennhoefer |
77,110,540 | 21,534,356 | 'HttpClient' object has no attribute 'execute' clickhouse python | <p>I'm trying to execute a command with Clickhouse client in Python as I have seen it in the document but it keeps give me an error
'HttpClient' object has no attribute 'execute'</p>
<pre><code>from clickhouse_driver import Client
CLICKHOUSE_CLOUD_HOSTNAME = 'localhost'
CLICKHOUSE_CLOUD_USER = 'username'
CLICKHOUSE_CL... | <python><clickhouse> | 2023-09-15 07:46:47 | 0 | 360 | ali heydarabadii |
77,110,144 | 10,712,335 | How to set the `running` attribute of concurrent.future.Future() object | <p>To learn the usage of asyncio, I have written the following code:</p>
<pre><code>class MultiProcessor:
def __init__(self, n) -> None:
self._loop = asyncio.new_event_loop()
self._bg_thread = Thread(target=loop_forever, args=(self._loop, ), daemon=True)
self._bg_thread.start()
def s... | <python><python-3.x><python-asyncio> | 2023-09-15 06:40:14 | 1 | 489 | Lionnel104 |
77,110,088 | 5,357,095 | Python function to create an oracle db insert prepared statement | <p>I'm trying to insert some a record into Oracle DB table. I build a DB connector in python and have the required functions to build prepared statements, however the insert keeps failing with the error:</p>
<p><code>"oracledb.exceptions.DatabaseError: DPY-4009: 0 positional bind values are required but 13 were pr... | <python><oracle-database> | 2023-09-15 06:28:27 | 1 | 877 | Alex Bloomberg |
77,109,805 | 13,443,954 | How to use locator in evaluate's javascript in Playwright python | <p>I have the following script running:</p>
<pre class="lang-py prettyprint-override"><code>def test_combobox_selected_by_label(page):
page.goto("http://www.tizag.com/htmlT/htmlselect.php")
element = page.get_by_role("combobox")
element.select_option("Colorado -- CO")
sele... | <javascript><python><playwright><playwright-python> | 2023-09-15 05:23:28 | 1 | 333 | M AndrΓ‘s |
77,109,773 | 14,154,784 | Why Are Some Beautiful Soup Elements Accessed Using Dictionary Syntax But Others Using Object Syntax? | <p><strong>Context:</strong> I have the following little query in Beautiful Soup, and then build a list comprehension full of tuples from it. It works great:</p>
<pre><code>tags = soup.find_all('span', {'class': 'tags-links'})
title_text_list = [(tag['title'], tag.text) for tag in tags]
</code></pre>
<p><strong>Questio... | <python><html><web-scraping><beautifulsoup><syntax> | 2023-09-15 05:15:47 | 1 | 2,725 | BLimitless |
77,109,565 | 3,862,607 | Python3 Multiprocessing, Mac Out Of Application Memory For Linear Search Using 4 Cores | <p>I am writing a program to run a linear search using multiple processes versus using a single process</p>
<p>When I run the following program I wrote, it pops up an error on my Mac it says "Out of Application Memory" and it doesn't even seem to start the first process.</p>
<p><a href="https://i.sstatic.net/... | <python><multithreading><parallel-processing><multiprocessing> | 2023-09-15 04:12:03 | 1 | 1,899 | Drew Gallagher |
77,109,554 | 219,153 | Simple MQTT subscriber using Python paho-mqtt works on LInux, but fails on Windows 11 | <p>This Python 3.11 script:</p>
<pre><code>import paho.mqtt.client as mqtt
def onMQTT(client, userdata, message):
print(message.payload)
if __name__ == '__main__':
topic = 'top'
client = mqtt.Client()
client.connect('localhost', 1883)
client.message_callback_add(topic, onMQTT)
(result, mid) = client.subsc... | <python><linux><windows><mqtt> | 2023-09-15 04:08:45 | 1 | 8,585 | Paul Jurczak |
77,109,398 | 3,419,510 | Failing to Import Files Compiled from Protobuf in Python | <p>My directory structure is as follows:</p>
<pre><code> test
|-test.py
|-test.proto
|-test_pb2.py
|-__init__.py
|-comm
|-comm.proto
|-comm_pb2.py
|-__init__.py
</code></pre>
<p>both __init__.py is empty
and <strong>test.proto</strong> is like this:</p>
<pre><code>package test;
import "comm/comm... | <python><protocol-buffers><protobuf-python> | 2023-09-15 03:15:09 | 1 | 357 | charlie |
77,108,948 | 2,023,445 | How can I debug a hang in polars? | <p>I have a python script that uses polars to scan through many thousands of parquet files in s3, do a join, and write the result to a local parquet file. Because of memory constraints, I have to run it in batches. It runs for an varying amount of time, and then just hangs. I can give a brief overview of the operations... | <python><python-polars> | 2023-09-14 23:55:31 | 2 | 324 | jsc |
77,108,738 | 4,414,359 | How to filter pandas DF on concatenation of columns? | <p>How to filter pandas DF on concatenation of columns?</p>
<p>For example:</p>
<pre><code>import pandas as pd
data = {'product_name': ['laptop', 'laptop', 'printer', 'tablet', 'desk', 'chair', 'chair', 'chair'],
'price': [1200, 1000, 150, 300, 450, 200, 100, 120],
'color': ['white', 'black', 'white', ... | <python><pandas> | 2023-09-14 22:39:06 | 1 | 1,727 | Raksha |
77,108,654 | 5,821,028 | How to convert y-axis tick label numbers to letters | <p>For the code:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
data = list(map(lambda n:str(n), np.random.choice(np.arange(1,50), 1000)))
fig, ax = plt.subplots(1,1)
sns.countplot(y=data,ax=ax)
ax.set_yticklabels(ax.get_yticklabels(), fontsize=5)
plt.show()
</code></pre>
<p>I ... | <python><matplotlib><seaborn><yticks><countplot> | 2023-09-14 22:15:12 | 2 | 1,125 | Jihyun |
77,108,531 | 17,309,108 | Is there realised solutions to unpack `stdin` as arguments? | <p>I would like to have the option to pass positional arguments via <code>stdin</code>. I have written my own <code>argparse.Action</code> subclass to overwhelm the problem, that does work, but it would be desirable to evade reinventing the wheel. Are there realised third-party or built-in solutions to automatically ha... | <python><python-3.x><stdin> | 2023-09-14 21:40:32 | 0 | 782 | Vovin |
77,108,320 | 7,700,802 | TypeError: can only join an iterable (testing invoking a SageMaker endpoint for computer vision classification) | <p>I built an out-of-box <a href="https://en.wikipedia.org/wiki/Convolutional_neural_network" rel="nofollow noreferrer">CNN</a> and deployed using AWS Step Functions. I have these custom functions for the endpoint:</p>
<pre><code>def input_fn(data, content_type):
'''
take in image
'''
if content_type ==... | <python><typeerror><amazon-sagemaker> | 2023-09-14 20:55:20 | 1 | 480 | Wolfy |
77,108,287 | 5,890,892 | Python connection error when called through docker | <p>I have this very simple python code:</p>
<pre><code>import psycopg2
postgres_credentials = {
"host": "postgres_mcdonalds",
"database_name": "postgres",
"user": "postgres",
"password": "password"
}
filename = "FastF... | <python><postgresql><docker><docker-compose> | 2023-09-14 20:49:32 | 0 | 439 | victorcd |
77,108,230 | 774,133 | Plot multiple lines with plotnine | <p>Please consider this code for plotting multiple lines:</p>
<pre><code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
x = [1,2,3]
y = [ [30, 4, 50], [300,400,500], [350,450,550] ]
plt.plot(x, y)
</code></pre>
<p>that produces:</p>
<p><a href="https://i.sstatic.net/0FjB1.png" rel="nofollow nor... | <python><plotnine> | 2023-09-14 20:36:57 | 2 | 3,234 | Antonio Sesto |
77,107,910 | 1,669,860 | Do parentheses in a class definition do anything? | <p>I accidentally included parentheses in my class definition:</p>
<pre><code>class Crawler():
# ...
</code></pre>
<p>It seems like I'm supposed to do this:</p>
<pre><code>class Crawler:
# ...
</code></pre>
<p>Do those erroneous parentheses do anything? Or does Python ignore them?</p>
| <python> | 2023-09-14 19:34:57 | 1 | 26,307 | Kayce Basques |
77,107,814 | 5,924,264 | try; finally without except? | <p>Suppose I'm doing some sql query:</p>
<pre><code>try:
some_cursor.execute(sql_query)
finally:
some_cursor.close()
</code></pre>
<p>Is there any difference from the above with:</p>
<pre><code>some_cursor.execute(sql_query)
some_cursor.close()
</code></pre>
<p>They seem equivalent since there's no exception hand... | <python><exception><try-catch> | 2023-09-14 19:16:37 | 1 | 2,502 | roulette01 |
77,107,787 | 9,415,280 | how iterate inside a tf.data.dataset for stacking the features | <p>starting with this code who is working properly.</p>
<pre><code># loading csv
dataset = tf.data.experimental.make_csv_dataset(
file_pattern=filename,
num_parallel_reads=2,
batch_size=128,
num_epochs=1,
label_name='streamflow',
select_columns=keep_columns,
shuff... | <python><tensorflow><tf.data.dataset> | 2023-09-14 19:11:40 | 1 | 451 | Jonathan Roy |
77,107,778 | 3,825,948 | Using a Load Balancer with Twilio for IVR App | <p>I'm architecting an IVR app that will be built using a Python framework (e.g. Flask, etc.). The app receives an audio stream from Twilio via Websockets when a user calls a designated number that is defined within the Twilio user dashboard. Concurrently, Twilio also makes POST requests to a webhook provided by me. Ho... | <python><websocket><twilio><load-balancing><ivr> | 2023-09-14 19:09:55 | 1 | 937 | Foobar |
77,107,764 | 4,575,197 | calculate the predicted value based on coefficient and constant in python | <p>i have the coefficients and the constant (alpha). i want to multiply and add the values together like this example. (it has to be done for 300000 rows)</p>
<blockquote>
<p>Prediction = constant + (valOfRow1 * col1) + (-valOfRow1 *
col2) + (-valOfRow1 * col3) + (valOfRow1 *
col4) + (valOfRow1 * col5)</p>
<p>Predicti... | <python><pandas><regression><prediction><coefficients> | 2023-09-14 19:08:01 | 2 | 10,490 | Mostafa Bouzari |
77,107,744 | 11,370,582 | Use NLP (NLTK) to identify groups of phrases in a python dataframe | <p>I have a table containing diagnosis information for a large group of patients. I would like to determine what the most common groupings of those diagnoses are, for example is it "Bloaty Head Syndrome" and "Slack Tongue", or "Broken Wind", "Chronic Nosehair" and "Corrugate... | <python><pandas><machine-learning><nlp><nltk> | 2023-09-14 19:04:49 | 1 | 904 | John Conor |
77,107,680 | 4,451,893 | Find all the rows in a pandas dataframe where list values repeat in a column | <p>I have a dataframe which looks something like this where I have already sorted it based on the <code>Page Count</code> and the column <code>Split Parties</code> contains list of elements</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>DocSetID</th>
<th>Duplicate Status</th>
<th>Page Coun... | <python><python-3.x><pandas><dataframe><data-analysis> | 2023-09-14 18:52:15 | 4 | 1,355 | sanster9292 |
77,107,614 | 11,725,056 | How to convert a string to Json (or dict) properly when it has "\uxxx", Emojis, LaTeX etc in Python? | <pre><code>X = """{"botResponse": "Great question! π So you want to find out if \( \sqrt{44} \) is closer to 6 or 7. Let's solve this together, step by step! π΅οΈββοΈ
Step 1: Find the squares of 6 and 7. So, \( 6^2 = 36 \) and \( 7^2 = 49 \).
Step 2: Now, observe that 44 is closer to 49 t... | <python><json><python-3.x><python-re> | 2023-09-14 18:41:02 | 1 | 4,292 | Deshwal |
77,107,483 | 4,418,481 | Change QHBoxLayout border color when widget clicked | <p>Im trying to create a simple Pyqt app that has a single button and a QVBoxLayout. When a user clicks on the button, I want it to add a row (QHBoxlayout) that has multiple widgets in it like QLineedit, QLabel, and a QButton. This way users can add multiple rows. Once the user clicks on any of those rows, i want the w... | <python><pyqt><qtstylesheets><pyqt6> | 2023-09-14 18:14:50 | 1 | 1,859 | Ben |
77,107,430 | 11,117,255 | ImportError: The 'enchant' C library was not found and maybe needs to be installed. New | <p>I want to import enchant, but I get this error</p>
<pre><code>Python 3.9.7 (default, Sep 16 2021, 08:50:36)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import enchant
Traceback (most recent ca... | <python><pyenchant><enchant> | 2023-09-14 18:05:20 | 1 | 2,759 | Cauder |
77,107,292 | 3,165,644 | Stream or chunk the huge text value from postgres using python psycopg2 (single row, single column) | <p>I am creating a huge SQL text dynamically using select statement which is more than 1GB. While executing SQL to read the column (one) value (generated SQL), the postgres fails to return the output.</p>
<pre><code>SQL Error [54000]: ERROR: out of memory
Detail: Cannot enlarge string buffer containing 1073741741 byt... | <python><postgresql><streaming><psycopg2> | 2023-09-14 17:42:50 | 1 | 603 | Mihir |
77,107,178 | 3,121,975 | Specify generic type based on constructor signature | <p>I have a function that takes a generic argument used for type-casting purposes (I know Python doesn't do those but humor me here). Essentially, this function can accept any type that has a constructor which can accept <code>self</code> alone. I want to do something like this:</p>
<pre><code>T = TypeVar("T"... | <python><typing> | 2023-09-14 17:25:12 | 1 | 8,192 | Woody1193 |
77,107,072 | 4,396,198 | Accessing Spotify User Data | <p>I have been reading through the docs trying to understand how I can see recently played tracks for other users. After reading the Authentication flow docs, I am still unclear on the general way to achieve this.</p>
<p>I have my client key and client secret. I understand I need the users to grant me access under the ... | <python><oauth><spotipy> | 2023-09-14 17:04:47 | 0 | 2,107 | Sam CD |
77,107,057 | 6,379,197 | make model_averaging exclusive in federated learning using Python Threads | <p>I am creating <code>num_of_clients</code> threads using the following code:</p>
<pre><code>sockets_thread = []
no_of_client = 1
all_data = b""
while True:
try:
for i in range(no_of_client):
connection, client_info = soc.accept()
print("\nNew Connection from {clien... | <python><multithreading><mutex><condition-variable><federated-learning> | 2023-09-14 17:01:56 | 1 | 2,230 | Sultan Ahmed |
77,107,049 | 3,121,975 | Handling multiple instances of Click CliRunner | <p>I had a project that used the <a href="https://click.palletsprojects.com/en/8.1.x/" rel="nofollow noreferrer">click</a> library for CLI commands. For testing purposes, I had created a fixture that looked like this:</p>
<pre><code>@pytest.fixture(scope="module", name="runner")
def fixture_cli_runn... | <python><testing><concurrency> | 2023-09-14 17:00:45 | 0 | 8,192 | Woody1193 |
77,107,012 | 3,292,006 | How do I find coverage for subprocesses under test? | <p>Consider the following simple program:</p>
<pre class="lang-py prettyprint-override"><code># thingy.py
import sys
print("ready")
for line in sys.stdin:
print(line, end='')
</code></pre>
<p>If I want to unit-test the program, I can stub out the side-effecting functions <code>ready</code> and <code>pri... | <python><pytest><coverage.py> | 2023-09-14 16:55:22 | 1 | 869 | Marcus Harrison |
77,106,975 | 9,571,463 | Python json.dumps() with writing JSON string to CSV | <p>I am writing to a CSV file, where one of the column values is a large JSON string. I am trying to understand how to escape the comma values in the JSON so it does not write them as individual columns in the CSV file.</p>
<p>I need this solution without using the traditional csv library as I want to understand the wr... | <python><json><csv> | 2023-09-14 16:48:57 | 1 | 1,767 | Coldchain9 |
77,106,926 | 4,451,315 | Non-hacky way to share a boolean state between classes? | <p>Say I have</p>
<pre class="lang-py prettyprint-override"><code>class Cat:
def __init__(self, var, n_calls=None):
self.var = var
if n_calls is None:
self.n_calls = []
else:
self.n_calls = n_calls
def greet(self):
if self.n_calls:
raise Value... | <python><class><inheritance><state> | 2023-09-14 16:44:02 | 2 | 11,062 | ignoring_gravity |
77,106,782 | 8,868,699 | removing back dots dir from path's prefix | <p>I have two paths.</p>
<p><code>path1 = /users/fida/data_lake/data/archived/09142023</code></p>
<p><code>path2 = /users/fida/data_lake/data/localpublished/SPTTES/End_to_End_Edit_Schedule/2022-08-03_11_22_03.kp</code></p>
<p>Output Im trying to get after combining both path is:
<code>/users/fida/data_lake/data/archiv... | <python><pathlib><os.path> | 2023-09-14 16:22:17 | 2 | 1,649 | Hayat |
77,106,702 | 6,460 | How do I correctly typehint `cv2` and `numpy` interaction? | <p>I'm trying to typehint the following code which is supposed to convert PNG images (as bytes) to NumPy arrays:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import cv2
def png_to_numpy(blob: bytes) -> np.typing.NDArray[np.uint8]:
nparr = np.frombuffer(blob, np.uint8)
return cv2.im... | <python><numpy><opencv><python-typing><mypy> | 2023-09-14 16:10:15 | 0 | 8,833 | Nikolai Prokoschenko |
77,106,669 | 12,040,751 | Limit memory in lru_cache | <p>I am using the <code>lru_cache</code> from the <code>functools</code> package. I would like to limit the memory that it is allowed to store, so that any data above say 100 MB is not stored.</p>
<p>I was going to define <code>maxsize</code> like so</p>
<pre class="lang-py prettyprint-override"><code>from functools im... | <python><caching><functools> | 2023-09-14 16:05:33 | 0 | 1,569 | edd313 |
77,106,576 | 1,914,781 | convert utc string to datetime | <p>Try below code to convert utc string to datetinme but not work:</p>
<pre><code>import pandas as pd
data = [
["2023-09-13T19:17:21.000Z"],
["2023-09-13T19:18:22.000Z"],
["2023-09-13T19:19:23.000Z"],
]
df = pd.DataFrame(data,columns=['ts'])
df['ts'] = pd.to_datetime(... | <python><pandas> | 2023-09-14 15:53:30 | 1 | 9,011 | lucky1928 |
77,106,442 | 4,744,055 | How to Store Java Epoch Long Value with Gremlin Python | <p>In my Apache Tinkerpop Gremlin based code I am using with AWS Neptune, need to share a timestamp field with Python based and Java based code bases in my project.
When I run the equivalent of the following code:</p>
<pre><code>from gremlin_python.process.traversal import Cardinality
g.addV("xyzzy").
proper... | <python><java><gremlin> | 2023-09-14 15:34:29 | 1 | 1,124 | Manabu Tokunaga |
77,106,304 | 536,262 | playwright force useragent for headless mode | <p>How can I force the useragent in playwright python?</p>
<p><a href="https://playwright.dev/python/docs/emulation#user-agent" rel="nofollow noreferrer">https://playwright.dev/python/docs/emulation#user-agent</a></p>
<pre class="lang-py prettyprint-override"><code>def run(playwright):
""" config for... | <python><playwright><playwright-python> | 2023-09-14 15:16:26 | 1 | 3,731 | MortenB |
77,106,224 | 3,834,415 | How do I manually invoke click CLIs from within a Python calling context with parameters? | <p>In order to set up automatic function aliases in <code>setuptools</code>, it's necessary to wrap all args in some kind of function. If I am using a click interface, I'll need some way to parameterize specific calls to the click interface in order to alias them.</p>
<hr />
<p>In a hello world format, how do I call a... | <python><python-click> | 2023-09-14 15:06:27 | 1 | 31,690 | Chris |
77,105,925 | 6,068,731 | Python multiprocessing - Should I create a new pool at each iteration or share it across iterations? | <p>I have a function with a while loop. At each iteration, I need to apply a function in parallel, to each row of a large array, and then I need to use the result of this for the rest of the iteration, to obtain a new array for the next iteration.</p>
<p>The details are not important, but I want to figure out if I shou... | <python><parallel-processing><multiprocessing><python-multiprocessing> | 2023-09-14 14:32:16 | 1 | 728 | Physics_Student |
77,105,871 | 11,814,273 | Permissions error in Docker even after giving user proper permissions | <p>If I run uWSGI as root I get an error:</p>
<pre><code>| *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
</code></pre>
<p>and rightfully so since it is unsafe.</p>
<p>So I create a user and give it permissions to the relevant folders:</p>
<pre><code>RUN adduser --disabled-password --gecos '' d... | <python><django><docker> | 2023-09-14 14:27:50 | 1 | 502 | Omri |
77,105,771 | 3,139,771 | Python relative imports behavior | <p>I have simplified my problem into this:</p>
<pre><code>βββ demo
β βββ mypkg
β β βββ a.py
β β βββ b.py
β β βββ api.py
β β βββ startserver.py
β βββ readme.md
</code></pre>
<p>a.py has =></p>
<pre><code>from b import name
def greeting():
return name()
</code></pre>
<p>b.py has =></p>
<pre... | <python><hug> | 2023-09-14 14:14:57 | 1 | 357 | Impostor Syndrome |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.