QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,408,640 | 86,137 | Problem with Python f-string formatting of struct_time | <p>I have the following code;</p>
<pre><code>oStat=os.stat(oFile)
print(time.strftime('%H:%M:%S', time.localtime(oStat.st_mtime)))
print(f"{time.localtime(oStat.st_mtime):%H:%M:%S}")
</code></pre>
<p>The first print statement works as expected; the f-string gives me:</p>
<pre><code> print(f"{time.loca... | <python><time><f-string> | 2024-04-30 12:51:38 | 2 | 524 | Hipponax43 |
78,408,251 | 2,192,488 | PyQt5: How to download icon for QWebEngineView? | <p>I keep on struggling with something as simple as showing a <code>favicon.ico</code> with PyQt5's <code>QWebEngineView</code>.</p>
<p>Both tracing and the testing server tell me that <code>pixmap</code> gets downloaded, but it simply does not show. Conversely, if I replace <code>pixmap</code> with a local filename, i... | <python><security><pyqt5><content-security-policy><qwebengineview> | 2024-04-30 11:39:50 | 1 | 32,046 | Serge Stroobandt |
78,408,226 | 5,660,533 | how to parse credit card expiration date format correctly using parser? | <p>I am using the parser from dateutil python package, it is working fine for most dates but there are many places where it is working randomly. One example is: in a date string as <code>5/23</code>, i am trying to mean May of 2023. But the parser parses this as <code>2024-05-23 00:00:00</code>. As you can see, it took... | <python><python-3.x><datetime><validation><parsing> | 2024-04-30 11:35:05 | 1 | 740 | Rohit Kumar |
78,408,063 | 1,472,474 | get current UTC posix timestamp in better resolution than seconds in Python | <p>I am trying to get a UTC posix timestamp in better resolution than seconds – milliseconds would be acceptable, but microseconds would be better. I need that as a synchronization for unrelated external counter/timer HW which runs in nanoseconds from 0 on powerup.</p>
<p>Which means I want some "absolute" t... | <python><time><utc><unix-timestamp> | 2024-04-30 11:03:41 | 1 | 5,587 | Jan Spurny |
78,407,966 | 4,111,177 | ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() when training CrossEncoder | <p>I'm (more or less) following the <a href="https://github.com/UKPLab/sentence-transformers/blob/master/examples/training/cross-encoder/training_quora_duplicate_questions.py" rel="nofollow noreferrer">Training_quora_duplicate_questions.py </a> example using my own data.</p>
<p>As I understood from the <a href="https:/... | <python><sentence-transformers> | 2024-04-30 10:45:52 | 1 | 2,263 | duarte harris |
78,407,951 | 5,368,122 | Null conversion error - polars.exceptions.ComputeError - pandera(0.19.0b3) with polars | <p>Note: you can install the specific pandera version using</p>
<blockquote>
<p>pip install pre 'pandera[polars]'</p>
</blockquote>
<p>We are trying a simple validation example using polars. We cant understand the problem or why it originates. But it throws <strong>polars.exceptions.ComputeError</strong> exception when... | <python><python-polars><pandera> | 2024-04-30 10:42:07 | 1 | 844 | Obiii |
78,407,858 | 13,942,929 | How do I create a constructor that would receive different types of parameters? | <p>I have this Point class. I want it to be able to recieve <code>double</code> and <code>SomeType</code> parameters.</p>
<p><code>Point.pxd</code>:</p>
<pre><code>from libcpp.memory cimport shared_ptr, weak_ptr, make_shared
from SomeType cimport _SomeType, SomeType
cdef extern from "Point.h":
cdef cppcl... | <python><cython><cythonize> | 2024-04-30 10:22:15 | 1 | 3,779 | Punreach Rany |
78,407,769 | 7,307,824 | Counting Values of columns in all previous rows excluding current row | <p>I'm currently learning Pandas and stuck with a problem.</p>
<p>I have the following data:</p>
<pre class="lang-py prettyprint-override"><code>labels = [ 'date', 'name', 'opponent', 'gf', 'ga']
data = [
[ '2023-08-5', 'Liverpool', 'Man Utd', 5, 0 ],
[ '2023-08-10', 'Liverpool', 'Everton', 0, 0 ],
[ '2023-08-14', ... | <python><pandas> | 2024-04-30 10:07:25 | 2 | 568 | Ewan |
78,407,608 | 102,221 | Why defining empty __new__(cls) method in python class prevent __init__ from running | <p>In next super-primitive code when <code>__new__</code> method is defined <code>__init__</code> method for created objects is not called.</p>
<pre><code>class NaiveSingleton:
def __new__(cls):
pass
def __init__(self):
print("NaiveSingleton init called")
</code></pre>
<p>so, call</p... | <python><singleton> | 2024-04-30 09:39:09 | 1 | 1,113 | BaruchLi |
78,407,603 | 10,309,712 | How to make XGBoost work in a hierarchical classifier | <p>I am trying to make <code>XGBoost</code> work with the hierarchical classifier package available <a href="https://github.com/globality-corp/sklearn-hierarchical-classification/tree/develop" rel="nofollow noreferrer">here</a> (repo archived).</p>
<p>I can confirm the module works fine with sklearn's random forest cla... | <python><machine-learning><scikit-learn><xgboost><hierarchical> | 2024-04-30 09:37:37 | 1 | 4,093 | arilwan |
78,407,539 | 15,045,363 | How to use a default module and inverter model when they are unknown in PVLib? | <p>Student doing his master's thesis in the field of phtovoltaic here, so I'm new to this topic. I'm creating an algo to detect and classify anomalies in PV systems using only the produced AC Power.</p>
<p>In the 1st step of my algo, I want to simulate the maximum clear sky AC Power of a PV system for anytime of the ye... | <python><pvlib> | 2024-04-30 09:25:09 | 1 | 865 | Maxime Charrière |
78,407,435 | 9,853,105 | Python Certificate error during TLS handshake to gmail SMTP server | <p>I write a client program which tries to send mail to Gmail SMTP server by <a href="https://docs.python.org/3/library/smtplib.html" rel="nofollow noreferrer"><code>smtplib</code></a> and <a href="https://docs.python.org/3/library/ssl.html#ssl-contexts" rel="nofollow noreferrer"><code>ssl.SSLContext</code></a> objects... | <python><smtp><gmail><ssl-certificate><cpython> | 2024-04-30 09:05:36 | 1 | 876 | T.H. |
78,407,327 | 2,566,198 | Multiprocessing python on NFS gets 'No such file or directory' from os.cwd() | <p>I've been troubleshooting a test case on an EL9 environment which behaves differently in an EL7 environment.</p>
<p>It's specifically:</p>
<ul>
<li>On an NFS mounts.</li>
<li>Occurs on our EL9 systems (5.14.0-362.18.1.el9_3.x86_64). Does not occur on any of our older Centos 7 systems (3.10 kernel various versions).<... | <python><linux><nfs> | 2024-04-30 08:46:19 | 1 | 53,584 | Sobrique |
78,407,270 | 22,538,132 | Rendering depth from mesh and camera parameters | <p>I want to render depth from mesh file, and camera parameters, to do so I tried <code>RaycastingScene</code> from open3d with this <a href="https://github.com/rpapallas/diff-dope/blob/ros-example/diffdope_ros/meshes/hope/bbq_sauce.ply" rel="nofollow noreferrer">mesh file</a> as follows:</p>
<pre class="lang-py pretty... | <python><rendering><raycasting><scene><open3d> | 2024-04-30 08:36:15 | 1 | 304 | bhomaidan90 |
78,407,264 | 7,692,855 | Python 3.10 cannot open shared object file librdkafka | <p>I am trying to upgrade a relatively simple Python app thats reads a Kafka Topic, processes and then calls the API.</p>
<p>Currently it is running in a docker container based on Python 3.8 on Ubuntu 20.04 LTS. I am looking to upgrade to Python 3.10 on Ubuntu 22.04 LTS.</p>
<p>The docker container builds without issue... | <python><python-3.x><ubuntu> | 2024-04-30 08:35:27 | 1 | 1,472 | user7692855 |
78,407,063 | 12,027,232 | Decorator / functionality for inheriting an arbitrary number of classes | <p>I want to create functionality for a data class to be able to inherit 0..N mix-ins in Python whilst still returning the original data class object.</p>
<p>I have a preliminarily working solution, albeit very ugly and not very pythonic.</p>
<pre><code>from typing import Any
from dataclasses import dataclass
@datacl... | <python><python-3.x><oop> | 2024-04-30 07:57:59 | 1 | 410 | JOKKINATOR |
78,406,864 | 4,373,805 | How to do groupby on multi index dataframe based on condition | <p>I have a multi index dataframe, and I want to combine rows based on certain conditions and I want to combine rows per index.</p>
<pre><code>import pandas as pd
# data
data = {
'date': ['01/01/17', '02/01/17', '03/01/17', '01/01/17', '02/01/17', '03/01/17'],
'language': ['python', 'python', 'python', 'r', '... | <python><pandas><dataframe><data-wrangling> | 2024-04-30 07:20:05 | 1 | 468 | Ezio |
78,406,847 | 14,132 | sqlalchemy: (how) can I return a function expression from process_bind_param in a custom type? | <p>I have a custom type for interfacing with <a href="https://mariadb.com/kb/en/inet6/" rel="nofollow noreferrer">INET6</a> in MariaDB, and from <code>process_bind_param</code> I want to return an SQL expression like this: <code>CAST('2001::ff' AS INET6)</code></p>
<p>I've tried this so far (slightly simplified):</p>
<... | <python><sqlalchemy> | 2024-04-30 07:15:54 | 0 | 12,742 | moritz |
78,406,689 | 14,105,638 | Finding the maximum value from a Random Forest Regression model in python | <p>I've been using random forest regression to calculate the Return On Ad Spend (ROAS) when the user gives the upper bound. My model takes in three input variables: the cost of TV, Radio and Newspaper ads. However, to find the most optimal value, I need to use a for loop to iterate through every dollar, which is time-c... | <python><machine-learning><regression><random-forest> | 2024-04-30 06:42:36 | 0 | 583 | l_b |
78,406,673 | 1,019,455 | SQLAlchemy filter on Query again got extra junk rows | <p>I have Django experience. Now I would like to try some DIY python packages to my mini project. I Here is my code.</p>
<p><code>models.py</code></p>
<pre class="lang-py prettyprint-override"><code>import enum
from datetime import date, datetime
from sqlalchemy import UniqueConstraint
from sqlmodel import Field, SQLM... | <python><sqlalchemy><fastapi> | 2024-04-30 06:40:06 | 1 | 9,623 | joe |
78,406,627 | 1,138,158 | Top2Vec model gets stuck on Colab | <p>I'm trying to implement Top2Vec on Colab. The following code is working fine with the dataset "https://raw.githubusercontent.com/wjbmattingly/bap_sent_embedding/main/data/vol7.json" available <a href="https://colab.research.google.com/github/wjbmattingly/python_for_dh/blob/main/04_topic_modeling/04_03_04_t... | <python><topic-modeling><top2vec> | 2024-04-30 06:28:37 | 0 | 423 | PS Nayak |
78,406,587 | 287,367 | GeoDataFrame conversion to polars with from_pandas fails with ArrowTypeError: Did not pass numpy.dtype object | <p>I try to convert a GeoDataFrame to a polars DataFrame with <code>from_pandas</code>. I receive an <em>ArrowTypeError: Did not pass numpy.dtype object</em> exception. So I can continue working against the polars API.</p>
<p>Expected outcome would be a polars DataFrame with the <code>geometry</code> column being typed... | <python><dataframe><geopandas><python-polars><pyarrow> | 2024-04-30 06:20:34 | 2 | 857 | Ahue |
78,406,512 | 480,118 | Pandas: multiindex group | <p>I have the following data:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd, numpy as np
data = [['id', 'date', 'b_field', 'a_field'],
['XYX', '01/01/2024', 100, 101],
['XYX', '01/02/2024', 200, 201],
['ABC', '01/01/2024', 300, 3... | <python><pandas> | 2024-04-30 06:01:17 | 3 | 6,184 | mike01010 |
78,406,109 | 424,957 | How to set xlim when save some frames to file by matplotlib in python? | <p>I use python and matplotlib to create bar chart race animation, the data is time series and keep update every day. I want only save updated frames to file, for example, the frames are 10460 unti yesterday, the video file created in one hour.
<a href="https://i.sstatic.net/V0XJfcnt.png" rel="nofollow noreferrer"><img... | <python><matplotlib-animation> | 2024-04-30 03:27:55 | 1 | 2,509 | mikezang |
78,406,108 | 10,964,685 | Update dmc slider text style - plotly dash | <p>How can the ticks be manipulated using dash mantine components? I've got a slider below, that alters the opacity of a bar graph. I know you can change the size and radius of the slider bar. But I want to change the fontsize, color of the xticks corresponding to the bar.</p>
<p>You could use the following css with <c... | <python><css><plotly><plotly-dash><mantine> | 2024-04-30 03:27:48 | 1 | 392 | jonboy |
78,406,082 | 2,705,757 | Playwright Python: expect(locator).to_be_visible() vs locator.wait_for() | <p>Is there a difference between <code>expect(locator).to_be_visible()</code> and <code>locator.wait_for()</code>? Should I prefer one over the other?</p>
<p>I've looked up the <code>__doc__</code>s:</p>
<ul>
<li><a href="https://playwright.dev/python/docs/api/class-locator#locator-wait-for" rel="nofollow noreferrer"><... | <python><playwright><playwright-python> | 2024-04-30 03:18:26 | 1 | 9,226 | AXO |
78,406,021 | 1,568,919 | pandas series get value by index with fill value if the index does not exist | <pre><code>ts = pd.Series({'a' : 1, 'b' : 2})
ids = ['a','c'] # 'c' is not in the index
# the result I want
np.array([ts.get(k, np.nan) for k in ids])
</code></pre>
<p>Is there a pandas native way to achieve this?</p>
| <python><pandas> | 2024-04-30 02:53:32 | 2 | 7,411 | jf328 |
78,405,885 | 8,954,291 | TQDM: Track loop inside ProcessPoolExecutor job | <p>I have some number of jobs that have been submitted to a <code>ProcessPoolExecutor</code>. I want to track the progress of each job with <code>tqdm</code>. However, when I run the code below, the progress bars constantly swap places. I believe this is because *handwavey asynchronicity explanation* but I don't know t... | <python><python-multiprocessing><tqdm> | 2024-04-30 01:52:16 | 0 | 1,351 | Jakob Lovern |
78,405,756 | 2,430,558 | how to run a chi-square goodness of fit test on fitting discrete probability distributions in Python | <p>I am trying to test the fit of several probability distributions on my data and perform a Maximum Likelihood estimation and KS test on the fit of each probability distribution to my data. My code works for continuous probability distributions but not for discrete (because they do not have a <code>.fit</code> object.... | <python><pandas><mle><probability-distribution> | 2024-04-30 00:49:10 | 0 | 449 | DrPaulVella |
78,405,638 | 14,890,683 | Pydantic Generic Basemodel Validation Error | <p>Pydantic <a href="https://docs.pydantic.dev/latest/concepts/models/#generic-models" rel="nofollow noreferrer">Generic BaseModels</a> fails unexpectedly when validating python instances but succeeds when validating the same data as a dictionary.</p>
<p>Python: 3.11.8
Pydantic: 2.7.1</p>
<p>Here is the Generic Model:<... | <python><pydantic> | 2024-04-29 23:57:32 | 1 | 345 | Oliver |
78,405,637 | 18,346,591 | Multiprocessing and connection pool error: cannot pickle 'psycopg2.extensions.connection' object | <p>I am trying to pass a db object that uses a connection pool in Postgres to another class object but I keep getting an error.</p>
<pre><code>if __name__ == "__main__":
cores = calculate_number_of_cores()
pretty_print(f"Number of cores ==> {cores}")
db_manager = DatabaseManager()
with ProcessPo... | <python><postgresql><parallel-processing><multiprocessing><connection-pooling> | 2024-04-29 23:57:30 | 1 | 662 | Alexander Obidiegwu |
78,405,479 | 12,240,037 | ArcGIS REST Map Services Data Query using geometry in Python | <p>I am attempting to access ArcGIS Map Services and query a dataset to only return records that intersect the boundary of a custom geometry I created. I have queried and downloaded data before using this script, but never using geometry. Do i simply add my <code>geometry_json</code> to the <code>Where</code> clause?</... | <python><json><rest><arcgis><arcpy> | 2024-04-29 22:47:25 | 1 | 327 | seak23 |
78,405,474 | 1,115,716 | Convert Word Docx to PDF headlessly? | <p>I'm currently using <code>doc2pdf</code> python library to convert some Word <code>docx</code> files to <code>pdf</code>.</p>
<pre><code>from docx2pdf import convert
docx_file = '/tmp/One_of_hundreds.docx'
file_ext = os.path.splitext(docx_file)[1]
if file_ext.lower() == '.docx':
# we'll need to convert this to ... | <python><docx2pdf> | 2024-04-29 22:46:21 | 0 | 1,842 | easythrees |
78,405,421 | 5,639,469 | Custom type for mongoengine field | <p>I create DDD project in python and domain entities are mapped 1-1 to mongodb models.</p>
<p>I have the following class</p>
<pre><code>class Experiment(Document, Entity):
id: ExperimentId = ExperimentId.Field(db_field='_id', primary_key=True, required=True)
name: ExperimentName = ExperimentName.Field(required... | <python><mongoengine> | 2024-04-29 22:21:53 | 0 | 330 | JaktensTid |
78,405,417 | 3,084,178 | Changing the color scheme in a matplotlib animated gif | <p>I'm trying to create an animated gif that takes a python graph in something like the plt.style.use('dark_background') (i.e black background with white text) and fades it to something like the default style (ie. white background with black text).</p>
<p><a href="https://i.sstatic.net/r76QU3kZ.gif" rel="nofollow noref... | <python><matplotlib><animation> | 2024-04-29 22:19:44 | 1 | 1,014 | Dr Xorile |
78,405,379 | 15,045,917 | How to pass on values when converting a recursive function to an iterative one with stack and while loop | <p><strong>EDIT:</strong> My initial recursive code was incomplete, as I did not multiply by <code>f(l, r)</code> the sum of the two recursive branches.</p>
<p>Given a function <code>f(l, r)</code> that computes something from the nodes <code>(l, r)</code> of a binary tree of height <code>max_height</code>, I want to c... | <python><loops><recursion><return><binary-tree> | 2024-04-29 22:06:52 | 2 | 393 | Epsilon Away |
78,405,285 | 14,674,494 | Python parallelism and /dev/ttyS0 sharing | <p>I don't know how to make those two functions (which are called in the code below at the end) parallel. If I do multitasking or multiprocessing I came across errors regarding multiple port access. If I use mutexes I come across issues regarding deadlocks - I tried to wrap the contents of those infinite whiles with lo... | <python><multithreading><serial-port><python-multithreading><gsm> | 2024-04-29 21:35:43 | 0 | 408 | pauk |
78,405,251 | 6,606,057 | Create dummy for missing values for variable in Python | <p>I have the following dataframe in:</p>
<pre class="lang-none prettyprint-override"><code> a
1 3
2 2
3 Nan
4 3
5 Nan
</code></pre>
<p>I need to recode this column so it looks like this:</p>
<pre class="lang-none prettyprint-override"><code> df_miss_a
1 0
2 0
3 1
4 0
5 1
</code></pre>
<p>I've tried:</p>
<pre><code>d... | <python><pandas><numpy><missing-data><recode> | 2024-04-29 21:26:42 | 1 | 485 | Englishman Bob |
78,405,194 | 480,118 | python muliprocessing: AttributeError: Can't get attribute <function_name> on module | <p>The following code:</p>
<pre><code>import numpy as np, pandas as pd
import multiprocessing, itertools, timeit
from functools import partial
processes = 5 * multiprocessing.cpu_count()
print(f'processes: {processes}')
pool = multiprocessing.Pool(processes=processes)
def calc(x, y):
return x+y
def calc_all():
... | <python><multiprocessing> | 2024-04-29 21:07:31 | 2 | 6,184 | mike01010 |
78,405,071 | 1,431,750 | Update a Column of a Matrix where each MongoDB document is a Row | <p>I'm storing matrices in MongoDB where each document is a row of values. Example of two <em>small</em> matrices but assume there are <em>thousands</em> of rows and columns:</p>
<pre class="lang-js prettyprint-override"><code>[
{ matrix_id: 123, row_id: 0, values: [1, 2, 3] },
{ matrix_id: 123, row_id: 1, values: ... | <python><arrays><mongodb><matrix><mongodb-query> | 2024-04-29 20:33:37 | 1 | 16,597 | aneroid |
78,404,611 | 6,645,617 | Extract very large zip file on AWS S3 using Lamda Functions | <p>I'm trying to read a very large zip file on a s3 bucket and extract its data on another s3 bucket using the code below as lambda function:</p>
<pre><code>import json
import boto3
from io import BytesIO
import zipfile
def lambda_handler(event, context):
s3_resource = boto3.resource('s3')
source_bucket = 'buc... | <python><python-3.x><amazon-web-services><amazon-s3><aws-lambda> | 2024-04-29 18:41:56 | 1 | 1,983 | Ali AzG |
78,404,495 | 10,430,394 | Finding faces with skimage.measure.marching_cubes returns in weird offset based on meshgrid limits | <p>A collegue of mine recently tried to visualise strain moduli using matplotlib. If you do not know what that is: Here's a link if you are interested. <a href="https://www.degruyter.com/document/doi/10.1524/zkri.2011.1413/html" rel="nofollow noreferrer">https://www.degruyter.com/document/doi/10.1524/zkri.2011.1413/htm... | <python><matplotlib><scikit-image><marching-cubes> | 2024-04-29 18:14:53 | 1 | 534 | J.Doe |
78,404,304 | 9,540,764 | py2app application is not working on other Macs, why? | <p>I have created an application using <code>py2app</code> and it's working perfectly on my Mac.<br>
Now, I have to send it to some friends. When they download it, either from Wetransfer or Google Drive or whatever, it doesn't work.<br>
It says <code>The app is damaged and can’t be opened. You should move it to the Tra... | <python><python-3.x><macos><py2app> | 2024-04-29 17:28:27 | 0 | 836 | User |
78,404,259 | 4,296,426 | Share database cursor across multiple threads with Celery | <p>I have a single worker in celery that uses sqlalchemy and takes an input table (in one db) and a output table (in another db) and it retrieves and transfers the data from one to the other.</p>
<p>I'd like to parallelize this across celery workers so that each worker is dealing with x/n-of-workers rows.</p>
<p>I know... | <python><sqlalchemy><celery> | 2024-04-29 17:19:02 | 0 | 1,682 | Optimus |
78,404,240 | 14,250,641 | Most efficient way to conditionally sample my large df | <p>I have a large DF (~35 million rows) and I am trying to create a new df by randomly sampling two rows from each unique cluster ID (~1.8 million unique cluster IDs)-- one row must have a label 0 and one row must have a label 1 (sometimes there is only one label, so I must check first if both labels are present withi... | <python><pandas><dataframe><numpy><sample> | 2024-04-29 17:13:22 | 1 | 514 | youtube |
78,404,170 | 3,003,605 | Logistic Regression Model - Prediction and ROC AUC | <p>I am building a Logistic Regression using statsmodels (statsmodels.api) and would like to understand how to get predictions for the test dataset. This is what I have so far:</p>
<pre><code>x_train_data, x_test_data, y_train_data, y_test_data = train_test_split(X, df[target_var], test_size=0.3)
logit = sm.Logit(
... | <python><scikit-learn><logistic-regression><prediction><roc> | 2024-04-29 16:59:04 | 1 | 385 | user3003605 |
78,404,121 | 4,324,329 | How to get the epoch value for any given Local Time with Time Zone & Daylight Saving Time in Python? | <p>I'm new to Python and I have a use case which deals with <code>datetime</code>. Unfortunately, the data is not in UTC, so I have to rely on Local Time, Time Zones & Daylight Savings. I tried with <code>datetime</code> & <code>pytz</code> to get the epoch value from <code>datetime</code>, but its not working ... | <python><datetime><timezone><dst><pytz> | 2024-04-29 16:49:34 | 1 | 367 | Sree Karthik S R |
78,404,120 | 6,260,154 | Having trouble with negative lookahead regex in python | <p>So, I have to match everything before the last open-close parenthesis and get that in group. And after the last open-close parenthesis try to get the value with some pattern, again in group.</p>
<p>This is my sample example:</p>
<pre><code>ID pqr () name:123.
</code></pre>
<p>And this is my regex:</p>
<pre><code>^(... | <python><regex> | 2024-04-29 16:49:05 | 1 | 1,016 | Tony Montana |
78,404,086 | 9,639,680 | Unexpected keyword argument 'constant_memory' | <p>I need to improve the performance of the Excel writer part of my code and referred to <a href="https://xlsxwriter.readthedocs.io/working_with_memory.html" rel="nofollow noreferrer">xlsxwriter</a> and <a href="https://pandas.pydata.org/docs/reference/api/pandas.ExcelWriter.html" rel="nofollow noreferrer">pandas</a> d... | <python><pandas><excel><xlsxwriter> | 2024-04-29 16:40:36 | 1 | 824 | nac001 |
78,404,048 | 1,403,546 | VSCode - How to set the working directory when running a python .py script? | <p>I'm new to VSCode and I can't find anywhere the answer to an easy question:</p>
<p><strong>how can I run a python script (let's say main.py) by creating configurations where I can set a specific working directory folder as well as arguments?</strong></p>
<p>I see that by default the working directory, when running a... | <python><visual-studio-code> | 2024-04-29 16:34:23 | 2 | 1,759 | user1403546 |
78,403,998 | 10,517,777 | How do I reduce the time to read parquet files with pandas and futures | <p><strong>Python version:</strong> 3.11.8</p>
<p><strong>Goal:</strong> Read 1.000 parquet files from Amazon bucket faster.</p>
<p><strong>Approach:</strong> I am using the libraries boto3 and pandas to read the parquet files. I could retrieve the files sequentially. However, I want to reduce the time reading the parq... | <python><pandas><parquet><concurrent.futures> | 2024-04-29 16:21:57 | 0 | 364 | sergioMoreno |
78,403,835 | 4,129,091 | ReadTheDocs sphix build error: index.rst not found | <p>I'm trying to build and publish documentation on ReadTheDocs from a github repo.</p>
<p>The build yields an error:</p>
<pre><code>Running Sphinx v7.3.7
making output directory... done
WARNING: html_static_path entry '_static' does not exist
building [mo]: targets for 0 po files that are out of date
writing output...... | <python><python-sphinx><read-the-docs> | 2024-04-29 15:51:30 | 0 | 3,665 | tsorn |
78,403,641 | 17,795,398 | `/` and `//` give different results for a multiple number | <p>This issue is difficulting my algorithm implementation:</p>
<pre><code>>>> -19.9871/2.8553
-7.0
>>> -19.9871//2.8553
-8.0
</code></pre>
<p>The second division should return <code>-7.0</code> also. I guess this is something related to floating point errors, do you know another way to get the expecte... | <python> | 2024-04-29 15:08:25 | 1 | 472 | Abel Gutiérrez |
78,403,564 | 3,447,228 | How to flag AI content in Teams botbuilder? | <p>According to the Microsoft Team's store validation guidelines, apps with AI-generated content need to flag which messages are AI generated.</p>
<p>According to the image which can ben seen <a href="https://learn.microsoft.com/en-us/microsoftteams/platform/assets/images/submission/teams-ai-library-description-guideli... | <python><botframework><microsoft-teams> | 2024-04-29 14:55:55 | 1 | 498 | user3447228 |
78,403,321 | 10,425,150 | Generate matrix with diagonal fill pattern | <p><strong>Input Data:</strong></p>
<pre><code>data = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
</code></pre>
<p><strong>Expected Output\need help with:</strong></p>
<p>The output should look something like this:</p>
<pre><code>[15]
[14, 13]
[12, 11, 10]
[9, 8, 7, 6]
[5, 4, 3, 2, 1]
</code></pre>
<p><strong>C... | <python> | 2024-04-29 14:14:41 | 3 | 1,051 | Gооd_Mаn |
78,403,311 | 10,985,257 | What is best practise for long running sudo commands? | <p>I have build a function, which calls sudo commands from python, because I don't want to run every command as sudo (I am pulling in the process data from a repo, which I control, but this could be an angle of attack I wanted to mitigate):</p>
<pre class="lang-py prettyprint-override"><code>streamer = SysStreamer
def... | <python><linux> | 2024-04-29 14:12:10 | 0 | 1,066 | MaKaNu |
78,403,222 | 2,723,494 | Application-Insight does not show page views either with Automatic Instrumentation or SDK instrumentation | <p>I'm deploying a web app in Azure, on a linux machine, using python, deploying as code. Per docs, I should be able to enable automatic instrumentation of Application Insights<a href="https://i.sstatic.net/BBFVOnzu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BBFVOnzu.png" alt="enter image descriptio... | <python><azure-web-app-service><azure-application-insights> | 2024-04-29 13:56:48 | 1 | 1,228 | user2723494 |
78,403,169 | 12,094,039 | No module named 'pyspark.resource' when running pyspark command | <p>I am trying to setup the Pyspark environment for the first time in my system. I followed all the instructions carefully while installing the Apache Spark. I am using Windows 11 system.</p>
<p>When I run the <code>pyspark</code> cmd, I got this error,</p>
<pre><code>Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 1... | <python><apache-spark><pyspark> | 2024-04-29 13:47:31 | 1 | 411 | Aravindan vaithialingam |
78,403,017 | 2,123,706 | have a list of week numbers, how can I find the days corresponding to it python | <p>I have a list of weeks for 2024: <code>wks = [2,3,4,5,6,7...18]</code></p>
<p>How can I extract the dates that correspond to each week, bearing in mind, that the week starts on a Tuesday?</p>
<p>As Jan 1, 2024 was Monday, I have no data
Jan 2, 2024 was Tuesday, and data starts generating, hence why I have no <code>w... | <python><date-range> | 2024-04-29 13:20:26 | 1 | 3,810 | frank |
78,402,835 | 19,299,757 | How to find elements using selenium from a UI that uses frames | <p>I am trying to automate a web UI that seems to be using frames. I am unable to locate some of the elements in that UI unlike other UI's that are developed without frame concept.
For eg: I am trying to click on a dropdown field. When I inspectd the field using "Firebug", I am see this html stack for this dr... | <python><selenium-webdriver> | 2024-04-29 12:46:40 | 1 | 433 | Ram |
78,402,507 | 2,475,195 | Random Forest - optimize for AUC or F1 score | <p>I am using random forest in <code>sklearn</code>, and my dataset is fairly unbalanced (20% positive class, 80% other class). Is there a way to make it train (optimize) for some metric that takes this into consideration, like AUC score or F1-score? Are there any tricks that I can use to nudge it in this direction?
So... | <python><machine-learning><scikit-learn><random-forest> | 2024-04-29 11:49:58 | 3 | 4,355 | Baron Yugovich |
78,402,469 | 7,556,091 | Why does the python version not match the banner display in juypterlab's console? | <p>In my shell, I create a new python 3.9.19 ipykernel environment:</p>
<pre class="lang-bash prettyprint-override"><code>$ ~/local/python/3.9/bin/python3 -m ipykernel install --user --name test_3dot9
Installed kernelspec test_3dot9 in /home/user/.local/share/jupyter/kernels/test_3dot9
$ jupyter kernelspec list
Availab... | <python><python-3.x><jupyter><jupyter-lab><python-venv> | 2024-04-29 11:43:54 | 0 | 1,896 | progquester |
78,402,392 | 2,853,298 | How to avoid string truncate coming from python print method to node js application | <p>I am running a python script from node JS application as</p>
<pre><code>const { spawnSync } = require('child_process');
const pythonProcess = await spawnSync(python3, [
scriptFilePath,
'methodNameToExecute',
PathList.toString()
]);
const result = pythonProcess.stdout?.toString()?.trim();
</code></pre>
<p>The p... | <python><node.js><python-3.x><child-process><spawn> | 2024-04-29 11:30:49 | 0 | 313 | Rajesh Kumar |
78,402,347 | 5,368,122 | pandera.errors.BackendNotFoundError with Pandas Dataframe | <pre><code>pandera: 0.18.3
pandas: 2.2.2
python: 3.9/3.11
</code></pre>
<p>Hi,</p>
<p>I am unable to setup the pandera for pandas dataframe as it complains:</p>
<pre><code>File "/anaconda/envs/data_quality_env/lib/python3.9/site-packages/pandera/api/base/schema.py",
line 96, in get_backend
raise Backe... | <python><pandas><pandera> | 2024-04-29 11:20:49 | 1 | 844 | Obiii |
78,402,246 | 22,054,564 | Microsoft.Azure.WebJobs.Script: WorkerConfig for runtime: python not found | <p>I have Function App of Python v2 and docker based.</p>
<p><strong>function_app.py</strong>:</p>
<pre><code>import logging
import time
import azure.functions as func
from selenium import webdriver
import chromedriver_autoinstaller
app = func.FunctionApp()
@app.schedule(schedule="0 * * * * *", arg_name=&qu... | <python><azure><docker><azure-functions> | 2024-04-29 11:01:21 | 1 | 837 | VivekAnandChakravarthy |
78,402,226 | 12,493,545 | How to package software with parallel imports? | <p>How can I package the following minimal example in such a way that <code>bar.py</code> is still able to import <code>foo.py</code>. Preferably, without needing to change the python code, but by passing something like <code>-m trend.bar</code> into <code>pyinstaller</code>.</p>
<h2>Minimal Example</h2>
<p>Given the s... | <python><pyinstaller><python-packaging> | 2024-04-29 10:55:07 | 0 | 1,133 | Natan |
78,402,207 | 5,489,190 | Pip/python unable to find boost under Windows 11 in virtual env | <p>I'm trying to install <code>vina</code> package in virtual conda environment. Everything goes fine until <code>pip install vina</code>. This ends with following error:</p>
<pre><code>error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [63 lines o... | <python><boost><pip><conda><mamba> | 2024-04-29 10:51:28 | 1 | 749 | Karls |
78,402,155 | 6,060,982 | Inconsistencies in Time Arithmetic with Timezone-Aware DateTime Objects in Python | <p>Surprisingly, time arithmetic is not handled as expected with pythons timezone aware objects. For example consider this
snippet that creates a timezone aware object at 2022-10-30 02:00.</p>
<pre class="lang-py prettyprint-override"><code>from datetime import datetime, timezone, timedelta
from zoneinfo import ZoneInf... | <python><datetime><timezone> | 2024-04-29 10:42:13 | 1 | 700 | zap |
78,401,909 | 14,860,526 | How to know if an object in a python module is imported or defined inside the module itself | <p>let's assume i have two python modules a, and b.</p>
<p>a.py:</p>
<pre><code>CONSTANT = 2
</code></pre>
<p>b.py:</p>
<pre><code>from a import CONSTANT
CONSTANT2 = 4
</code></pre>
<p>if i use</p>
<pre><code>b.__dict__
</code></pre>
<p>or</p>
<pre><code>inspect.getmembers(b)
</code></pre>
<p>I get CONSTANT and CONSTA... | <python><python-import> | 2024-04-29 10:01:20 | 1 | 642 | Alberto B |
78,401,894 | 15,498,094 | ThreadPoolExecutor submit method thread creation error | <p>I'm running a stream data processor on AWS ECS (EC2) by polling for messages in an SQS queue.</p>
<p>I use a ThreadPool as shown below (some of the code is omitted for brevity):</p>
<pre><code>def process_messages(self, messages):
executor = ThreadPoolExecutor()
success = 0
timed_out = False
thread_f... | <python><python-3.x><multithreading><amazon-ecs><python-multithreading> | 2024-04-29 09:59:11 | 0 | 446 | Vedank Pande |
78,401,778 | 11,829,398 | How to create a Pydantic type without a keyword argument? | <p>I'm working with a number of data types and often pass <code>data_type</code> as an argument to my functions/methods/classes. For type hinting, I've considered doing</p>
<pre class="lang-py prettyprint-override"><code>from typing import Literal
data_type: Literal["type1", "type2", "type3&qu... | <python><pydantic> | 2024-04-29 09:38:48 | 2 | 1,438 | codeananda |
78,401,689 | 1,020,139 | How can I combine two types in Python similar to using "&" in TypeScript? | <p>Say, I have two types <code>A</code> and <code>B</code>. How can I concatenate these types into a type that has all members of <code>A</code> and <code>B</code>?</p>
<p>In TypeScript I would use the <code>&</code> operator: <code>A & B</code>:</p>
<p><a href="https://ultimatecourses.com/blog/use-intersection... | <python> | 2024-04-29 09:23:46 | 2 | 14,560 | Shuzheng |
78,401,662 | 15,045,917 | Converting the following recursive binary tree traversal algorithm to an iterative one | <p>I would like to learn whether the following recursive code can be made more efficient by an iterative implementation, and if so, how such implementation can be done. It has been some years since I have actively coded, so I have forgot enough nomenclature that I don't think I can answer this question myself with the ... | <python><algorithm><recursion><optimization><binary-tree> | 2024-04-29 09:20:16 | 1 | 393 | Epsilon Away |
78,401,612 | 5,056,004 | Handling pre-release/development/local version of python packages w.r.t PEP440 | <p>I have a mono-repo where I have 2 python packages <strong>PackageA</strong>, <strong>PackageB</strong> where PackageB depends on PackageA~=1.0.1 (1.0.1 is the latest published version of PackageA)</p>
<p>When I develop in this mono-repo, I install these 2 packages in editable mode in a virtual environment, and as pa... | <python><version><python-packaging><monorepo> | 2024-04-29 09:10:19 | 0 | 628 | masih |
78,401,299 | 16,723,655 | How can adjust ylabel font location in matplotlib if they are attached? | <p><a href="https://i.sstatic.net/8MGw3wiT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8MGw3wiT.png" alt="![enter image description here" /></a></p>
<p>Here is my plot.</p>
<p>I tried rotation but it is still attach.</p>
<p>How can I detach of them and properly show them?</p>
<p>However, I also have ... | <python><matplotlib> | 2024-04-29 08:07:38 | 1 | 403 | MCPMH |
78,401,248 | 17,136,258 | How to handle a nested JSON? | <p>I have a problem. I have a nested <code>JSON</code> file:</p>
<pre class="lang-py prettyprint-override"><code>json_data = '''
{
"appVersion": "",
"device": {
"model": ""
},
"bef": {
"catalog": ""
},
... | <python><json><pandas> | 2024-04-29 07:59:04 | 3 | 560 | Test |
78,401,161 | 5,786,649 | Hydra / OmegaConf: interpolation of config groups | <p>Is it possible to interpolate a config group? My intention is to interpolate a group's key from other keys, in this example: selecting a dataset's config group based on the dataset name and the dataset version (e.g, if the dataset comes from a competition, this might be one of the tasks of the competition). Using hy... | <python><fb-hydra><omegaconf> | 2024-04-29 07:40:47 | 1 | 543 | Lukas |
78,400,895 | 16,525,263 | How to find the max value in a column in pyspark dataframe | <p>I have a pyspark dataframe</p>
<pre><code>deviceId timestamp
009eeb 2024-04-22
009eeb 2024-04-24
7c002v 2024-04-20
7c002v null
4fd556 null
4fd556 null
</code></pre>
<p>I need to get the max timestamp in the final dataframe and drop duplicates.
I tried with the below code</p>
<pre><co... | <python><apache-spark><pyspark> | 2024-04-29 06:39:01 | 1 | 434 | user175025 |
78,400,487 | 8,176,763 | airflow 2.9 schedule DAG on the first weekday day of the month every month | <p>I would like to schedule a DAG on the first weekday of the month for every month. So for example this years it would have been scheduled at:</p>
<pre><code>2024-01-01
2024-02-01
2024-03-01
2024-04-01
2024-05-01
2024-06-03 -----> here the third because the first is a Saturday
</code></pre>
<p>I have had a look at... | <python><airflow> | 2024-04-29 04:28:37 | 1 | 2,459 | moth |
78,400,480 | 10,499,034 | How can I force plots to be the same size when the figsize setting does nothing in pyplot? | <p>I wrote the following code:</p>
<pre><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
symetricArr=[[random.random() for i in range(100)] for j in range(100)]
asymetricArr=[[random.random() for i in range(50)] for j in range(100)]
plt.figure(figsize=(4,4))
plt.imshow(symet... | <python><matplotlib><imshow> | 2024-04-29 04:27:08 | 0 | 792 | Jamie |
78,400,455 | 3,314,925 | how to calculate common elements between list column rows | <p>Is it possible to calculate the number of common items in a list column, between a row and the previous row in the method chain?
My code below throws and error 'TypeError: unhashable type: 'list''</p>
<pre><code>import pandas as pd
df = pd.DataFrame({
'x':[1,2,3,4],
'list_column': [
['apple', 'banan... | <python><pandas><dataframe><list> | 2024-04-29 04:17:01 | 5 | 1,610 | Zeus |
78,400,440 | 15,625,738 | How can I Insert data in PDF via python on the PDF form having input field ? I am using pypdf | <p>I am trying to automate the PDF form input process on my PDF form having input fields. I have extracted the form fields and data structures via following method :</p>
<pre><code>from pypdf import PdfWriter, PdfReader,generic
import pypdf
def extract_form_fields(pdf_path):
with open(pdf_path, 'rb') as file:
... | <python><pdf><pypdf><pymupdf><python-pdfreader> | 2024-04-29 04:12:33 | 0 | 576 | Madhav Dhungana |
78,400,329 | 639,616 | multiplot in for loop by importing only pandas | <p>Sometime, <code>DataFrame.plot()</code> inside a <code>for</code> loop produces multiple charts.</p>
<pre><code>import pandas as pd
data = {'Str': ['A', 'A', 'B', 'B'], 'Num': [i for i in range(4)]}
df = pd.DataFrame(data)
for n in ['A', 'B']:
df[df.Str == n].plot(kind='bar')
</code></pre>
<p><a href="https://i.s... | <python><pandas><matplotlib> | 2024-04-29 03:16:37 | 2 | 12,836 | wannik |
78,400,266 | 24,758,287 | Rolling Indexing in Polars? | <p>I'd like to ask around if anyone knows how to do rolling indexing in polars?
I have personally tried a few solutions which did not work for me (I'll show them below):</p>
<p><strong>What I'd like to do</strong>: <strong>Indexing the number of occurrences within the past X days by Name</strong>
Example: Let's say I'd... | <python><dataframe><group-by><python-polars><data-wrangling> | 2024-04-29 02:44:53 | 1 | 301 | user24758287 |
78,400,254 | 13,530,621 | SVM training taking too long | <p>I have a dataset with 41 features, out of which 4 are text features. I've been given "Bag of Words" numpy arrays (npz) for these four features, which I combined with the other numerical features to train an SVM model. There are a total of 100000 records and 41 features, 4 of which are vectorized as mention... | <python><machine-learning><svm> | 2024-04-29 02:39:09 | 1 | 1,090 | revmatcher |
78,400,238 | 5,302,866 | How to use mysql's CURRENT_TIMESTAMP from python? | <p>I want to use the MySQLs function CURRENT_TIMESTAMP from python code, but can't figure out how to pass this in my INSERT or UPDATE queries.</p>
<pre><code> try:
mycursor.execute(
"CREATE TABLE IF NOT EXISTS test (pkID bigint unsigned NOT NULL AUTO_INCREMENT , tsTest TIMESTAMP, PRIMARY KEY (pkID))... | <python><mysql><timestamp><sql-timestamp> | 2024-04-29 02:29:19 | 1 | 1,205 | MaybeWeAreAllRobots |
78,400,038 | 13,752,965 | Can't do voxel_down_sample with Tensor PointCloud that has a user-defined property | <p>I'm trying to do <code>voxel_down_sample</code> on an annotated point cloud. The annotations are simply a <code>uint8</code> label defining a particular class of object.</p>
<p>If I omit the user defined property attached to each point, then the downsample works as expected.</p>
<p>Here's an example:</p>
<pre class=... | <python><open3d> | 2024-04-29 00:42:32 | 1 | 703 | tdpu |
78,399,765 | 2,537,486 | How to style size and color of matplotlib suptitle? | <p>This should be straightforward: I want to style the matplotlib <code>suptitle</code>.</p>
<p><a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.suptitle.html" rel="nofollow noreferrer">Documentation</a> says that <code>fontproperties</code> is a dict of font properties that can be supplied as a par... | <python><matplotlib> | 2024-04-28 22:01:16 | 3 | 1,749 | germ |
78,399,750 | 3,103,957 | Usage of Async Context managers and Async Iterators in Async library in Python | <p>When we use Async context managers and iterators in Python, I don't see any value in them. Because in context manager, when <strong>aenter</strong>() and <strong>aexit</strong>() are called into, they become the only tasks made available in the event loop. And similarly when using Async iterators, the <strong>anext<... | <python><iterator><python-asyncio><contextmanager> | 2024-04-28 21:49:56 | 1 | 878 | user3103957 |
78,399,741 | 6,735,815 | Trying to understand behavior of `_field_defaults` of `namedtuple` in Python 3.9 | <p>I am new to Python's <code>namedtuple</code>, particularly, <code>_field_defaults</code>.</p>
<p>According to Python <a href="https://docs.python.org/3.12/library/collections.html#collections.namedtuple" rel="nofollow noreferrer">3.12.3 official doc</a>,</p>
<blockquote>
<p>some <code>namedtuple._field_defaults</cod... | <python><python-3.9><namedtuple><github-copilot> | 2024-04-28 21:47:42 | 1 | 463 | Ku Zijie |
78,399,709 | 7,421,086 | limit context token on document retrieval chains | <h1>Code</h1>
<pre class="lang-py prettyprint-override"><code>import os
from qdrant_client import QdrantClient
from langchain.vectorstores import Qdrant
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.chains import create_retrieval_chain
from langchain.sche... | <python><langchain><py-langchain> | 2024-04-28 21:31:02 | 2 | 4,050 | WQYeo |
78,399,639 | 9,191,338 | How to use io.BytesIO in Python to write to an existing buffer? | <p>According to <a href="https://stackoverflow.com/questions/53485708/how-the-write-read-and-getvalue-methods-of-python-io-bytesio-work">How the write(), read() and getvalue() methods of Python io.BytesIO work?</a> , it seems <code>io.BytesIO</code> will copy initial bytes provided.</p>
<p>I have a buffer, and I want <... | <python> | 2024-04-28 21:00:27 | 1 | 2,492 | youkaichao |
78,399,582 | 1,203,670 | An incorrect year shows up when plotting using pandas and matplotlib and the YearLocator | <p>I have the following code (see below), where I try to plot the monthly orders. It works quite well, however, I am rying to set the major ticks at every year, but I only end up with a year at 1970. I am not quite sure what I am missing and why it behaves like this. What am I doing wrong?</p>
<pre><code>from pandas im... | <python><pandas><matplotlib> | 2024-04-28 20:37:00 | 1 | 3,099 | Snowflake |
78,399,495 | 2,843,348 | SqlAlchemy 2.0: Issues using `mapped_column()` with `Computed()` columns in ORM Table Definitions (not working on MappedAsDataclass) | <blockquote>
<p><em>(Note: In line with Stack Overflow's encouragement to enrich the
community by answering one's own questions, especially after
investing significant effort in troubleshooting, I am providing an
answer below. I eagerly welcome further comments, additional
insights, or alternative approaches! I would a... | <python><sqlalchemy><orm><ddl> | 2024-04-28 19:59:31 | 1 | 374 | A.Sommerh |
78,399,081 | 1,867,328 | Insert a row in pandas dataframe | <p>I have below pandas dataframe</p>
<pre><code>import pandas as pd
dat = pd.DataFrame({'A': [1,2,3,5], 'B': [7,6,7,8]})
</code></pre>
<p>Now I have a list</p>
<pre><code>List = [99, 88]
</code></pre>
<p>I want to insert this list at the row number 2.</p>
<p>Is there any method available to achieve this? I found there ... | <python><pandas> | 2024-04-28 17:35:30 | 1 | 3,832 | Bogaso |
78,398,988 | 18,346,591 | Multi-processing code not working in while loop | <p>Happy Sunday.</p>
<p>I have this code that I want to run using the multi-processing module. But it doesn't just work for some reason.</p>
<pre><code>with ProcessPoolExecutor() as executor:
while True:
if LOCAL_RUN:
print("ALERT: Doing a local run of the automation with limited capabiliti... | <python><multithreading><oop><parallel-processing><multiprocessing> | 2024-04-28 17:04:57 | 1 | 662 | Alexander Obidiegwu |
78,398,896 | 597,858 | 'TCP localhost:57318->localhost:34033 (CLOSE_WAIT)' and 'Too many open files' | <p>I have a python script which uses selenium for web-scraping on an ubuntu server. I am creating fresh driver object in a while loop in every iteration and quitting it after the use.
The script runs fine for sometime. then it stops creating new driver, with an exception 'Too many open files'.</p>
<p>Here is the script... | <python><selenium-webdriver><tcp> | 2024-04-28 16:33:02 | 1 | 10,020 | KawaiKx |
78,398,739 | 2,800,754 | How to call a Perl script with couple of arguments with html tag from within a Python script using Subprocess/shell? | <p>Within a <strong>python script</strong> I have a <strong>function which looks as below</strong>:</p>
<pre><code>def NotifierFunc(Mail, Ticket_Num, Open_DtTime):
cmd = "/home/path/MyPerlScript.pl --channel 'MyChannel' --userid 'itsme' --message 'Hello <at>"+Mail+"<at> : The ticket <a... | <python><html><subprocess> | 2024-04-28 15:40:30 | 2 | 1,012 | instinct246 |
78,398,714 | 1,761,721 | Playwright Python is not getting the response | <p>When I wait for a response from an API call that is made on a page, PlayWright never gets the response. I've seen this in several attempts to wait for a response on different pages but here is some example code that narrows it down to an easy to replicate situation I hope.</p>
<p>The code times out</p>
<pre><code>fr... | <python><web-scraping><playwright><playwright-python> | 2024-04-28 15:34:12 | 1 | 449 | Stephen Graham |
78,398,712 | 14,195,139 | ERROR: Package 'imageio' requires a different Python: 2.7.17 not in '>=3.5' | <p>I am doing Medical Image Analysis, in that I need package <code>imageio</code> in <code>jupyter notebook</code>. I am writing this command</p>
<pre><code>!pip install imageio
</code></pre>
<p>Giving me error like this</p>
<pre><code>DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upg... | <python><jupyter-notebook><importerror><python-imageio> | 2024-04-28 15:34:01 | 1 | 443 | Jaykumar |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.