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
76,250,241
7,601,489
No Python at "...\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe'
<p>I installed Python 3.11 using the Windows Store and wanted to use Python 3.10 instead. So I uninstalled Python 3.11 and installed 3.10.</p> <p>Running <code>python --version</code> gives the correct output <code>&quot;Python 3.10.11&quot;</code>, but when I'm trying to run a <code>.bat</code> file that uses Python, ...
<python><windows>
2023-05-15 00:39:04
2
824
Andrew Zaw
76,250,102
3,762,284
How to write hive partitioned table with pyspark, with skip equal data column?
<p>In my project, I use hadoop-hive with pyspark.</p> <p>my table created by this query.</p> <pre><code>CREATE TABLE target_db.target_table( id string) PARTITIONED BY ( user_name string, category string) </code></pre> <p>I get data like this.</p> <pre><code>user_name: john data list: # id, cate...
<python><dataframe><pyspark><hive><hdfs>
2023-05-14 23:36:54
1
556
Redwings
76,250,086
342,553
django viewflow how to mock viewflow handlers
<p>Say I have a flow class <code>app1/flows.py</code></p> <pre class="lang-py prettyprint-override"><code>class MyFlow(Flow): start = ... do_stuff = flow.Handler(this.do_stuff_handler).Next(...) end = ... def do_stuff_handler(self, activation): ... </code></pre> <p>If I want to mock <code>do_st...
<python><django-viewflow>
2023-05-14 23:28:40
1
26,828
James Lin
76,249,814
6,549,541
Authorizing Google API on Headless Machine in Python
<p>Running Linux (ubuntu and python in docker on Raspberry OS) on a headless Raspberry Pi 4.</p> <p>Followed <a href="https://developers.google.com/drive/api/quickstart/python" rel="nofollow noreferrer">Google's Python Quickstart Guide</a> and got it to the point where it asks me to go to a URL like this:</p> <pre><cod...
<python><google-oauth><google-calendar-api>
2023-05-14 21:47:24
1
1,186
atclaus
76,249,794
11,141,816
How could msgspec and ijson faster than json for large json file?
<p>I was told that ijson create a pipe between the file on the hardrive and the memory to save the memory, so it's more memory efficient than json library. However, I was also told that ijson can be faster than json with the incremental parsing, which did not make sense to me at all. The hard drive's IO was usually muc...
<python><json><io><ijson>
2023-05-14 21:37:55
0
593
ShoutOutAndCalculate
76,249,781
6,467,512
Feature extraction process using too much memory and causing a crash. What can I do?
<p><a href="https://i.sstatic.net/RqbBn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RqbBn.png" alt="enter image description here" /></a>I am using a hugging face transformer to do some image feature extraction to use later for some similarity search functionality. This is not working currently becaus...
<python><deep-learning><memory-leaks><huggingface-transformers>
2023-05-14 21:34:16
1
323
AynonT
76,249,774
551,404
Unable to execute python script from php on web when mysql module is included in python
<p>This is my php code :</p> <pre><code>$output = shell_exec(&quot;python3 test.py&quot;); echo $output; </code></pre> <p>This is my python code</p> <pre><code>#!/usr/bin/env python3 import requests import sys print(&quot;Hello from Python&quot;) </code></pre> <p>it show text <code>Hello from Python</code> when acce...
<python><php><mysql>
2023-05-14 21:32:08
0
3,522
dramasea
76,249,738
7,318,120
what does sha256 actually do?
<p>I am trying to understand hashing in python and in particular sha256.</p> <p>I have a standard python function that uses the <code>hashlib</code> for creating a sha256 hash like this:</p> <pre class="lang-py prettyprint-override"><code>import hashlib def hash_password(password): &quot;&quot;&quot;Hashes a passw...
<python><sha256><hashlib>
2023-05-14 21:21:06
1
6,075
darren
76,249,666
15,537,469
Streamlit with Poetry is not found when run my docker container
<p><strong>Solved</strong></p> <p>According to this: <a href="https://stackoverflow.com/a/57886655/15537469">https://stackoverflow.com/a/57886655/15537469</a></p> <p>and to this: <a href="https://stackoverflow.com/a/74918400/15537469">https://stackoverflow.com/a/74918400/15537469</a></p> <p>I make a Multi-stage Docker ...
<python><python-3.x><dockerfile><streamlit><python-poetry>
2023-05-14 21:03:16
2
534
GuiEpi
76,249,636
16,436,774
Class properties in Python 3.11+
<p>In Python 3.9, we gained the ability to chain <code>@classmethod</code> and <code>@property</code> to sensibly create class properties.</p> <pre class="lang-py prettyprint-override"><code>class Foo: @property def instance_property(self): return &quot;A regular property&quot; @classmethod @property def...
<python><python-3.x><properties><python-decorators><python-descriptors>
2023-05-14 20:55:33
3
866
kg583
76,249,634
265,521
How to distribute binaries via pip
<p>I know that sounds a bit of a mad thing to do, but pip is probably the most likely-to-be-installed package manager in many cases, and also CMake does it (<code>pip install cmake</code> is by far the easiest way to get an up-to-date build of CMake on Linux and Mac).</p> <p>But anyway how would I actually do it? As fa...
<python><pip><python-wheel>
2023-05-14 20:55:26
1
98,971
Timmmm
76,249,617
11,092,636
how to type hint ctypes.POINTER(ctypes.c_int)
<p>Here is an MRE you can run on <code>mypy Playground</code>:</p> <pre class="lang-py prettyprint-override"><code>import ctypes import numpy as np # type: ignore # (no stubs for numpy) def np_to_c(arr: np.ndarray) -&gt; tuple[ctypes.POINTER(ctypes.c_int), ctypes.c_int]: return arr.ctypes.data_as(ctypes.POINTER(c...
<python><ctypes><type-hinting>
2023-05-14 20:51:09
2
720
FluidMechanics Potential Flows
76,249,478
8,778,855
Dynamically change dcc.link text
<p>My question is similar to the one posted <a href="https://stackoverflow.com/questions/68446584/dash-change-words-in-dcc-link">here</a>.</p> <p>I use a <code>dcc.link</code> as sign-in and sign-out button.</p> <p>It means that I need to change the text dynamically corresponding to the authentication state (I use flas...
<python><plotly-dash>
2023-05-14 20:08:46
0
477
volfi
76,249,465
2,641,825
Why is `groupby` not returning a KeyError when a column is missing ? How to prevent values from beeing used as-is to determine the groups
<pre><code>import pandas df_trade = pandas.DataFrame( { &quot;reporter&quot;: [&quot;a&quot;, &quot;a&quot;, &quot;b&quot;, &quot;b&quot;], &quot;reporter_code&quot;: [1, 1, 2, 2], &quot;partner&quot;: [&quot;x&quot;, &quot;y&quot;, &quot;x&quot;, &quot;z&quot;], &quot;partner_code&q...
<python><pandas>
2023-05-14 20:05:25
1
11,539
Paul Rougieux
76,249,205
4,725,707
How to assess the progress of a vectorized task (in python with pandas)
<p>Vectorization of tasks speeds up the execution, but I cannot find how to measure the progress of the vectorized task (in case of tasks taking a long time to complete). I've seen that <a href="https://tqdm.github.io/" rel="nofollow noreferrer">tqdm</a> might do the job, but I wonder if it is possible to do it in a si...
<python><pandas><vectorization><progress>
2023-05-14 18:55:57
1
538
RiGonz
76,249,186
2,949,526
Probability of moving on a cartesian plane
<p>I am working on the below coding problem which looks more like a probability question rather than a coding problem</p> <p>platform consisting of 5 vertices. The coordinates of the vertices are: (-1,0), (0.-1). (0,0), (0.1). (1.0). You start at vertex (xs,ys) and keep moving randomly either left (i.e., x coordinate d...
<python><math><probability><combinatorics>
2023-05-14 18:53:02
1
1,090
Legendary_Hunter
76,249,013
10,251,146
Polars explode columns, ComputeError columns mismatch
<p>I have a list column and two different columns, I would like to explode the list column while keeping the two other columns e.g.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>a</th> <th>b</th> <th>list</th> </tr> </thead> <tbody> <tr> <td>&quot;q&quot;</td> <td>&quot;p&quot;</td> <td>...
<python><python-polars>
2023-05-14 18:13:04
0
459
linus heinz
76,248,925
13,080,966
How can I delete a thread running a blocking socket function in python?
<p>I have a problem, where I have created a thread which is running a blocking socket function (e.g. accept) and I need to shutdown the thread and close the socket without getting a bunch of errors so that I can use the socket again. I have created the following example to illustrate the problem:</p> <pre><code>import...
<python><multithreading><sockets><python-multithreading>
2023-05-14 17:49:19
0
362
Ali Awan
76,248,909
9,681,577
How to delete the DataFrame rows with the largest number of NaNs?
<p>Pandas and other question/answers in this site provide solutions for the case when we know the number of non NaN to preserve. How can I efficiently delete just the worst row, or rows if there are more than one being the worst ones. Some examples below show how to remove columns, could be rows by setting the axis. Ho...
<python><pandas><dataframe><nan><missing-data>
2023-05-14 17:46:56
1
794
dawid
76,248,901
616,507
Jupyter rendering code even with "hide-input" tag
<p>I have a Jupyter notebook that I'm using for data analysis, everything is working exactly as I expect as far as the actual analysis part. I'm trying to get my output to a simple report on the analysis, without showing the code that I used to generate the results / maps. I've tried adding a &quot;hide-input&quot; tag...
<python><jupyter-notebook><jupyter>
2023-05-14 17:45:09
0
727
John
76,248,899
177,779
Code Completion not working properly in DataSpell?
<p>I have included three images highlighting the issue I've encountered with code completion in Dataspell. The image below shows how an instance of Jupyter running in a browser deals with code completion.</p> <p><a href="https://i.sstatic.net/xHNlW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xHNlW.pn...
<python><jetbrains-ide><code-completion><dataspell>
2023-05-14 17:45:04
1
2,331
Urizen
76,248,839
8,990,846
Using Github Actions with Lektor CMS
<p>Basically i have a Lektor project, and i'm trying to to use <strong>Github Actions</strong> for deployment to <strong>Github Pages</strong></p> <p><strong>But</strong> the publish always fail with this message <code>fatal: could not read Username for 'https://github.com': No such device or address</code></p> <p>Her...
<python><github-actions><github-pages><lektor>
2023-05-14 17:29:59
1
2,485
WaLid LamRaoui
76,248,723
1,421,907
What a function which produces a matplotlib plot is supposed to return?
<p>I have functions or methods in a class that produce plots with matplotlib. I would like to use that functions in various contexts. I never can be sure about what the function is supposed to return. I will be use that function essentially in jupyter notebooks but also in widgets or qt app for example.</p> <p>Here is ...
<python><matplotlib><ipywidgets>
2023-05-14 17:05:15
1
9,870
Ger
76,248,719
11,974,163
Is it possible to access another keyword in called function parameter?
<p>I'm not sure how to completely articulate what I'm wondering here so forgive any confusion.</p> <p>What I want to know is, Once I import a module and call a function is it possible to access another parameter's value inside another parameter within the same function?</p> <p>So for example, I'm playing around with <c...
<python><oop>
2023-05-14 17:04:07
2
457
pragmatic learner
76,248,637
8,477,566
Fields are missing when I `pip show` my Python package
<p>I recently uploaded my first Python package to PyPI. The relevant parts of <code>pyproject.toml</code> are defined as follows (full file available <a href="https://github.com/jakelevi1996/jutility/blob/main/pyproject.toml" rel="nofollow noreferrer">here</a>):</p> <pre><code>[build-system] requires = [&quot;setuptool...
<python><pip><setuptools><pypi><python-packaging>
2023-05-14 16:47:26
2
1,950
Jake Levi
76,248,287
1,955,215
Replacing the Print Command in a python script with a comment
<p>I have the command below in a .py file</p> <pre><code>print(r&quot;\n print series&quot;) </code></pre> <p>I want the above command/line to be replaced with a string:</p> <p>&quot;#series&quot; ie convert the above print command into a comment prefixing the # symbol to the text following the &quot;print&quot; in the...
<python><string><replace>
2023-05-14 15:31:10
2
763
user1955215
76,248,276
21,309,333
How to reinterpret bits of float as int in python
<p>I had to write code that printed out bits of floating point number (in hexadecimal). For C++, the first thing that came to mind was <code>std::cout &lt;&lt; std::hex &lt;&lt; *reinterpret_cast&lt;uint32_t*&gt;(&amp;x);</code> where x is a floating point variable that stores the original number.</p> <p>However, when ...
<python><floating-point><integer><bit>
2023-05-14 15:28:48
1
365
God I Am Clown
76,248,183
4,720,957
Why calling `print(self)` in constructor of a parent class is causing RuntimeError?
<p>Here's the traceback:</p> <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last): File &quot;/home/neon/pyqt6/myqt/src/app.py&quot;, line 13, in &lt;module&gt; window = AppWindow() ^^^^^^^^^^^ File &quot;/home/neon/pyqt6/myqt/src/app.py&quot;, line 7, in __init__ s...
<python><python-3.x><runtime-error><pyside><pyside6>
2023-05-14 15:07:45
0
1,229
user47
76,247,903
7,210,908
how to make pytorch lstm model for two input parameters
<p>I have a project where the future number of passengers is predicted using lstm. <a href="https://github.com/tyt34/forecasting-pytorch-passengeres/blob/master/main_2.ipynb" rel="nofollow noreferrer">full program link</a>. As input data, the passenger traffic for the previous time of this kind:</p> <pre><code>cd = [11...
<python><pytorch><lstm>
2023-05-14 14:09:28
0
320
Roma N
76,247,864
12,783,363
Shortening of Youtube playlist URL
<p>I'm trying to automate a youtube description with python, and I'd like to shorten a youtube playlist URL.</p> <p>Normally a non-playlist URL goes <a href="https://www.youtube.com/watch?v=%7Bvideo_id%7D" rel="nofollow noreferrer">https://www.youtube.com/watch?v={video_id}</a> and can be shortened to youtu.be/{video_i...
<python><automation><youtube>
2023-05-14 14:00:43
1
916
Jobo Fernandez
76,247,759
7,577,786
Errors thrown when my python-telegram-bot is doing run_polling are not logged to console
<p>I'm trying to test my telegram bot made with <code>python-telegram-bot</code> using <code>unittest</code>. The problem is that after I do <code>updater.run_polling()</code>, any errors raised thereafter simply cause the console to freeze here:</p> <pre><code>EWARNING:telegram.ext.Application:Fetching updates got a a...
<python><telegram><python-unittest><python-telegram-bot><long-polling>
2023-05-14 13:38:51
0
757
Nathan Tew
76,247,224
13,793,478
how do I make the link from database clickable and get the content of the url
<p>this is my views.py</p> <pre><code>from django.shortcuts import render, redirect from base.models import Prescription def orders(request): orders = Prescription.objects.all() return render(request, 'base/orders.html', { 'orders': orders, }) </code></pre> <p>the link in question is the last one (...
<python><django><django-models>
2023-05-14 11:27:24
1
514
Mt Khalifa
76,247,167
3,789,665
Efficient creation of a sequence of sets from values and thresholds
<p>Given a shortish sequence of thresholds ordered ascendantly and numerous values (unordered).</p> <p>Wanted result is a sequence of <code>set</code>s, first one containing all distinct values below the lowest/first threshold; next values not below lowest threshold, but below 2nd threshold, if any; and so on 'til last...
<python><python-3.x><numpy><performance>
2023-05-14 11:12:40
2
2,642
greybeard
76,247,145
14,401,160
How to set Content-Type header with boto3 presigned url multipart upload
<p>Is there any way to allow <code>Content-Type</code> header with multipart uploads to presigned s3 url?</p> <p>Let's begin with the following code:</p> <pre class="lang-py prettyprint-override"><code>import boto3 import requests BUCKET_NAME = &quot;foo&quot; # No, it's global in this MRE only client = boto3.client...
<python><amazon-s3><http-headers><boto3><botocore>
2023-05-14 11:05:56
2
8,871
STerliakov
76,247,134
8,113,138
Cannot install yolox
<p>I am trying to install Yolox using the following command:</p> <pre><code>pip install yolox </code></pre> <p>I got this command from the following link:</p> <p><a href="https://pypi.org/project/yolox/" rel="nofollow noreferrer">https://pypi.org/project/yolox/</a></p> <p>I got the following error:</p> <pre><code>Prepa...
<python><ubuntu><yolo>
2023-05-14 11:03:22
1
858
Jalil Nourmohammadi Khiarak
76,246,993
21,896,093
IntelliSense not listing members with VSCode Interactive Python code files
<p>In VSCode I use Python Interactive mode. I have a Python script open on one pane, and I execute the code in an interactive terminal open in another pane. IntelliSense works properly in the interactive pane - when I type &quot;.&quot; after an object it lists all the object's members. But when I try the same thing in...
<python><visual-studio-code><intellisense><interactive><pylance>
2023-05-14 10:33:39
1
5,252
MuhammedYunus
76,246,908
8,044,204
Google Colab - redirect_url for Google Drive API - OAuth 2.0
<p>On Google Colab, I want to download a specific revision of a file from Google Drive to my workspace, however I found it extremely difficult (comparing how easy is to mount the drive).</p> <p>I have created OAuth 2.0 Client ID, added 'expected' redirect_url's and uploaded the client_secrets.json to my workspace. And ...
<python><oauth-2.0><google-drive-api><google-oauth><google-colaboratory>
2023-05-14 10:11:08
1
814
Melih
76,246,817
3,247,006
@register.filter vs @register.simple_tag vs @register.tag vs @register.inclusion_tag in Django Templates
<p><a href="https://docs.djangoproject.com/en/4.2/howto/custom-template-tags/#writing-custom-template-filters" rel="nofollow noreferrer">The doc</a> says about <a href="https://docs.djangoproject.com/en/4.2/howto/custom-template-tags/#django.template.Library.filter" rel="nofollow noreferrer">@register.filter</a> below:...
<python><django><django-templates><python-decorators><templatetags>
2023-05-14 09:46:33
1
42,516
Super Kai - Kazuya Ito
76,246,812
520,556
How to extract sentences from a pandas dataframe which are given in a column as word-per-row
<p>What is the most efficient way to loop over a large pandas dataframe in which sentences are given as word-per-row, and with punctuations in another column? For example:</p> <pre><code>d = {'col1': ['This', 'is', 'a', 'simple', 'sentence', 'This', 'is', 'another', 'sentence', 'This', 'is',...
<python><pandas><dataframe>
2023-05-14 09:45:38
1
1,598
striatum
76,246,578
10,012,856
Module 'numpy' has no attribute 'warnings'
<p>I'm trying to reproduce <a href="https://datashader.org/user_guide/Polygons.html#geopandas-import" rel="noreferrer">this</a> tutorial with my own data. I've a simple square grid of polygons:</p> <pre><code>from shapely import wkt import pandas as pd import geopandas as gpd data_list = [ [0,51, wkt.loads(&quot;P...
<python><numpy><datashader>
2023-05-14 08:39:34
1
1,310
MaxDragonheart
76,246,504
8,849,755
Why cannot I unstack this pandas data frame?
<p>I have a data frame in pandas that looks like this:</p> <pre><code>n_y 0 1 2 3 4 ... 53 54 55 56 57 variable n_channel n_pulse n_x ...
<python><pandas><dataframe>
2023-05-14 08:19:34
1
3,245
user171780
76,248,516
2,280,111
simulate load-balancer variability
<p>The following program tries to show how a stateless load balancer creates variability when spreading balls between bins (with default settings below, the <code>max/min</code> ratio is ~2). Obviously, the more balls we throw, the smaller the spread.</p> <p>Question: how do I convert it to a continuous example? i.e. i...
<python><simulation>
2023-05-14 07:54:00
0
1,513
Roman
76,246,392
7,589,661
Replacing multiprocessing with dask equivalent
<p>There is a script which performs a tedious function with the help of multiprocessing. This script involves lots of log file processing and it takes lots of time when it involves hundreds or several thousands of them.</p> <p>I am new to cluster computing, this is why I would like to know if there is a way to replace ...
<python><cluster-computing>
2023-05-14 07:48:20
0
3,062
Moshe S.
76,245,993
755,934
How to capture logs from native python logging module in gunicorn?
<p>I have a python flask/gunicorn project which includes the standard flask logging code. However, some of my code may not run in an application context (it has its own unit tests, including some fairly complicated functions in other files). These files use the native python logging mechanism. How do I capture those lo...
<python><flask><gunicorn><python-logging>
2023-05-14 05:33:22
1
5,624
Daniel Kats
76,245,885
3,878,377
Can DeepAR handle multiple time series different length?
<p>Assume I have 100 time series with different start and end dates but the same frequency hence they mostly have different lengths.Each time series is stored as a form of dataframe. They all look like the following:</p> <pre><code>date item_id target 2020-01-10 'A' 5 2020-01-11 ...
<python><time-series><forecasting><deepar><gluonts>
2023-05-14 04:58:40
0
1,013
user59419
76,245,884
1,031,219
Unknown C++ exception while drawing matches using cv2.line_descriptor.drawLineMatches() in OpenCV Python
<p>I am trying to match line descriptors extracted from two images using the <strong>binary descriptor module</strong> of OpenCV in Python. But, when drawing the matches using <code>cv2.line_descriptor.drawLineMatches()</code> function, I am getting the below error</p> <pre><code>img3 = cv2.line_descriptor.drawLineMatc...
<python><opencv><image-processing><computer-vision><feature-extraction>
2023-05-14 04:57:48
1
1,229
Saikat
76,245,817
1,850,272
Automation not iterating through list of links yet no errors are thrown
<p>I'm creating an automated test with selenium and python and am trying to make it click on each product on a page. The steps I want to follow are:</p> <ol> <li>go to amazon.com.</li> <li>click on search bar.</li> <li>type '3D Printers' into the search bar.</li> <li>click the submit button.</li> <li>click on the firs...
<python><selenium-webdriver>
2023-05-14 04:32:06
3
3,354
Optiq
76,245,584
506,824
How to find which superclass contains a name?
<p>I'm working with some code that I didn't write (so don't blame me for the crazyness). This is Python 3.9. I've got:</p> <pre><code> try: del self.userinfo # force reload if self.userinfo['name'] == self.user(): self._loginstatus = login.LoginStatus.AS_USER return </code>...
<python><python-3.x><method-resolution-order>
2023-05-14 02:35:38
2
2,177
Roy Smith
76,245,416
3,490,622
Rolling 12 month sum of customers who had at least one transaction in that time - pandas
<p>I have a transactions dataframe that looks like this:</p> <pre><code>| customer_id | purchase_date | purchase_amt | ... |-------------|---------------|--------------| ... | 1 | 12-01-2023 | 150.00 | ... | 2 | 11-24-2022 | 84.23 |.. </code></pre> <p>I need to calculate a 12-...
<python><pandas><time-series><rolling-computation>
2023-05-14 00:58:33
2
1,011
user3490622
76,245,284
11,540,781
Importing torch makes matplotlib kill kernel
<p>This code kills the kernel when executing the lineplot:</p> <pre><code>import pandas as pd import numpy as np import seaborn as sns from matplotlib import pyplot as plt import time import torch sns.lineplot(x=np.arange(1, 10), y=np.arange(1, 10)) plt.show() </code></pre> <p>But this one doesn't:</p> <pre><code>imp...
<python><matplotlib><pytorch><anaconda><jupyter>
2023-05-13 23:43:52
0
343
Ramon Griffo
76,244,570
10,333,931
python cffi breaks when used from external file
<p>I'm writing a self organising map implementation in c and I'm trying to bind it to python using cffi.</p> <p>My wrapper module looks like this:</p> <pre class="lang-py prettyprint-override"><code>from ._SOM import ffi, lib lib.init() class SOM: def __init__(self, x, y, input_length, sigma, learning_rate): ...
<python><python-cffi>
2023-05-13 19:38:12
1
593
Seppukki
76,244,484
5,468,296
Stable-Diffusion webui-user.bat gets stuck after "Model loaded"
<p>My local Stable-Diffusion installation was working fine. One day after starting webui-user.bat the command window got stuck after this:</p> <pre><code>venv &quot;...\venv\Scripts\Python.exe&quot; Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Commit hash: 5ab7f213bec2f816f9...
<python><stable-diffusion>
2023-05-13 19:11:48
2
1,015
sobo
76,244,447
2,803,777
Why is mixing ratio at LCL not the same as for starting condition?
<p>I'm very new to metpy. As a first example I tried to calculate the LCL of an air parcel with T=25°C, p=950hPa and relative humidity=70%.</p> <p>First, the mixing ratio of this air is calculated to be</p> <pre><code>mr: 15.016493919350289 gram / kilogram </code></pre> <p>Afterwards, the LCL is calculated as:</p>...
<python><metpy>
2023-05-13 19:02:59
1
1,502
MichaelW
76,244,436
173,003
Regular expression matching either an empty string or a string in a given set
<p>I would like to match either &quot;direction&quot; (<code>&quot;&gt;&quot;</code> or <code>&quot;&lt;&quot;</code>) from a string like <code>&quot;-&gt;&quot;</code>, <code>&quot;&lt;==&quot;</code>, <code>&quot;...&quot;</code>. When the string contains no direction, I want to match <code>&quot;&quot;</code>. More ...
<python><regex>
2023-05-13 18:59:47
3
4,114
Aristide
76,244,137
13,555,387
Failed to parse the problem -- EOL while scanning string literal (, line 43)
<p>i am fetting error : /tmp/solver_planning_domains_tmp_2lmCSmQMYFyo5/problem.pddl: syntax error in line 14, '0': 'define' expected</p> <p>my problem.pddl is</p> <pre><code> (define (problem klotski) (:domain klotski) (:objects piece2x2 - piece piece2x1 - piece piece1x2-1 piece1x2-2 piece1x2-3 pi...
<python><dns><editor><pddl>
2023-05-13 17:45:16
1
353
Munna Khandakar
76,243,939
4,348,400
How should I interpret the output of tdda.rexpy.extract?
<p>I am interesting in <a href="https://tdda.readthedocs.io/en/v2.0.09/rexpy.html#the-rexpy-command" rel="nofollow noreferrer">Rexpy</a> because I am looking for a tool which infers a regular expression that would match a string. Inspecting <code>rexpy.extract</code> with <code>help</code> it looked like it 'might' be ...
<python><regex>
2023-05-13 16:57:42
1
1,394
Galen
76,243,849
12,845,199
Regex that removes whitespaces between two specific characters
<p>In pyspark I have the following expression</p> <pre><code>df.withColumn('new_descriptions',lower(regexp_replace('descriptions',r&quot;\t+&quot;,''))) </code></pre> <p>Which basically removes tab characters and makes my descriptions columns become lower</p> <p><strong>Here is a list samples of my descriptions columns...
<python><regex><pyspark>
2023-05-13 16:40:06
1
1,628
INGl0R1AM0R1
76,243,659
12,263,681
Flask app not able to find installed modules
<p>I have a very basic Flask app with some other Python modules installed, however upon trying to start the app I keep getting <code>ModuleNotFound</code> errors. I have attempted to run the app on two difference machines, a laptop running macOS and a PC running Windows and both give me <code>ModuleNotFound</code> erro...
<python><flask>
2023-05-13 15:53:57
0
528
SirArchibald
76,243,447
4,311,316
PysimpleGui: pre-select an Item in a Combobox on Keyboard input
<p>I have a GUI with pysimplegui that uses a combobox. There are alphabetically sorted strings in the list for the combobox.</p> <p>The Combobox is readonly (to only input the strings available), so the user gets the drop down list right away when clicking anywhere on the combobox element.</p> <p>When the drop-down lis...
<python><pysimplegui>
2023-05-13 15:13:36
1
385
Red
76,243,166
16,383,578
Can I save memory by replacing list elements with None in Python?
<p>I have millions of rows of data like these:</p> <pre><code> [&quot;1.0.0.0/24&quot;, 16777216, 16777471, &quot;1.0.0.0&quot;, &quot;1.0.0.255&quot;, 256, 13335, &quot;AU&quot;, false, true, false, false], [&quot;1.0.1.0/23&quot;, 16777472, 16777983, &quot;1.0.1.0&quot;, &quot;1.0.2.255&quot;, 512, null, &quot...
<python><python-3.x>
2023-05-13 14:11:23
1
3,930
Ξένη Γήινος
76,243,065
353,337
Replace all superscript digits with one `re.sub`
<p>Given a string with exponents like <code>^2</code> in it, I'd like to replace them with their unicode equivalents using Python.</p> <p>This works:</p> <pre class="lang-py prettyprint-override"><code>import re content = &quot;m^2 s^3&quot; content = re.sub(r&quot;\^0&quot;, &quot;\N{Superscript Zero}&quot;, content...
<python><regex>
2023-05-13 13:49:08
1
59,565
Nico Schlömer
76,243,038
14,860,526
authentication and authorization with azure AD and python
<p>I have two apps both registered on Azure AD:</p> <p>-APP_1: a web app that runs in flask with SSO through Azure AD</p> <pre><code>tenant_id = &quot;tenant_id_of_APP_1_and_APP_2&quot; client_id_app_1 = &quot;app_1&quot; client_secret_app_1 = &quot;secret_app_1&quot; </code></pre> <p>-APP_2: another app that makes req...
<python><azure-active-directory><jwt><azure-ad-msal>
2023-05-13 13:44:36
1
642
Alberto B
76,243,036
6,124,330
Multiple records on one row in pandas
<p>Suppose I have a pandas data frame that stores multiple records on the same row as below</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id1</th> <th>id2</th> <th>id3</th> <th>valueA1</th> <th>valueA2</th> <th>valueA3</th> <th>valueB1</th> <th>valueB2</th> <th>valueB3</th> </tr> </thead>...
<python><pandas>
2023-05-13 13:44:10
3
695
Ivor Denham-Dyson
76,242,916
386,861
Not sure what is wrong with my Altair code for visualisation in pandas?
<p>I'm working through a tutorial on Altair in Python.</p> <p><a href="https://www.youtube.com/watch?v=umTwkgQoo_E" rel="nofollow noreferrer">https://www.youtube.com/watch?v=umTwkgQoo_E</a></p> <p>Loaded data fine.</p> <pre><code>df = pd.read_csv(&quot;https://raw.githubusercontent.com/onlyphantom/miband/main/data/run_...
<python><pandas><altair>
2023-05-13 13:13:27
1
7,882
elksie5000
76,242,900
9,146,682
Python + TypeError: MarketData.get_kline() missing 1 required positional argument: 'kline_type'
<p>I need to extract BTC data from Kucoin. Here is the python code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>import kucoin.client as kc import pandas as pd api_key = ...
<python>
2023-05-13 13:09:17
1
355
hdsouza
76,242,791
2,987,552
audio streaming not working in flask using generator / yield
<p>I am trying to stream two audio files one after the other in flask using generator / yield. However it plays only the first file and not the other. Following is my code:</p> <pre><code>from flask import Flask, send_file, Response import random import time import wave # Flask constructor takes the name of # current ...
<python><flask><audio>
2023-05-13 12:41:49
1
598
Sameer Mahajan
76,242,711
3,225,420
Frequency plot using dots instead of bars?
<p>I'm trying to create the chart in this <a href="https://stackoverflow.com/questions/49703938/how-to-create-a-dot-plot-in-matplotlib-not-a-scatter-plot">question</a>, using this <a href="https://stackoverflow.com/a/49707027/3225420">answer</a>. I'm open to any solution that works.</p> <p>Visual borrowed from origina...
<python><matplotlib><dot-plot>
2023-05-13 12:24:38
1
1,689
Python_Learner
76,242,695
21,188,902
Script to generate Markdown files with embedded PlantUML diagrams for GitLab's PlantUML renderer
<p>I am setting up a repository to store software documentation consisting of several documents which are written in Markdown, and I want to be able to embed PlantUML diagrams in them. The repository is hosted in Gitlab, which includes a PlantUML renderer but does not allow <a href="https://plantuml.com/preprocessing" ...
<python><bash><markdown><plantuml>
2023-05-13 12:19:26
2
858
pcba-dev
76,242,589
12,297,666
Echo State Network - AttributeError: 'NoneType' object has no attribute 'lower'
<p>I am trying to use the code found <a href="https://github.com/FilippoMB/Time-series-classification-and-clustering-with-Reservoir-Computing" rel="nofollow noreferrer">here</a> in my scripts to use that Echo State Network (ESN) to solve a time series classification problem. First, I define my ESN classifier:</p> <pre>...
<python><dictionary>
2023-05-13 11:53:48
1
679
Murilo
76,242,524
3,130,747
How to determine the amount of free memory when running a google cloud function?
<p>When running a google cloud function the memory size can be set (<a href="https://cloud.google.com/functions/docs/configuring/memory" rel="nofollow noreferrer">https://cloud.google.com/functions/docs/configuring/memory</a>).</p> <p>If I select <code>512MB</code>, how can I determine how much of that 512MB is free af...
<python><google-cloud-platform><google-cloud-functions>
2023-05-13 11:38:06
1
4,944
baxx
76,242,392
10,927,050
How to detect if the xlsx file is password protected or not in python?
<p>I have a required where I need to detect if the excel file is password protected or not. If password protected ask user for the password. How do I do this in python? I looked a bit on the internet, none of the answers were useful so far</p>
<python><python-3.x><openpyxl><xlsx><password-protection>
2023-05-13 11:07:35
2
668
Prajna
76,242,364
15,322,101
Colorize based on condition
<p>I am having the following code to display a plot. I would like to conditionally format the values based on a threshold of 0.05.</p> <pre><code>from matplotlib.colors import to_rgba # Generate x-axis x = np.linspace(0, len(data_formula), len(data_formula)) colors = np.where(data_formula &lt;= 0.05, &quot;blue&quot;,...
<python><matplotlib><plot>
2023-05-13 10:57:41
1
347
Infomagier
76,242,348
597,858
checking a checkbox has no effect in Tkinter
<p>Inside a frame, I have populated checkboxes. But checking them has no effect on the checkbox_vars. what could be wrong with this piece of code?</p> <pre><code>def set_insider_trades(): def on_mousewheel(event): canvas.yview_scroll(int(-1 * (event.delta / 120)), &quot;units&quot;) set_inside_trading...
<python><tkinter><checkbox>
2023-05-13 10:54:03
1
10,020
KawaiKx
76,242,318
13,921,399
Determine transitions and durations across rows in a data frame
<p>Consider the following data frame:</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd from numpy import nan df = pd.DataFrame(data={ &quot;x1&quot;: [3, 3, 3, 3, 3, 3], &quot;x2&quot;: [3, 3, 2, 2, 1, 3], &quot;x3&quot;: [3, 2, 2, 3, 2, nan], &quot;x4&quot;: [3, 2, 1, 2, 3, nan]...
<python><pandas>
2023-05-13 10:47:13
2
1,811
ko3
76,242,081
10,651,655
sqlalchemy + async: Problem with inserting data
<p>I am trying to write to DB in a async mode, but for some reason, values are not stored. However tables are created.</p> <p>My DB</p> <pre><code>async def create_tables(self): async with self.async_engine.begin() as conn: await conn.run_sync(self.models.Base.metadata.drop_all) await conn....
<python><asynchronous><sqlalchemy>
2023-05-13 09:49:14
1
974
Anna
76,241,884
13,234,892
How to get value from tuple except known one?
<p>Suppose we have a tuple with two elements:</p> <pre><code>a = (1, N) </code></pre> <p>or</p> <pre><code>a = (N, 1) </code></pre> <p>I know that one of the elements is 1, the position is unknown and I need to get value of second element other than 1.</p> <p>Is there a way in Python to get it without iterating the tup...
<python><tuples>
2023-05-13 08:57:11
3
466
Andrey Ivanov
76,241,511
1,581,090
How to select element with selenium in python and get the text?
<p>In python I am trying to select this element</p> <pre><code>&lt;button stid=&quot;FLIGHTS_DETAILS_AND_FARES-index-1-LDUWT-FlightsActionButton&quot; data-test-id=&quot;select-link&quot; data-stid=&quot;FLIGHTS_DETAILS_AND_FARES-index-1-LDUWT-FlightsActionButton&quot; class=&quot;uitk-card-link&quot; type=&quot;button...
<python><selenium-webdriver>
2023-05-13 07:13:50
1
45,023
Alex
76,241,505
874,380
How to organize .ipynb and .py files into subfolders and allow imports?
<p>I want to create a repository to organize data, script files (py), and notebook files (ipynb). So the top level folder structure could look like this</p> <pre><code>project - data - notebooks - src </code></pre> <p>Since I have many notebooks, I would like to organize them further into subfolders; similar for <code>...
<python><jupyter-notebook>
2023-05-13 07:11:34
1
3,423
Christian
76,241,489
19,186,611
Read properties from common config in frontend and backend
<p>I have a Django server in the backend and React server in the frontend.</p> <p>For example, I have this function in the backend:</p> <pre class="lang-py prettyprint-override"><code>def create(request): fname = request.data['first_name'] lname = request.data['last_name'] </code></pre> <p>and this in my fronte...
<javascript><python><reactjs><django><config>
2023-05-13 07:08:05
1
433
lornejad
76,241,446
11,082,866
Spread the list of multiple dictionaries into multiple columns in pandas
<p>I have a dataframe where one column looks like this:</p> <pre><code>df['handling_unit'] = [{'id': 87, 'handling_unit': 'tyu', 'quantity'... 1 [] 2 [] 3 [{'id': 88, 'handling_unit': 'tyu', 'quantity'... 4 [{'...
<python><pandas><dataframe>
2023-05-13 06:52:56
1
2,506
Rahul Sharma
76,241,416
11,973,820
Adding (and) logic for a list of columns and generating feature
<p>I have requirement to create a feature by checking the fields of two different dataframes. df1 is a dataframe created from mysqldb and it will be static, the values of column(required) from df1 can be moved from True or False.</p> <p>below are more details.</p> <pre><code>df1= flag beta required alpha A ...
<python><pandas><dataframe>
2023-05-13 06:40:33
1
859
Jai
76,241,341
539,023
Write exception to log when django is unable to run properly
<p>Django Gurus, I have the following error messages on my console and I have the following logging configuration.</p> <pre><code>LOGGING = { &quot;version&quot;: 1, &quot;disable_existing_loggers&quot;: False, &quot;handlers&quot;: { &quot;console&quot;: { &quot;class&quot;: &quot;loggi...
<python><django><exception>
2023-05-13 06:10:48
1
20,230
kta
76,241,290
4,098,013
Crosstab across 4 columns and multi-index output
<p>Here is my data -</p> <pre><code>import pandas as pd a = [[1,0,1,1], [1,1,0,0], [1,1,1,1], [1,1,1,1], [0,0,1,0], [0,1,0,0], [0,0,0,0], [1,0,0,1], [1,0,0,1], [0,1,0,1]] df = pd.DataFrame(a, columns=['A','B','C','D']) A B C D 0 1 0 1 1 1 1 1 0 0 2 1 1 1 1 3 1 1 1 1 4 0 0 1 0 5 0 1 0 0 6 ...
<python><pandas>
2023-05-13 05:52:07
2
9,101
Vivek Kalyanarangan
76,241,269
20,285,962
Installation issues for tensorflow-decision-forests on Linux
<p>I getting the following error trying to install <a href="https://www.tensorflow.org/decision_forests" rel="nofollow noreferrer">tensorflow-decision-forests</a> on Fedora 38 with <code>pip install tensorflow-decision-forests</code>:</p> <pre><code>Defaulting to user installation because normal site-packages is not wr...
<python><linux><docker><tensorflow><machine-learning>
2023-05-13 05:44:45
1
319
Shane Gervais
76,241,137
5,672,673
mixup for gray image input and color image output
<p>Mixup is a technique to smoothen the training of a neural network by applying convex combination to training inputs:</p> <p><a href="https://keras.io/examples/vision/mixup/" rel="nofollow noreferrer">https://keras.io/examples/vision/mixup/</a></p> <p>In the example, the input is gray image and the output is a label....
<python><tensorflow><keras><image-processing><deep-learning>
2023-05-13 04:58:16
1
1,177
Linh Chi Nguyen
76,241,028
9,539,058
Interpolating values in xarray using non-indexed coordinates
<p>I'm trying to fetch time series from geographical coordinates (single points) from <a href="https://cloud.google.com/storage/docs/public-datasets/era5" rel="nofollow noreferrer">Google ERA5 Reanalysis data</a>. The dataset is following:</p> <pre><code>import xarray data = xarray.open_zarr( 'gs://gcp-public-data-...
<python><python-xarray><zarr><era5>
2023-05-13 04:10:42
1
888
Pörripeikko
76,240,677
9,937,874
Plotly express Choropleth highlight specific states
<p>I have generated a choropleth using plotly express. I am plotting the population of each state and I would like to highlight the state with the largest population and the smallest population. Is there a way to change the boarder color for a specific state?</p> <p>current code:</p> <pre><code>df = pd.read_csv(&quot;s...
<python><plotly>
2023-05-13 01:09:19
1
644
magladde
76,240,535
5,019,169
How to control a global counter in behave?
<p>I am trying to use environment file functions in <code>behave</code> to maintain a counter variable. My implementation looks like this:</p> <pre><code>def before_all(context): context.counter = -1 def before_scenario(context, scenario): print(context.counter) def after_scenario(context, scenario): cont...
<python><python-3.x><bdd><gherkin><python-behave>
2023-05-13 00:05:04
2
11,224
Ahasanul Haque
76,240,500
8,234,237
Copying file with CMake to build folder - single solution for VS Code and Visual Studio
<p>I have small project (minimum example) with 3 files:</p> <pre><code>foo.cpp script.py CMakeLists.txt </code></pre> <p>CMakeLists.txt:</p> <pre><code>cmake_minimum_required( VERSION 3.20 ) project( PythonCppExtension ) find_package( Python COMPONENTS Interpreter Development ) add_executable(PyRun &quot;foo.cpp&qu...
<python><c++><cmake>
2023-05-12 23:46:50
1
437
ChrCury78
76,240,408
5,012,832
Python VTKPlotLib how to remove existing mesh
<p>I am running into an issue with the code below. When the button is hit the code should grab the next model and display it, however, the old mesh is still present in the image and doesn't go away. In VTKPlotLib how do you erase the previous mesh, without destroying the qtfigure and messing up the flow of gui applicat...
<python><python-3.x><pyqt5><stl-format>
2023-05-12 23:06:32
1
397
trinityalps
76,240,231
7,984,318
IBM DB2 Pyodbc String parameters issue: The invocation of routine "YEAR" is ambiguous. The argument in position "1" does not have a best fit
<p>I'm using IBM Db2 ,and pyodbc.</p> <p>insert_sql:</p> <pre><code>INSERT INTO TABLENAME SELECT ((YEAR('1/1/9999')*12+MONTH('1/1/9999')) - DOUBLE(YEAR(CYCL)*12+MONTH(CYCL))) ... </code></pre> <p>I want to replace '1/1/9999' with a parameter in python code so I used '?' to replace it:</p> <pre><code>INSERT INTO TABLEN...
<python><sql><pyodbc>
2023-05-12 22:12:17
0
4,094
William
76,240,158
617,845
Multi covariate time series forecast using Darts
<p>I am trying to use the tutorial <a href="https://unit8.com/resources/time-series-forecasting-using-past-and-future-external-data-with-darts/" rel="nofollow noreferrer">here</a>, where we have two covariates to predict the target.</p> <p>The tutorial uses <code>.stack()</code> to add two covariates together. It is no...
<python><python-3.x><time-series><multivariate-time-series><u8darts>
2023-05-12 21:55:42
3
1,383
M.M
76,240,108
998,967
django tests - error in github action while running in parallel
<p>in a github action yml file it's defined this step to run django tests:</p> <pre><code>python manage.py test --failfast --parallel 2 </code></pre> <p>looks like <code>--parallel 2</code> breaks it:</p> <pre><code>multiprocessing.pool.RemoteTraceback: &quot;&quot;&quot; Traceback (most recent call last): File &quo...
<python><django><multiprocessing><github-actions><django-testing>
2023-05-12 21:44:23
1
1,844
Luke
76,240,088
17,877,528
Cannot send http request from Flutter to Flask
<p>i'm trying to make a simple request to Flask but i keep getting connection refused.</p> <p>This is my <code>main.py</code></p> <pre><code>import os import sys from konlpy.tag import Kkma, Hannanum, Okt from flask import Flask, jsonify sys.stdin.reconfigure(encoding=&quot;utf-8&quot;) sys.stdout.reconfigure(encoding=...
<python><flutter><dart><flask>
2023-05-12 21:40:09
1
774
José Carlos
76,239,975
11,922,765
Python pandas print week day name of a dataframe
<p>somehow I got dates of the all Mondays, Tuesday and Fridays beginning a specific date for up to next year. Next, I want to print name of the weekday in the next column</p> <pre><code>df = pd.concat([pd.DataFrame(data={'Date':pd.date_range(start='11/07/2022', freq=week_day,end='11/07/2...
<python><pandas><dataframe><datetime>
2023-05-12 21:13:19
2
4,702
Mainland
76,239,956
15,907,013
Vall-e pytorch torch.load returns dict
<p>I am using <code>enhuiz/vall-e</code> but running into a error which is <code>File &quot;vall-e/vall_e/main.py&quot;, line 30, in main ar = torch.load(args.ar_ckpt).to(args.device) AttributeError: 'dict' object has no attribute 'to'</code></p> <p>The issue is mentioned but no one has solved it <code>https://github.c...
<python><pytorch><artificial-intelligence>
2023-05-12 21:10:12
1
539
Jonathan Coletti
76,239,866
396,014
How to combine 3d projections with 2d subplots and set the width
<p>I have working code to generate plots showing x,y,z values for three parameters from an accelerometer, with side-by-side line and 3D plots for each:</p> <pre><code>from mpl_toolkits import mplot3d import numpy as np import pandas as pd import matplotlib.pyplot as plt #code here loads data into a dataframe df fig =...
<python><matplotlib><subplot><matplotlib-3d>
2023-05-12 20:49:22
1
1,001
Steve
76,239,793
6,872,935
Python3: User defined version of Optional type, how to extend the Union type
<p>I have a class, let's call it <code>Foo</code>, and I would like to be able to use a <code>Fooable</code> type that signals that a value may be any union of a given list of types or an instance of the <code>Foo</code> class.</p> <p>This is quite similar to the <code>Optional</code> type but with <code>Foo</code> ins...
<python><python-3.x><types>
2023-05-12 20:34:48
0
562
Jack
76,239,758
21,420,742
How to get count for multiple columns in pandas
<p>I have a dataset I need to get a count of.</p> <pre><code>Manager hire_request hire_approval hired transfer_request transfer_approval transfer Adam 0 0 0 0 1 0 Blake 1 0 0 0 ...
<python><python-3.x><pandas><dataframe><numpy>
2023-05-12 20:30:30
1
473
Coding_Nubie
76,239,693
2,576,839
Python groupby function not recognising that there are keys that are identical that can be "grouped on"
<p>I have a list which I am trying to group by the first element of the nested list. The problem is that my code is not recognising that there are only 5 different values among the grouped on element.</p> <pre><code>a = [['2.25.151989603747108360484758994222924880510', 1], ['2.25.23907329898781253437777953862543062317'...
<python><group-by>
2023-05-12 20:18:57
2
2,178
GhostRider