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 ⌀ |
|---|---|---|---|---|---|---|---|---|
75,575,852 | 7,817,490 | Strange recurring errors downloading python 3.10.9.tgz with wget | <p>I and several workmates have had a recurring problem building python in a docker container under WSL and VirtualBox. The download seems to succeed but then the unzipping reports 'trailing garbage ignored', and the build process exits with value 2. We typically hit this problem a few times, do a manual workaround and... | <python><bash><windows-subsystem-for-linux><wget> | 2023-02-27 00:20:43 | 0 | 489 | Atcrank |
75,575,803 | 607,407 | How can I wrap multiple `with x() as val_x, ...` in a with statement into function for reuse? | <p>I am writing what should've been a simple unit test, but to it turns out I need to mock a bunch of things, and all similar tests will need those. I am using <code>mock.patch</code> from standard library, and now the code looks like this:</p>
<pre><code>with mock.patch("project.folder.file.SomeClass.method"... | <python><python-3.x><unit-testing><mocking><with-statement> | 2023-02-27 00:07:54 | 2 | 53,877 | Tomáš Zato |
75,575,765 | 18,758,062 | Long-running cell in Vscode Jupyter: Reconnecting to the kernel | <p>Whenever I run a Jupyter cell in Vscode that takes a long time to complete, it does not ever seem to complete running the cell.</p>
<p>At the bottom of Vscode, I will see the notification</p>
<blockquote>
<p>Reconnecting to the kernel myvenv (Python 3.8.16)</p>
</blockquote>
<p>Is it possible that this issue is due ... | <python><visual-studio-code><jupyter-notebook><ipython> | 2023-02-26 23:58:56 | 1 | 1,623 | gameveloster |
75,575,730 | 6,367,971 | Concatenate CSVs into dataframe based on timestamp | <p>I have a dir of subdirs that contain CSVs, and I want to concatenate those into a single dataframe. But I only want to do so with files that are the 'the most recently' exported based on a timestamp in the filename.</p>
<p>For example, this is a list of files contained in various sub-dirs:</p>
<pre><code>FileA_20230... | <python><pandas><glob> | 2023-02-26 23:50:46 | 1 | 978 | user53526356 |
75,575,624 | 19,429,024 | How to create a recursive folder menu using pystray? | <p>I am trying to create a navigable tree of folders and subfolders using pystray. I am having trouble creating a recursive menu with pystray.</p>
<p>I am getting an error</p>
<pre class="lang-py prettyprint-override"><code>"TypeError: MenuItem.__init__() takes from 3 to 8 positional arguments but 1757 were given&... | <python><pystray> | 2023-02-26 23:24:49 | 1 | 587 | Collaxd |
75,575,601 | 13,309,379 | Why Union[List[List[int]], List[int]] is casted to List[Union[List[List[int]], List[int]]]? (Correct use of type hints) | <p>I have following code:</p>
<pre><code>from typing import Union,List,Any
v: Union[list[list[int]],list[int]] = [-1,3,1,6,-5] # Create a list of inst
if not isinstance(v[0],list):
v =[v]
v =[v] # Cast list of ints to list of list of ints
print(v)
</code></pre>
<p><code>mypy</code> complains about it in the followi... | <python><type-hinting><mypy> | 2023-02-26 23:17:43 | 1 | 712 | Indiano |
75,575,569 | 2,056,201 | OpenCV not getting proper Confidence values in Java | <p>I am following this tutorial, however my code is in Java for Android and the tutorial is in Python
<a href="https://pyimagesearch.com/2017/09/11/object-detection-with-deep-learning-and-opencv/" rel="nofollow noreferrer">https://pyimagesearch.com/2017/09/11/object-detection-with-deep-learning-and-opencv/</a></p>
<p>I... | <python><java><android><opencv> | 2023-02-26 23:12:10 | 0 | 3,706 | Mich |
75,575,512 | 7,654,476 | How to unite second level ManyToManyFields? | <p>I have models as follows:</p>
<pre class="lang-py prettyprint-override"><code>class Tag(models.Model):
name = models.CharField(max_length=50)
class Element(models.Model):
tags = models.ManyToManyField('Tag')
class Category(models.Model):
elements = models.ManyToManyField('Element')
@property
d... | <python><django><django-queryset><manytomanyfield> | 2023-02-26 23:00:21 | 1 | 443 | shd33 |
75,575,439 | 326,389 | Streamlit slider resetting when changing max_value | <p>I have 2 sliders. The first slider (μ) determines the <code>max_value</code> for the second slider (σ²). Works great with the following code except for a <em>major issue</em>:</p>
<pre><code>mu = st.slider('$\mu$', 0.0, 5.0, 1.0, step=0.1)
var = st.slider('$\sigma^2$', 0.0, mu, 1.0, step=0.1)
</code></pre>
<p>The is... | <python><streamlit> | 2023-02-26 22:43:55 | 1 | 52,820 | at. |
75,575,412 | 1,857,373 | continuous data, Y response not support in the cross_val_score() binary|multiclass for IterativeImputer for BayesianRidge | <p><strong>Problem Defined, Continuous Challenge</strong></p>
<p>This new imputer_bayesian_ridge() function is for Iterative Imputer to impute training data. Sending in data frame training data, then immediately get data.values for numpy array variable. This send or passes a training data with many features, and Y resp... | <python><scikit-learn><cross-validation><imputation> | 2023-02-26 22:35:15 | 1 | 449 | Data Science Analytics Manager |
75,575,346 | 2,377,399 | How can I configure my tools to ignore or prevent updates to the execution_count field in a Jupyter Notebook | <p>I'm using the <code>Jupyter</code> extension (v2022.9.1303220346) in <code>Visual Studio Code</code> (v1.73.1).</p>
<p>To reproduce this issue, make any modification to the notebook and check it into git. You'll observe that you get an extra difference for <code>execution_count</code>. For example (display from <cod... | <python><git><visual-studio-code><jupyter-notebook> | 2023-02-26 22:18:34 | 2 | 6,805 | AlainD |
75,575,330 | 1,445,985 | Python SELECT with parameters: The data types text and nvarchar are incompatible in the equal to operator | <p>Im trying to find out if an entry is already in the database like so:</p>
<pre><code>cursor.execute('SELECT id, text FROM dbo.tags WHERE text = ?', str(tag.text))
row = cursor.fetchone()
</code></pre>
<p>In Microsoft SQL Server Management Studio, I am running SQLEXPRESS server. I have setup the table dbo.tags w... | <python><azure><pyodbc><sql-server-express> | 2023-02-26 22:15:53 | 0 | 5,037 | Chud37 |
75,575,237 | 5,431,734 | package get installed under the include folder and not under site-packages | <p>I am trying to install a package (more specifically <code>diplib</code>) with <code>conda install -c conda-forge diplib</code> but for some reason nothing is added to <code>envs/env_name/lib/site-packages</code>. The command runs fine, no warnings/error at all. Everything looks normal but I am still getting <code>'M... | <python><conda><diplib> | 2023-02-26 21:53:29 | 1 | 3,725 | Aenaon |
75,575,084 | 4,865,723 | Transform a pandas MultiIndex to a single Index using indention | <p>I have a <code>pandas.DataFrame</code> with a <code>pandas.MultiIndex</code> like this:</p>
<pre><code> Vals
Fruits Apples a
Banana b
Vegetables Tomato c
Onion d
Potato e
Foobar LoreIpsum f
</code></pre>
<p>I want to trans... | <python><pandas> | 2023-02-26 21:21:42 | 1 | 12,450 | buhtz |
75,574,972 | 12,436,050 | Internal server error while passing parameters in API endpoint URL in Python 3.7 | <p>I would like to perform a GET operation to an API endpoint. Following is the base URL.</p>
<pre><code>#GET /v{version}/lists/{list-id}/terms/{term-id}/preferred-name
url = "https://abcd.eu/v{version}/lists/{list-id}/terms/{term-id}/preferred-name"
headers = {'Accept': 'application/json'}
params = {'versi... | <python><python-requests> | 2023-02-26 20:58:18 | 1 | 1,495 | rshar |
75,574,916 | 5,024,631 | pandas: group dataframe rows into different clusters | <p>I have this dataframe:</p>
<pre><code>df = pd.DataFrame({
'forms_a_cluster': [False, False, True, True, True, False, False, False,
True, True, False, True, True, True, False],
'cluster_number':[False, False, 1, 1, 1, False, False, False,
2, 2, False, 3, 3, 3, False]})
</code></pre>
<p>The idea is that ... | <python><pandas><dataframe><group-by><grouping> | 2023-02-26 20:47:29 | 2 | 2,783 | pd441 |
75,574,884 | 179,372 | Converting from dictionary to Dask HighLevelGraph | <p>Dask's <a href="https://docs.dask.org/en/stable/high-level-graphs.html" rel="nofollow noreferrer">HighLevelGraph</a> has a method to convert it to a Python <code>dict</code>, however, it is not clear how to build the <code>HighLevelGraph</code> from a <code>dict</code> (doing the reverse process). Alternatively, is ... | <python><dask> | 2023-02-26 20:40:35 | 1 | 20,050 | Tarantula |
75,574,875 | 11,693,768 | Merge or append 2 dataframes row wise and add a check in a separate column determining which one it came from | <p>I have the following 2 dataframes, <code>df1</code>,</p>
<pre><code>import pandas as pd
data = {
'commonshortname': ['SNX.US', '002400.CH', 'CDW.US', 'CEC.GR', '300002.CH'],
'altshortname': ['SNX.US', '002400.SHE', 'CDW.US', 'CEC.XETRA', '300002.SHE'],
'Code': ['SNX', '002400', 'CDW', 'CEC', '300002', .... | <python><pandas><dataframe><merge><concatenation> | 2023-02-26 20:39:31 | 2 | 5,234 | anarchy |
75,574,661 | 3,314,953 | writing to a temp file in python with a for loop | <p>The code in <em>Example 1</em> below writes a single line into a temp file. I was expecting it to write multiple lines into the temp file as is shown in <em>Example 2</em>, which writes 94 lines to the console. Cause the <code>temp.write(shift(alphabet,i))</code> is in the same place of the loop as <code>print(shif... | <python><python-3.x> | 2023-02-26 19:58:13 | 0 | 850 | Whitequill Riclo |
75,574,639 | 2,369,000 | Setting values in a pandas multi-index cross-sectional slice | <p>I would like to set the value of a cross section to the value relative to the mean. The code below sets the values to null, but I would like the values to be -5 and 5. Is there an easily readable way to do this without looping through each column in the index?</p>
<pre><code>import pandas as pd
x = pd.DataFrame({'a... | <python><pandas><multi-index> | 2023-02-26 19:52:28 | 1 | 461 | HAL |
75,574,461 | 4,442,337 | Debug dockerized Django application running Uvicorn - ASGI on VSCode? | <p>I'm trying to run <a href="https://pypi.org/project/debugpy/" rel="nofollow noreferrer">debugpy</a> in attach mode to debug on VScode a dockerized Django app. With the following configuration on <code>launch.json</code></p>
<pre class="lang-json prettyprint-override"><code>{
"version": "0.2.0"... | <python><django><docker><visual-studio-code><uvicorn> | 2023-02-26 19:21:44 | 1 | 2,191 | browser-bug |
75,574,407 | 20,266,647 | Issue with ingest values, 2x more | <p>When I ingested values to the feature set, the pipeline was called 2x more (I used MLRun version 1.2.1). It seems as the issue, do you know why?</p>
<p>I used this code:</p>
<pre><code>import mlrun
import mlrun.feature_store as fstore
# mlrun: start-code
import math
def calc(x):
x['fn2']=math.sin(x['fn2'])*100... | <python><data-ingestion><mlops><feature-store><mlrun> | 2023-02-26 19:13:40 | 1 | 1,390 | JIST |
75,574,250 | 386,861 | How to scrape data into PythonAnywhere database | <p>I have a database on PythonAnywhere and credentials in place.</p>
<p>The aim is to scrape a whole load of news websites and chuck the data into a new website using Flask.</p>
<p>Here's my code for a section of my website. (I've ignored the imports because it runs)</p>
<pre><code>@app.route("/nationals")
de... | <python><pandas><flask><feedparser> | 2023-02-26 18:44:26 | 1 | 7,882 | elksie5000 |
75,574,174 | 6,367,971 | Forward fill dataframe column if string is present in another column | <p>I have a dataframe and I want to forward fill one of the columns but only if the string is present in one of the other columns.</p>
<pre><code> Type Match Matchup
0 Parent ABC_12252000_NY_Leag_Natl_en-NY_RegSeason_NYY-vs-LAA NYY-vs-LAA
1 Child ABC_1... | <python><pandas><dataframe> | 2023-02-26 18:30:23 | 1 | 978 | user53526356 |
75,574,109 | 17,696,880 | How to remove consecutively repeated strings only if this strings are in the middle of "((VERB)" and ")"? | <pre><code>import re
input_text = "((VERB) saltar a nosotros a nosotros) a nosotros a nosotros a nosotros ((VERB)correr a nosotros) sdsdsd ((VERB) saltar a nosotros a nosotros)"
input_text = re.sub(r"\(\(VERB\)" + r"((?:\w\s*)+)" + r"\)",
lambda x: re.sub(r... | <python><python-3.x><regex><string><regex-group> | 2023-02-26 18:19:55 | 2 | 875 | Matt095 |
75,573,824 | 13,518,907 | "collate_fn" for Huggingface Hyperparameter Tuning | <p>I am following <a href="https://wandb.ai/matt24/vit-snacks-sweeps/reports/Hyperparameter-Search-for-HuggingFace-Transformer-Models--VmlldzoyMTUxNTg0" rel="nofollow noreferrer">this</a> tutorial on how to do hyperparameter tuning with Huggingface and Wandb.
Most of it works but I don't quite understand what the "... | <python><pytorch><huggingface-transformers><collate><wandb> | 2023-02-26 17:33:06 | 1 | 565 | Maxl Gemeinderat |
75,573,658 | 244,297 | How to use binary search on an existing SortedList with a key function? | <p>I would like to use binary search on a <a href="https://grantjenks.com/docs/sortedcontainers/sortedlist.html#sortedlist" rel="nofollow noreferrer"><code>SortedList</code></a> with a key function, e.g. similarly to <a href="https://docs.python.org/3/library/bisect.html#bisect.bisect_right" rel="nofollow noreferrer"><... | <python><binary-search><sortedcontainers> | 2023-02-26 17:08:53 | 2 | 151,764 | Eugene Yarmash |
75,573,612 | 12,767,387 | How can I create multiple msi installers for the same script with different parameters using cx_Freeze? | <p>I want to create many msi installers from one tkinter script with different parameters to distribute it to different customers. I want this, because I have to change the default installation directory and GUID. I am using the latest stable version of the <code>cx_Freeze</code> package and <code>Python 3.7.9</code>. ... | <python><tkinter><cx-freeze> | 2023-02-26 17:02:56 | 1 | 542 | Paweł Kowalski |
75,573,482 | 2,758,414 | Why conda doesn't see the latest version of sqlalchemy package available in the conda-forge channel? | <p>I'm trying to install <code>sqlalchemy</code> with conda.</p>
<pre><code>conda install -c conda-forge sqlalchemy
</code></pre>
<p>On the channel website I can see that the latest available version is 2.0.4.</p>
<p><a href="https://anaconda.org/conda-forge/sqlalchemy" rel="nofollow noreferrer">https://anaconda.org/co... | <python><sqlalchemy><anaconda><conda><conda-forge> | 2023-02-26 16:42:29 | 1 | 2,747 | LLaP |
75,573,439 | 8,618,242 | Error in installing pip package with setup.py requirements | <p>I'm trying to install the <a href="https://pypi.org/project/aptdaemon" rel="nofollow noreferrer">aptdaemon</a> package on Ubuntu <code>20.04</code> as follows: <code>pip3 install aptdaemon</code> but I'm getting an error:</p>
<p><code>error in setup.cfg: command 'build' has no such option 'i18n'</code></p>
<p>I have... | <python><pip><package> | 2023-02-26 16:35:48 | 2 | 4,115 | Bilal |
75,573,426 | 1,203,556 | Using flutter flutter_image_compress to upload base64 compressed file but cant uncompress in python | <p>I can successfully upload a file to s3 by</p>
<ol>
<li>using flutter_image_compress to compress and</li>
<li>converting the file to base64.</li>
</ol>
<p>Now I can decode the file:</p>
<pre><code> base64_string = open("img1b95b3ed9e494595b01610f06d9f074b.txt", "r").readlines()[0]
</code></pre>
<... | <python><python-3.x><flutter><dart> | 2023-02-26 16:33:36 | 1 | 78,780 | Tampa |
75,573,420 | 10,596,249 | elasticesearch adding keyword not working | <p>error:</p>
<pre><code> {"timestamp": "2023-02-26T16:06:23.388759Z", "level": "INFO", "name": "denali_syncer.opensearch",
"message": "create index cd.io.schema.asset mapping, status 400, body: b'{\"error\":{\"root_cause\&... | <python><elasticsearch> | 2023-02-26 16:32:54 | 1 | 806 | soubhagya |
75,573,390 | 5,985,593 | GStreamer Python: gi.repository.GLib.GError: gst_parse_error: no element "appsrc" on OSX | <p>I'm trying to setup a RTSP stream in Python with OpenCV. I found <a href="https://github.com/prabhakar-sivanesan/OpenCV-rtsp-server/issues?q=is%3Aissue%20is%3Aclosed" rel="nofollow noreferrer">this repository</a> which I started from as an example. I'm pretty sure the code in there is not entirely written by that pe... | <python><macos><homebrew><gstreamer> | 2023-02-26 16:27:39 | 0 | 1,630 | JC97 |
75,573,119 | 4,920,221 | stop termination of pyspark stream when testing | <p>I have a PySpark stream that reads from Kafka, and writes to an Apache Hudi table, for example</p>
<pre class="lang-py prettyprint-override"><code>def write_batch_to_hudi(batch_df, batch_id):
new_df = here_im_getting_new_df(batch_df)
write_to_hudi(new_df)
def stream(spark):
df = read_stream_from_ka... | <python><pyspark><pytest> | 2023-02-26 15:44:10 | 1 | 324 | Kallie |
75,573,094 | 498,504 | Flask project always got error "We're sorry, but something went wrong" | <p>I'm a beginner in Flask and I have developed a face-detection application based on it. I had many problems when deploy project on a cPanel host and can solve that one by one. But now have another problem that always say me <strong>We're sorry, but something went wrong</strong> and I do not know what is problem becau... | <python><flask> | 2023-02-26 15:41:02 | 1 | 6,614 | Ahmad Badpey |
75,572,878 | 962,891 | Shading regions inside an mplfinance chart | <p>I am using matplotlib v 3.7.0, mplfinance version '0.12.9b7', and Python 3.10.</p>
<p>I am trying to shade regions of a plot, and although my logic seems correct, the shaded areas are not being displayed on the plot.</p>
<p>This is my code:</p>
<pre><code>import yfinance as yf
import mplfinance as mpf
import pandas ... | <python><matplotlib><mplfinance> | 2023-02-26 15:07:09 | 1 | 68,926 | Homunculus Reticulli |
75,572,698 | 4,879,688 | How to load and inspect a gmsh mesh (*.msh file) | <p>I want to programmatically inspect <em>*.msh</em> files (get a number of nodes and elements, possibly also edges and faces). How can I do this with either <code>gmsh</code> or <code>pygmsh</code> module? All tutorials I have found so far focus mostly on mesh generation. I can not find any function to read the mes... | <python><mesh><gmsh><meshio> | 2023-02-26 14:36:51 | 2 | 2,742 | abukaj |
75,572,543 | 8,536,211 | What to look out for when passing a generator into model.fit in tensorflow? | <p>I want to replace the x and y training data parameters in tf.keras.Model.fit with a generator. However, some subtlety seems to escape me, as the model accuracy doesn't improve with the generator when training.</p>
<p>As far as I understand the documentation, the generator is supposed to yield tuples <code>(x_vals,y_... | <python><tensorflow><keras> | 2023-02-26 14:08:48 | 0 | 360 | Sudix |
75,572,272 | 386,861 | How to turn a string column of quarterly data in pandas into sompething I can plot | <p>I have a dataframe that looks like this:</p>
<p>oops:</p>
<pre><code> Quarter London UK NaN
6 Mar-May 1992 0.12305 0.098332 NaN
7 Apr-Jun 1992 0.123895 0.097854 NaN
8 May-Jul 1992 0.124076 0.098878 NaN
9 Jun-Aug 1992 0.127796 0.099365 NaN
10 Jul-... | <python><pandas> | 2023-02-26 13:21:41 | 1 | 7,882 | elksie5000 |
75,572,209 | 1,432,980 | create a new dataframe column using the data from other column on condition | <p>I have a data frame that looks like this</p>
<pre><code> Name Default Expression Override Expression
0 AACT_NAM pystr pyint
1 ACCT_CCY pystr
2 ACCT_TYP pystr
</code></pre>
<p>I want to create a column, <code>_faker_method_</code> that would contain specially... | <python><pandas><dataframe> | 2023-02-26 13:10:57 | 1 | 13,485 | lapots |
75,572,028 | 17,718,870 | Unexpected timing result after micro-optimization | <p>I've been doing some experiments with some micro-optimizations and got an unexpected timing result, which I couldn't wrap around my head. I would be very thankful for your suggestions.</p>
<p>Following the code :</p>
<pre><code>def findSmallest(arr):
smallest = arr[0]
smallest_indx = 0
for i in range(1,... | <python><optimization> | 2023-02-26 12:39:31 | 1 | 869 | baskettaz |
75,571,961 | 5,195,209 | Uploading multiple files to release on Github using Python | <p>I am trying to create a release and upload all files with a specific ending as an asset. My code is as follows:</p>
<pre class="lang-py prettyprint-override"><code># This uploads all apkg files in the current directory to a release on GitHub.
import github
import dotenv
import os
import glob
dotenv.load_dotenv()
... | <python><github><post><pygithub> | 2023-02-26 12:25:59 | 0 | 587 | Pux |
75,571,754 | 16,444,630 | Numpy giving wrong Eigenvectors | <pre><code>from numpy.linalg import eig
import numpy as np
A = np.array([[1,2],[3,4]])
eval, evec = eig(A)
print("Eigenvectors:", evec)
</code></pre>
<p>gives:</p>
<pre><code>Eigenvectors: [[-0.82456484 -0.41597356]
[ 0.56576746 -0.90937671]]
</code></pre>
<p>while in mathematica:</p>
<pre><c... | <python><numpy> | 2023-02-26 11:46:14 | 1 | 317 | Sophile |
75,571,703 | 17,696,880 | How to find nested patterns within a string, and merge them into one using a regex reordering of the string? | <pre class="lang-py prettyprint-override"><code>import re
#example input string:
input_text = "here ((PERS)the ((PERS)Andys) ) ((PERS)assása asas) ((VERB)asas (asas)) ((PERS)saasas ((PERS)Asasas ((PERS)bbbg gg)))"
def remove_nested_pers(match):
# match is a re.Match object representing the nested patter... | <python><regex> | 2023-02-26 11:36:55 | 1 | 875 | Matt095 |
75,571,432 | 1,354,439 | Python Celery: 2-way communication between worker and task requester | <p>I am trying to achieve 2 way communication between the worker and the task requester, once the task has been scheduled. So far I was only able to achieve one-way communication (worker -> requester):</p>
<pre class="lang-py prettyprint-override"><code>@app.task(bind=True)
def long_task(self: celery.Task):
time... | <python><celery> | 2023-02-26 10:44:58 | 0 | 5,979 | Piotr Dabkowski |
75,571,298 | 19,989,634 | Like button not recording the data | <p>I have implemented a like button onto my view_post page, but the like's aren't been registered. When the button is clicked the page is redirected correctly but no likes are added.</p>
<p><strong>views</strong></p>
<pre><code>def get_post(request, slug):
try:
post = BlogPost.objects.get(slug=slug)
exc... | <python><django><django-views><django-forms><django-urls> | 2023-02-26 10:16:45 | 1 | 407 | David Henson |
75,571,167 | 9,475,509 | Download model 'en' for spacy produces "TypeError: can only concatenate list (not 'tuple') to list" | <p>While installing <code>spacy-2.3.6</code> after <code>chatterbot-1.0.8</code> in <code>virtualenv-20.19.0</code> with <code>python-3.7.0</code>, I receive error message</p>
<pre><code>OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link,
a Python package or a valid path to a data directory
</... | <python><pip><concatenation><spacy><chatterbot> | 2023-02-26 09:49:43 | 1 | 789 | dudung |
75,571,163 | 12,579,308 | cv2 imshow right click dropdown menu disappears immediately | <p><strong>Problem</strong></p>
<p><img src="https://i.sstatic.net/O2uDh.gif" alt="problem illustration" /></p>
<p>When I use cv imshow with the code below, I cannot use the right click to see the dropdown menu.</p>
<p><strong>Code</strong></p>
<pre><code>import cv2
image_path = "/nas/data/IST/FODCam/230216/c6/p83... | <python><opencv><visual-studio-code><jupyter-notebook> | 2023-02-26 09:49:14 | 0 | 341 | Oguz Hanoglu |
75,571,138 | 18,107,780 | Flet paking into macos application | <p>I'm trying to convert a python flet application into a macos application.
I'm using the flet cli with the command <code>flet pack</code>.</p>
<p>The project files tree is:</p>
<pre><code>PyFlutter
|_ assets
| |_ fonts
| | |_font
| |_ image.png
|_ backend.py
|_ credentials.log
|_ main.py
|_ icon.png
</code></pre>... | <python><macos><unix><flet> | 2023-02-26 09:42:03 | 1 | 457 | Edoardo Balducci |
75,571,055 | 17,696,880 | How to add a whitespace before "((VERB)" only if it is not preceded by a space or the beginning of the string? | <pre><code>import re
#input string example:
input_text = "((VERB)ayudar a nosotros) ár((VERB)ayudar a nosotros) Los computadores pueden ((VERB)ayudar a nosotros)"
#this give me a raise error("look-behind requires fixed-width pattern") re.error: look-behind requires fixed-width pattern
#input_text... | <python><python-3.x><regex><string><regex-lookarounds> | 2023-02-26 09:24:36 | 2 | 875 | Matt095 |
75,571,036 | 3,728,901 | TorchStudio cannot run | <p>I seen <a href="https://www.youtube.com/watch?v=aNKTdMWO56w" rel="nofollow noreferrer">https://www.youtube.com/watch?v=aNKTdMWO56w</a> . Then I install TorchStudio. My PC: Windows 11 x64, Python 3.10 . I go to homepage of TorchStudio <a href="https://www.torchstudio.ai/" rel="nofollow noreferrer">https://www.torchst... | <python><pytorch><torchstudio> | 2023-02-26 09:21:41 | 1 | 53,313 | Vy Do |
75,571,009 | 573,082 | Why I get "cannot unpack" error with PythonNet but not with IronPython? | <p>I tried to connect to socket with <code>IronPython</code> and everything worked. But, when I try with <code>Python.Runtime</code> I get <code>Python.Runtime.PythonException: 'cannot unpack non-iterable ValueTuple[String,Int32] object'</code> exception. I use <code>PythonRuntime</code> for <code>python3.8</code></p>
... | <python><c#><ironpython> | 2023-02-26 09:14:51 | 0 | 14,501 | theateist |
75,570,862 | 6,630,397 | django-two-factor-auth[phonenumbers] got a redundant migration -> psycopg2.errors.DuplicateTable: relation "two_factor_phonedevice" already exists | <p>I'm facing the following database creation table error when spinning up a <a href="https://www.djangoproject.com/" rel="nofollow noreferrer">django</a> project <em>from scratch</em> when I have <a href="https://github.com/jazzband/django-two-factor-auth" rel="nofollow noreferrer"><code>django-two-factor-auth[phonenu... | <python><django><totp><django-two-factor-auth> | 2023-02-26 08:42:36 | 1 | 8,371 | swiss_knight |
75,570,857 | 2,908,017 | How to change Label font size in Python FMX GUI app | <p>I'm using the <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI library for Python</a> and trying to change the font size on a <code>Label</code> component, but it's not working.</p>
<p>I have the following code to create the <code>Form</code> and the <code>Label</code... | <python><user-interface><firemonkey> | 2023-02-26 08:41:28 | 1 | 4,263 | Shaun Roselt |
75,570,840 | 16,363,897 | Pandas ewm correlation - not rolling | <p>I have the following pandas dataframe:</p>
<pre><code> a b c
2023-01-01 35 34 17
2023-01-02 85 54 31
2023-01-03 33 8 27
2023-01-04 95 9 45
2023-01-05 71 98 7
</code></pre>
<p>I want to calculate today's (2023-01-05) EWM correlations between the 3 series.</p>
<p>I tried</p>
<pre><cod... | <python><pandas><dataframe> | 2023-02-26 08:36:31 | 1 | 842 | younggotti |
75,570,839 | 7,959,614 | Asyncio run Task conditional of another Task | <p>I want to run a task infinitely. Basically, the script needs to do the following:</p>
<ul>
<li>check each week if there is a match</li>
<li>sleep until the match starts</li>
<li>create a connection with the websocket</li>
<li>check the status of a match using a subscription query</li>
<li>depending on the status of ... | <python><graphql><python-asyncio> | 2023-02-26 08:36:15 | 1 | 406 | HJA24 |
75,570,820 | 4,653,436 | pynamodb last_evaluated_key always return null | <p>I'm using <code>Pynamodb</code> for interacting with <code>dynamodb</code>.
However, last_evaluated_key always returns null even if there are multiple items.
When I run this query</p>
<pre><code>results = RecruiterProfileModel.profile_index.query(
hash_key=UserEnum.RECRUITER,
scan_index_forward=False... | <python><amazon-dynamodb><nosql><dynamodb-queries><pynamodb> | 2023-02-26 08:33:09 | 2 | 10,911 | Koushik Das |
75,570,612 | 6,952,996 | mock a specific file with mock_open in Python | <p>I use this code snippet (From: <a href="https://stackoverflow.com/questions/69670597/how-do-i-mock-a-file-open-for-a-specific-path-in-python">How do I mock a file open for a specific path in python?</a>)</p>
<pre class="lang-py prettyprint-override"><code>builtin_open = open
def my_mock_open(*args, **kwargs):
if... | <python><python-3.x><mocking><pytest> | 2023-02-26 07:46:04 | 1 | 937 | Johnathan |
75,570,578 | 19,504,610 | pyo3: Passing a reference of Rust's Self into a method of Self with attribute `#[classmethod]` | <p>Context of my question:</p>
<p>In <a href="https://docs.pydantic.dev/usage/types/#classes-with-__get_validators__" rel="nofollow noreferrer">pydantic</a>'s, you can define a <code>CustomType</code>, which is any python class with the following class method named <code>__get_validators__(cls)</code> defined. The obje... | <python><rust><pyo3><python-bindings> | 2023-02-26 07:37:05 | 0 | 831 | Jim |
75,570,567 | 6,820,121 | write ANTLR regex when declaring variables list | <p>I've wrote a grammar rule for a language in ANTLR as below:</p>
<pre><code>variable: idlist COLON type (EQUAL explist)? SEMI;
idlist: identifier (COMMA identifier)*;
explist: exp (COMMA exp)*;
COLON: ':';
EQUAL: '=';
SEMI: ';';
COMMA: ',';
</code></pre>
<p>This input is valid for above grammar:</p>
<pre><code>a, b,... | <python><regex><antlr><antlr4> | 2023-02-26 07:33:39 | 2 | 621 | Duy Duy |
75,570,533 | 2,315,911 | Python pandas groupby: how to use variables in different columns to create a new one | <p>Consider the following <code>DataFrame</code>:</p>
<pre><code>df = pd.DataFrame({'c0':['1980']*3+['1990']*2+['2000']*3,
'c1':['x','y','z']+['x','y']+['x','y','z'],
'c2':range(8) })
c0 c1 c2
0 1980 x 0
1 1980 y 1
2 1980 z 2
3 1990 x 3
4 1990 y 4
5 200... | <python><pandas><dataframe><group-by> | 2023-02-26 07:24:30 | 4 | 1,300 | Spring |
75,570,527 | 9,006,687 | Numpyro: Error when using MCMC with a model that uses scan | <p>I am trying to get the following model to work:</p>
<pre><code>def model_dynamic(self, hemp_size_t, values_t):
# Unpack the values at time t
t, actions_performed = values_t
# Check if harvesting are performed at time step t
harvest = self.is_performed("harvest-hemp", actions_performed)
... | <python><numpyro> | 2023-02-26 07:23:33 | 0 | 461 | Theophile Champion |
75,570,474 | 14,749,391 | How to create a reusable postgresql connection in a multithreaded python application | <p>I'm working on a multithreaded project that makes many database queries but the method now is creating a new database connection in thread every time before executing the queries and closing it after. As this is heavy operation I need a way to create a connection once and reuse it multiple times through the app. I'v... | <python><postgresql> | 2023-02-26 07:06:23 | 0 | 772 | Tony |
75,570,422 | 4,357,210 | How do I import a .pyd module written in C++ to Python using PyBind11 | <p>I am working on Windows 10 with Python <code>3.9.7</code> and have anaconda setup on my laptop.
I have compiled a C++ code <code>calcSim.cpp</code> where the module name is <code>calJaccSimm</code> and am able to successfully generate a .pyd file with the following extension <strong>.cp39-win_amd64.pyd</strong> as d... | <python><windows-10><python-3.9><pybind11> | 2023-02-26 06:51:28 | 1 | 3,116 | tushaR |
75,570,417 | 2,218,321 | How the errors of each epoch must look like in machine learning? | <p>This is the first model I created in PyTorch and I'm new to this field. I ran the model for a few epochs and this is the output of errors for each epoch for two runs of the algorithm.</p>
<p><a href="https://i.sstatic.net/7x5Ue.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7x5Ue.jpg" alt="enter imag... | <python><machine-learning><pytorch> | 2023-02-26 06:50:27 | 1 | 2,189 | M a m a D |
75,570,151 | 13,194,245 | Convert Pandas dataframe to an api format | <p>I the following pandas dataframe:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'Year': [2023, 2024, 2022,2022, 2023,2025,2024,2025,2022,2023],'Name': ['John', 'Jim', 'John','Jim', 'John','Jim','John','Jim','John','Jim']
,'Month': ['Jan', 'Jan', 'Feb','Jan', 'Jan','Feb','Jan','Jan','Feb','... | <python><pandas> | 2023-02-26 05:28:50 | 0 | 1,812 | SOK |
75,569,990 | 1,503,669 | how to use Python get the image URL and this URL is dynamically loaded after the page was loaded, and I can't find this URL in the API call? | <p>My target is to get the Full image URL and download this picture.</p>
<p>Page URL:
<a href="https://allinone.pospal.cn/m#/details/6223421" rel="nofollow noreferrer">https://allinone.pospal.cn/m#/details/6223421</a></p>
<p>The challenge is this URL is dynamically loaded after the page is loaded.</p>
<p>I can't find t... | <python><selenium-webdriver><web-scraping><beautifulsoup> | 2023-02-26 04:21:51 | 1 | 513 | Panco |
75,569,941 | 572,575 | How to find best number of layer and best size of hidden layer of MLP in GridsearchCV | <p>I want to use GridsearchCV find best number of layer and best size of hidden layer. I try to set hidden layer as list find best number of hidden layer.</p>
<pre><code> df = pd.read_csv(r'C:\\Users\data.csv')
X = df.iloc[:,:20]
Y = df.iloc[:,20]
X_train, X_test, y_train, y_test = train_te... | <python><pandas><scikit-learn><grid-search> | 2023-02-26 04:02:48 | 1 | 1,049 | user572575 |
75,569,885 | 10,773,854 | Error of Graph disconnected is raised when I create an autoencoder | <p>I am trying to create an autoencoder, but I meet this error <code>raise ValueError( ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor(type_spec=TensorSpec(shape=(None, 32), dtype=tf.float32, name='input_2'), name='input_2', description="created by layer 'input_2'") at layer "d... | <python><deep-learning><autoencoder> | 2023-02-26 03:44:22 | 0 | 337 | New_student |
75,569,836 | 99,989 | In Python, is there a way to do a partial application with types? | <p>I'm trying to understand how to annotate a function that may be a method:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Callable, Generic, Protocol, TypeVar, overload, Any
from typing_extensions import ParamSpec, Self, Concatenate
V_co = TypeVar("V_co", covariant=True)
U = TypeVa... | <python><python-typing> | 2023-02-26 03:28:08 | 0 | 33,551 | Neil G |
75,569,735 | 10,184,226 | Given that f(x) is a function satisfying f(1)=1 and for any x belongs to R, f(x+5) >= f(x) + 5 and f(x+1)<=f(x)+1. if g(x) = f(x) +5 - x, find g(2022) | <p>I am struggling to solve this problem,
I couldn't understand the mathmatics to solve this problem, it will be really helpful if anyone can help me with this problem.</p>
<p>Its already 12 hours I am continiously trying to think but its getting out of my head :( please help me.</p>
<p>And I want to solve this using p... | <python> | 2023-02-26 02:54:02 | 0 | 301 | Arjun Ghimire |
75,569,641 | 4,348,400 | Transparent highlight in XKCD plot? | <p>I would like to use some XKCD style plots on my blog. Here is an example figure:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
import numpy as np
with plt.xkcd():
fig = plt.figure()
ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
ax.spines[['top', 'right']].set_visible(Fal... | <python><matplotlib><transparency> | 2023-02-26 02:19:47 | 1 | 1,394 | Galen |
75,569,620 | 6,367,971 | Splitting dataframe at underscore within a range | <p>I have rows in a dataframe that I want to split on a <em>range</em> of underscores, and save the split values into new columns.</p>
<pre><code> Type Name
Parent ABC_US_Test_en-us
Child ABC_12252020_US_Test_Natl_en-us_Home-vs-... | <python><pandas><dataframe> | 2023-02-26 02:11:48 | 2 | 978 | user53526356 |
75,569,573 | 15,775,069 | How to Implment feature similar to python's inspect module in rust? | <p>I recently started learning rust and this maybe a very stupid question.</p>
<p>I have a large-ish codebase in python that sort of looks like this (this is all pseudocode as I can't post the original code, it's proprietary):</p>
<pre><code>main_package/
main.py
transforms/
__init__.py
base_transform... | <python><rust> | 2023-02-26 01:53:56 | 0 | 361 | yuser099881232 |
75,569,521 | 13,376,511 | Why does math.cos(math.pi/2) not return zero? | <p>I came across some weird behavior by <code>math.cos()</code> (Python 3.11.0):</p>
<pre><code>>>> import math
>>> math.cos(math.pi) # expected to get -1
-1.0
>>> math.cos(math.pi/2) # expected to get 0
6.123233995736766e-17
</code></pre>
<p>I suspect that floating point math might play a ... | <python><floating-point><trigonometry><pi> | 2023-02-26 01:35:36 | 3 | 11,160 | Michael M. |
75,569,496 | 2,118,290 | Strange Behavior With python FastAPI and transmission for a URL Encoded SHA1 | <p>So I was trying to put together my own bittorent announce server in python, and iv run into a bit of a snag. For some reason I cant seem to get FastAPI to decode the URL Encoded SHA1 field of info_hash correctly.</p>
<p>As an example, I'm using the Ubuntu Torrent file, and receive a request like so:</p>
<pre><code>G... | <python><fastapi><bittorrent> | 2023-02-26 01:29:23 | 0 | 674 | Steven Venham |
75,569,433 | 14,029,775 | Dictionary as argument for groupby and aggregate dataframe in Python | <p>How can I use a dictionary as the argument for dataframe groupby and aggregate?</p>
<p>For example, instead of hard coding the arguments like below...</p>
<pre><code>grouped_multiple = df.groupby('experience_level','job_title').agg({'salary': ['mean', 'min', 'max']})
</code></pre>
<p>I would like to use the values o... | <python><pandas><dataframe> | 2023-02-26 01:09:45 | 1 | 365 | Jonathan Chen |
75,568,963 | 219,153 | What is the fastest way to get the number of neighbor nodes with NetworkX? | <p>Here is the benchmark testing a few options:</p>
<pre><code>import numpy as np, timeit as ti, networkx as nx
from more_itertools import ilen
g = nx.ladder_graph(1000)
n = g.number_of_nodes()
fun = f'sum(len(g.adj[i]) for i in range(n))'
t = 1000 * np.array(ti.repeat(stmt=fun, setup='', globals=globals(), number=1,... | <python><performance><networkx> | 2023-02-25 22:57:28 | 0 | 8,585 | Paul Jurczak |
75,568,863 | 1,219,317 | How to get varying shades of red colour based on an input value in python? | <p>In python, how can I get varying shades of the red/yellow colour based on an input value between -1 and 1? If the value is between -1 and 0, the function should return yellow colour.
If the value is between 0 and 1, the function should return various levels or shades of the red colour. More specifically, if the valu... | <python><matplotlib><colors><hex><rgb> | 2023-02-25 22:32:30 | 1 | 2,281 | Travelling Salesman |
75,568,711 | 13,508,045 | Overload type hint with Literal and Enum not working in PyCharm | <p>I want to typehint an overload function. For that I use the <code>overload</code> decorator from <code>typing</code>. I want to set multiple possible callees based on a parameter's value. This parameter is <code>color</code>.</p>
<p>I have this code:</p>
<pre class="lang-py prettyprint-override"><code>from typing im... | <python><pycharm><type-hinting> | 2023-02-25 21:57:03 | 1 | 1,508 | codeofandrin |
75,568,354 | 13,642,459 | rgb2hed not giving the same answer when applied to a full or part matrix | <p>I have an image in rgb format that is loaded into a 3D numpy array. I would like to convert this image from RGB to HED using the <code>rgb2hed</code> function from <code>skimage.color</code>.</p>
<pre><code>import numpy as np
from skimage.color import rgb2hed
np.random.seed(42)
img = np.random.randint(0, 255, (10, 1... | <python><numpy><scikit-image> | 2023-02-25 20:52:41 | 0 | 456 | Hugh Warden |
75,568,346 | 11,825,717 | Get real-time progress updates from a Python script in R | <p>I would like to get real-time progress updates from a Python script running in the background.</p>
<h3>Python script</h3>
<pre class="lang-py prettyprint-override"><code>from time import sleep
for i in range(10):
print(f'file{i}.txt')
sleep(1)
print('done')
</code></pre>
<p>I thought I could use a <code>pipe... | <python><r><pipe><reticulate> | 2023-02-25 20:51:21 | 0 | 2,343 | Jeff Bezos |
75,568,254 | 18,806,499 | ImportError: cannot import name 'ParameterSource' from 'click.core' | <p>I'm working on simple flask app, and I received this error</p>
<pre><code> from click.core import ParameterSource
ImportError: cannot import name 'ParameterSource' from 'click.core' (/usr/local/lib/python3.10/dist-packages/click/core.py)
</code></pre>
<p>I don't know why it's appearing, because everything was fin... | <python><importerror> | 2023-02-25 20:35:27 | 6 | 305 | Diana |
75,568,249 | 14,386,187 | Error when trying to import module from different folder | <p>I have the following directory structure:</p>
<pre><code>foo.py
│
└─── foodir/
│
└─── foofunc1.py
│
└─── foofunc2.py
</code></pre>
<p>I have a file <code>foo.py</code> that I'm trying to run that imports a function <code>func1</code> from <code>foofunc1.py</code> that relies on an import <code>func2... | <python> | 2023-02-25 20:33:52 | 0 | 676 | monopoly |
75,568,211 | 11,940,581 | Module/Package resolution in Python | <p>So I have a project directory "dataplatform" and its contents are the follows:</p>
<pre><code> ── dataplatform
├── __init__.py
├── commons
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-38.pyc
│ │ ├── get_partitions.cpython-38.pyc... | <python><python-3.x><hadoop><hdfs><hadoop2> | 2023-02-25 20:25:57 | 1 | 371 | halfwind22 |
75,568,009 | 12,349,101 | Tkinter - How to resize frame containing a text widget (in all directions)? | <p>I'm trying to resize certain layered tkinter components, mostly because I'm curious. Right now, seems stuck in trying to resize a frame containing a text widget. here is my attempt:</p>
<pre class="lang-py prettyprint-override"><code>import tkinter as tk
def make_draggable(widget):
widget.bind("<Button-... | <python><tkinter><resize><tkinter-text> | 2023-02-25 19:49:55 | 1 | 553 | secemp9 |
75,567,969 | 3,668,129 | How to plot 2 subplots of wav spectogram file? | <p>I have 2 wav files (with same sampling rate) and I want to display their spectogram side by side.</p>
<p>I'm using the code from here (<a href="https://librosa.org/doc/main/generated/librosa.feature.melspectrogram.html" rel="nofollow noreferrer">https://librosa.org/doc/main/generated/librosa.feature.melspectrogram.h... | <python><matplotlib> | 2023-02-25 19:42:19 | 1 | 4,880 | user3668129 |
75,567,914 | 20,761,758 | Django - No module named 'webapp' | <p><a href="https://i.sstatic.net/YHZTL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YHZTL.png" alt="Project Structure" /></a></p>
<p><strong>Settings.py</strong></p>
<pre><code>INSTALLED_APPS = [
'webapp',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
... | <python><django> | 2023-02-25 19:34:15 | 1 | 665 | Hosea |
75,567,818 | 514,149 | How to rotate YOLO bounding boxes in 90° steps? | <p>I have a dataset of images for a computer vision object detection project. I am using the YOLO framework, which stores the object labels (bounding boxes) for the training data in text files, one per image, that have the following format:</p>
<ul>
<li>one row per object</li>
<li>each row is in <code>class x_center y_... | <python><math><yolo> | 2023-02-25 19:16:13 | 2 | 10,479 | Matthias |
75,567,806 | 19,989,634 | Send 'User' name and 'Form content' in email notification | <p>I'm trying to get the form to send an email notification of the 'Users' username and content of the 'Comment' its self. I have managed to get the title of the post working but nothing else. Need a little help.</p>
<p><strong>Views</strong></p>
<pre><code>def ViewPost(request, slug):
try:
post = B... | <python><django><django-models><django-views><django-email> | 2023-02-25 19:14:00 | 2 | 407 | David Henson |
75,567,562 | 12,491,345 | How to automate version bump with main branch protection rules without PAT? | <p>My team has multiple low level and high level packages written in Python and they are dependent on each other, we typically install them as GitHub repositories using <code>pip</code>. Basically, I would like to automate the process of providing versions to the libraries, so the production code is easier to manage an... | <python><github><github-actions><commitizen> | 2023-02-25 18:34:32 | 1 | 598 | pdaawr |
75,567,394 | 4,167,804 | Trying to find human names in a file using ntlk | <p>I'd like to extract human names from a text file. I'm getting a blank line as output for some reason. Here is my code:</p>
<pre><code>import nltk
import re
nltk.download('names')
nltk.download('punkt')
from nltk.corpus import names
# Create a list of male and female names from the nltk names corpus
male_names = nam... | <python><nlp> | 2023-02-25 18:03:22 | 1 | 381 | Brajesh |
75,567,303 | 6,367,971 | Fill down between rows in new dataframe column | <p>I have a dataframe where I need to create a new column (<code>Break</code>), and forward fill that column between all the <code>Break</code> rows.</p>
<pre><code>Type,Name
Parent,Parent1
Break,break010
Op,Op1
Unit,Unit1
Item,Item1
Break,break020
Op,Op2
Unit,Unit2
Break,break030
Op,Op3
Unit,Unit3
Parent,Parent2
Break... | <python><pandas><dataframe> | 2023-02-25 17:48:15 | 1 | 978 | user53526356 |
75,567,078 | 10,582,321 | Move margins of subplots | <p>I would like to move all the subplots a little to the right, so that there is more space before the zero on x-axis. The <code>margins</code> results in symmetrical spacing. How can I do this?</p>
<p>Here is a MWE:</p>
<p><a href="https://i.sstatic.net/cVFnf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.... | <python><matplotlib><plot> | 2023-02-25 17:11:02 | 2 | 330 | Pedro |
75,567,051 | 5,363,686 | Shift dataframe values for all columns to make monotonically increasing | <p>I have a dataframe of measures in multiple columns, that are aggregated. This means that the function they represent is a monotonically increasing one. Now, due to reset of an apparatus, all measurements are reset to zero, after which the aggregation resumes. But to work with the data, I need to disgard the reset an... | <python><pandas><dataframe> | 2023-02-25 17:06:40 | 1 | 11,592 | Serge de Gosson de Varennes |
75,567,023 | 11,397,243 | Descriptors in python for implementing perl's tie scalar operation | <p>I need some help with descriptors in python. I wrote an automatic translator from perl to python (Pythonizer) and I'm trying to implement tied scalars, which is basically an object that acts as a scalar, but has FETCH and STORE operations that are called appropriately. I'm using a dynamic class namespace 'main' to... | <python><python-descriptors> | 2023-02-25 17:02:27 | 3 | 633 | snoopyjc |
75,566,976 | 6,552,836 | Modelling 6 separate equations into 1 equation | <p>I have 6 functions of the form <code>y = beta*(exp(alpha*x/n))</code>. Each <code>func</code> has specific parameters as displayed in the table below.</p>
<p>The input is a 10x6 matrix and the output is a single value. The aim is to optimize the 10x6 matrix to produce the largest y value. Each column of the matrix h... | <python><machine-learning><linear-regression><data-modeling> | 2023-02-25 16:56:04 | 1 | 439 | star_it8293 |
75,566,800 | 790,785 | How to resolve error of Event loop is closed python unittest? | <p>While implement Python unittest by subclassing IsolatedAsyncioTestCase, it only runs first test case successfully. For any subsequent test case it throws error that event loop is closed. This happens in both Windows and Mac. Could you please suggest how to make sure that event loop is running during the execution of... | <python><python-asyncio><python-unittest> | 2023-02-25 16:27:01 | 1 | 7,039 | Atharva |
75,566,776 | 1,532,602 | Issue using FPDF2 with python.barcode | <p>Using FPDF2 to generate a document that requires a Code39 barcode:</p>
<pre><code>from barcode import Code39
from barcode.writer import ImageWriter
from fpdf import FPDF
from io import BytesIO
...
pdf = new PDF()
pdf.add_page()
rv = BytesIO()
Code39("TEST",writer=ImageWriter()).write(rv)
pdf.image(rv,10,... | <python><fpdf> | 2023-02-25 16:22:47 | 0 | 1,665 | Elcid_91 |
75,566,743 | 6,552,836 | Scipy Minimize - Keep getting a singular matrix error | <p>I'm trying to optimize a 20x5 matrix to maximize a return value y. There are 1 main constraints that I need to include:</p>
<ol>
<li>Total sum of all the elements must between a min and max range</li>
</ol>
<p>However, I keep getting this singular matrix error below:</p>
<pre><code>Singular matrix C in LSQ subproble... | <python><optimization><scipy-optimize><scipy-optimize-minimize> | 2023-02-25 16:17:12 | 2 | 439 | star_it8293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.