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,566,575 | 2,218,321 | How to use the dataset comes from pytorch random_split()? | <p>I'm new to pyTorch and this is my first project. I need to split the dataset and feed the training dataset to model. <strong>The training dataset must be splitted in to features and labels (which I failed to do that)</strong>. Here is what I have tried so far, however, I don't know how to feed the dataset obtained ... | <python><machine-learning><pytorch><neural-network> | 2023-02-25 15:44:45 | 2 | 2,189 | M a m a D |
75,566,545 | 4,321,525 | Problem with matplotlib date formatting and conversion from epoch time: OverlowError: int too big to convert | <p>The time on the x-axis of my plot is in seconds since the epoch, and I want to convert them to "Year-Month-Day Hour:Minute" format. I follow the documentation <a href="https://matplotlib.org/2.0.2/examples/api/date_demo.html" rel="nofollow noreferrer">here</a>, and I get this traceback:</p>
<pre><code>Trac... | <python><matplotlib><datetime-conversion> | 2023-02-25 15:40:04 | 1 | 405 | Andreas Schuldei |
75,566,539 | 21,286,804 | mypy doesn't understand class and interface are the same | <pre><code>from abc import ABC, abstractmethod
class IState(ABC):
"""Interface para o padrão de projeto State."""
@abstractmethod
def sucesso_ao_pagar(self) -> None:
pass
@abstractmethod
def despachar_pedido(self) -> None:
pass
@abstractme... | <python><interface><mypy> | 2023-02-25 15:39:44 | 1 | 427 | Magaren |
75,566,400 | 1,961,574 | Celery: memory not released from workers running python code | <p>So this isn't the first time this question is asked here, but it's a slight variation.</p>
<p>I have a file conversion task loading in several GB of data files, chopping them up, and writing them into a new format. This task will continously scan for new files and convert them when it finds them.</p>
<p>However, the... | <python><celery> | 2023-02-25 15:19:36 | 0 | 2,712 | bluppfisk |
75,566,344 | 9,133,459 | Is there a way to reverse-beautify python code? | <p>A specific unique task I have in mind requires me to read a text file (the text file only consists of python code) and store each line from the file in a list. However, there is one catch. I require each line to be <strong>complete</strong>. What I mean by complete is if a group of sequential lines can be in one lin... | <python> | 2023-02-25 15:11:31 | 1 | 2,552 | Rajdeep |
75,566,328 | 9,644,490 | How to add text AFTER inputs in Django forms | <p>I have a form which ideally would render like this:</p>
<pre><code><label>Price: </label>
<input type="number" />USD
</code></pre>
<p>Visually it would be</p>
<pre><code>Price: |___________| USD
</code></pre>
<p>I know that the <code>label</code> attribute of a form field can add text BEF... | <python><django> | 2023-02-25 15:08:40 | 1 | 409 | kyuden |
75,566,236 | 6,552,836 | Scipy / Mystic - Constraints violated after being specified | <p>I'm trying to optimize a 10x5 matrix to maximize a return value y, using mystic. There are 2 types of constraints that I need to include:</p>
<ol>
<li>Each element must be in between a min and max range</li>
<li>Some elements must equal specific values (provided in a dictionary)</li>
</ol>
<p>Not sure why the optimi... | <python><optimization><scipy><scipy-optimize><mystic> | 2023-02-25 14:55:32 | 1 | 439 | star_it8293 |
75,566,105 | 11,665,178 | Authenticate a GET request to Google Play Purchase API with service account python | <p>I need to verify purchases of my android App from my AWS lambda in python.</p>
<p>I have seen many posts of how to do so and the <a href="https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get" rel="nofollow noreferrer">documentation</a> and here is the code I have written :</p>
... | <python><android><in-app-purchase><google-api-python-client><google-play-developer-api> | 2023-02-25 14:35:10 | 2 | 2,975 | Tom3652 |
75,566,022 | 13,218,530 | pipenv install django=~3.1.0 command giving error | <pre><code>Installing django=~3.1.0...
Resolving django=~3.1.0...
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/packaging/requirements.py", line 102, in __init__
req = REQUIREMENT.parseString(requiremen... | <python><django><pipenv> | 2023-02-25 14:20:45 | 1 | 1,289 | MUHAMMAD SHAHID RAFI C P |
75,565,959 | 2,598,546 | Getting region name in SageMaker endpoint | <p>In SageMaker endpoint, hosting my custom container with Python code, I need to access the region name. I tried the AWS_REGION and AWS_DEFAULT_REGION variables but they are not defined. Do you maybe know some way of doing this?</p>
| <python><amazon-web-services><amazon-sagemaker> | 2023-02-25 14:09:51 | 1 | 312 | Pawel Faron |
75,565,957 | 5,058,116 | Looking up a column name in another data frame | <p>I have the following data frame:</p>
<pre><code>import pandas as pd
df_1 = pd.DataFrame(
{
"id_1": [1, 1, 2, 2],
"id_2": [11, 11, 22, 22],
"value_1": [0.1, 0.1, 0.01, 0.01],
"value_2": [0.2, 0.2, 0.02, 0.02],
"value_3&qu... | <python><pandas><dataframe><lookup> | 2023-02-25 14:09:05 | 1 | 3,058 | ajrlewis |
75,565,777 | 8,279,172 | Sum rows of 2D array with elements of 1D array | <p>I have two ndarrays: <br />
<code>a = [[1, 2], [100, 200]]</code> and <br />
<code>b = [10, 20]</code></p>
<p>Is it possible to get such ndarray using numpy:
<code>[[1 + 10, 2 + 10], [100 + 20, 200 + 20]]</code></p>
| <python><numpy><numpy-ndarray> | 2023-02-25 13:37:01 | 3 | 1,540 | wowonline |
75,565,227 | 1,686,628 | matplotlib: get precise point of intersection | <pre><code>import numpy as np
import matplotlib.pyplot as plt
x = [1,2]
y1 = [11, 0]
y2 = [0, 5]
np_x = np.array(x)
np_y1 = np.array(y1)
np_y2 = np.array(y2)
idx = np.argwhere(np.diff(np.sign(np_y2 - np_y1))).flatten()
isect = zip(np_x[idx], np_y1[idx])
for x,y in isect:
print(f'({x}, {y})')
plt.plot(np_x, n... | <python><python-3.x><numpy><matplotlib> | 2023-02-25 11:55:10 | 4 | 12,532 | ealeon |
75,565,181 | 12,945,785 | highlighted space display | <p>I have a question concerning vscode. A very simple one. why do I have highlighted text in python code (jupyter) as in the photo joined ? How can I cancel it ?
<a href="https://i.sstatic.net/a172n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a172n.png" alt="enter image description here" /></a></p>
| <python><visual-studio-code> | 2023-02-25 11:47:08 | 1 | 315 | Jacques Tebeka |
75,565,121 | 17,233,433 | Django - authenticate() returning None even if user exists in database and the credentials are correct | <p><code>authenticate()</code> returns <code>None</code> for credentials even if the user exists in the database and the credentials are correct.</p>
<p>The function for registration, <code>register()</code>:</p>
<pre><code>def register(request):
registered = False
ctx = {}
if request.method == 'POST':
... | <python><django><authentication> | 2023-02-25 11:38:01 | 1 | 753 | Adith Raghav |
75,565,077 | 5,058,116 | Getting index counter on a data frame | <p>I have the following data frame:</p>
<pre><code>import pandas as pd
data = {
"id_1": [1, 1, 1, 2, 2, 2],
"id_2": [1, 1, 1, 2, 2, 2],
"foo": [0.1, 0.1, 0.1, 0.2, 0.2, 0.2],
}
df = pd.DataFrame(data)
df = df.set_index(["id_1", "id_2"])
</code></pre>
<p>whi... | <python><pandas><multi-index> | 2023-02-25 11:28:22 | 2 | 3,058 | ajrlewis |
75,565,030 | 4,987,739 | does python allows elif statement without else statement? | <p>While teaching python to a friend i tried this statement :</p>
<pre><code>val = "hi"
if (val=="hello") or ("w" in val):
print("hello")
elif(val=="hi"):
print("hi")
</code></pre>
<p>And to my great surprise it worked. I always tought in Python ... | <python> | 2023-02-25 11:20:21 | 2 | 899 | djohon |
75,564,994 | 3,399,066 | Python FastAPI server - Streaming in-memory images to HTML5 <video> element | <h1>Goal</h1>
<p>I'm trying to stream in-memory images from a Python backend written in FastAPI to a HTML (Vue3) frontend. However, I cannot get the video element to display the stream of images like a video.</p>
<h1>Minimal example attempt</h1>
<p>As a minimal example, I create 2 images in memory (red and blue) on the... | <python><video-streaming><html5-video><jpeg><fastapi> | 2023-02-25 11:14:33 | 0 | 6,452 | NumesSanguis |
75,564,864 | 3,312,274 | web2py: Prevent delete action on the A() helper depending on the result of the callback | <p>Is it possible to prevent the delete action on 'tr' depending on the return value of <code>service_record_del_request</code> callback:</p>
<pre><code>{{=A('Delete', callback=URL('service_record_del_request', vars={'id':r.id}), delete='tr')}}
</code></pre>
<p>Example callback:</p>
<pre><code>@auth.requires_login()
de... | <python><ajax><web2py> | 2023-02-25 10:47:55 | 1 | 565 | JeffP |
75,564,803 | 10,940,547 | python requests ChunkedEncodingError when receiving and writing some data from a server | <p>I am working on a python script (as a smaller part of a project) that would accept some URLs and receive the data sequentially using the <code>requests</code> module and write it to a file.</p>
<p>The thing is, I guess, that the server I am receiving from, does not handle the connection effectively. Consequently, th... | <python><python-requests><chunked-encoding> | 2023-02-25 10:37:05 | 0 | 554 | Jyotirmay |
75,564,548 | 12,319,746 | Cannot connect to Azure SQL from Azure functions | <p>I am trying to send some data from an Azure function to an Azure SQL DB, it seems that the function's underlying linux image does not have PYODBC driver 18. I am using a managed identity to connect and it worked fine earlier on a linux function.</p>
<pre><code>conn_string = f"Driver={{ODBC Driver 18 for SQL Ser... | <python><azure><pyodbc> | 2023-02-25 09:48:01 | 2 | 2,247 | Abhishek Rai |
75,564,244 | 5,676,603 | create connected contour lines from set of points | <p>VTK and pyvista.</p>
<p>I am trying to implement from scratch (i.e., without using any library functions for contouring or interpolation ) an iso contour algorithm.</p>
<p>I am using pyvista to create a custom grid and render it.</p>
<p>With iso_contour function i am pushing (x, y, 0) points but i am not able to con... | <python><vtk><pyvista> | 2023-02-25 08:42:02 | 1 | 1,578 | Pravin Poudel |
75,564,166 | 3,728,901 | What is shadow built-in name 'sum'? | <p>I am learning at <a href="https://github.com/donhuvy/Data-Structures-and-Algorithms-The-Complete-Masterclass/blob/main/1.%20Big%20O%20Notation/2%20-%20bigo-whileloop.py#L11" rel="nofollow noreferrer">https://github.com/donhuvy/Data-Structures-and-Algorithms-The-Complete-Masterclass/blob/main/1.%20Big%20O%20Notation/... | <python><pycharm> | 2023-02-25 08:26:39 | 1 | 53,313 | Vy Do |
75,564,161 | 18,583,944 | Calculating points along a line between two points using geopy | <p>I am using <strong>geopy</strong> to map the location of a simulated object as it travels between two geographical points. I would like to be able to calculate the lat/lon of this object at any point in its theoretical journey: so for an object travelling between Paris and New York, 0% would be Paris, 100% would be ... | <python><latitude-longitude><geopy> | 2023-02-25 08:25:41 | 1 | 408 | Super |
75,563,776 | 7,521,470 | Proper way to make ConversationHandler with both Buttons & Messages handling | <p>I'm building a bot that should handle buttons and messages, this is an example that works:</p>
<pre><code>INTRO, GUEST_OR_USER, USERNAME, GUEST = range(4)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
keyboard = [
[InlineKeyboardButton("YES SIR!", callback_dat... | <python><telegram><python-telegram-bot> | 2023-02-25 06:52:55 | 1 | 321 | ElRey777 |
75,563,735 | 8,179,876 | Text matching visualizations in Python | <p>How could I make an image like this:</p>
<p><a href="https://i.sstatic.net/Yh6je.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Yh6je.png" alt="desired" /></a></p>
<p>Stuff I have tried: Matplotlib, Seaborn, Plotly, but all are for graphing data and not as much making visualizations given a list of l... | <python><matplotlib> | 2023-02-25 06:41:28 | 1 | 1,264 | Coder |
75,563,569 | 8,968,801 | GraphQL Queries Per App in Django (Graphene) | <p>I started moving my REST API endpoints to using GraphQL with Graphene. Seems pretty straightforward so far, but one of the things that I like about the REST API (and I cannot figure out in Graphene) is the structure of "endpoints" for each app. I have a lot of apps in my Django application, and I would lik... | <python><django><graphql><graphene-django> | 2023-02-25 05:57:13 | 1 | 823 | Eddysanoli |
75,563,523 | 12,210,257 | regex findall overlapped does not give match if one of them is a prefix of the other | <pre class="lang-py prettyprint-override"><code>import regex
product_detail = "yyy target1 target2 xxx".lower()
p1 = r"\btarget1\b|\btarget1 target2\b"
p2 = r"\btarget2\b|\btarget1 target2\b"
for pattern in [p1, p2]:
matches = regex.findall(pattern, product_detail, overlapped=True)
... | <python><regex><findall> | 2023-02-25 05:42:01 | 1 | 377 | leonardltk1 |
75,563,382 | 2,804,160 | Locating sublists of one list in another list in Python | <p>I have two lists <code>G3, G333</code>. I want to locate the sublists of <code>G333</code> in <code>G3</code> and print the indices <code>i</code>. For example, <code>[0, 4, 5, 9]</code> occurs at <code>i=0</code> in <code>G3</code>, <code>[10, 14, 15, 19]</code> occurs at <code>i=5</code> in <code>G3</code>. But I ... | <python><list> | 2023-02-25 04:54:36 | 3 | 930 | Wiz123 |
75,563,190 | 17,696,880 | How to capture all substrings that match this regex pattern, which is based on a repeat range of 2 or more consecutive times? | <pre class="lang-py prettyprint-override"><code>import re
input_text = "((PERS)Marcos) ssdsdsd sdsdsdsd sdsdsd le ((VERB)empujé) hasta ((VERB)dejarle) en ese lugar. A ((PERS)Marcos) le ((VERB)dijeron) y luego le ((VERB)ayudo)"
input_text = re.sub(r"\(\(PERS\)((?:\w\s*)+)\)\s*((?!el)\w+\s+){2,}(le)"... | <python><python-3.x><regex><replace><regex-group> | 2023-02-25 03:53:12 | 1 | 875 | Matt095 |
75,563,183 | 5,212,614 | How can we parse a JSON string and reshape it into a dataframe? | <p>I am playing around with this code.</p>
<pre><code>import requests
import json
import pandas as pd
from pandas.io.json import json_normalize
url = 'https://stats.nba.com/'
headers= {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',
... | <python><json><python-3.x> | 2023-02-25 03:50:56 | 1 | 20,492 | ASH |
75,562,903 | 14,414,944 | How can I type hint python-polars dataframe row values? | <p>I would like to be able to provide seamless type hints for a developer API that exposes a <code>polars.DataFrame</code> to the developer. Currently, in every IDE I've checked, if I do something like this...</p>
<pre><code>tbl : polars.DataFrame[MyType] = polars.DataFrame([])
row1 = tbl.frame[1, :]
</code></pre>
<p>.... | <python><python-typing><python-polars> | 2023-02-25 02:15:46 | 0 | 1,011 | lmonninger |
75,562,851 | 19,411,271 | ValueError plotting contourf in Cartopy Azimuthal Equidistant map projection | <p>I would like to use <code>contourf</code> in a Cartopy Azimuth Equidistant map projection. For context, I am trying to plot travel time (in h) of a signal across the globe. Roughly, this is somewhat what I am trying my plot to look like:</p>
<p><a href="https://i.sstatic.net/GVoQY.png" rel="nofollow noreferrer"><img... | <python><matplotlib><cartopy><contourf> | 2023-02-25 02:00:23 | 1 | 499 | just_another_profile |
75,562,841 | 482,819 | Avoid explicit `default` keyword in Python's dataclass field | <p><a href="https://peps.python.org/pep-0681/" rel="nofollow noreferrer">PEP 681</a> introduced dataclass transforms. Among it features, it provides “field specifiers, which describe attributes of individual fields that a static type checker must be aware of, such as whether a default value is provided for the field&qu... | <python><field><python-dataclasses> | 2023-02-25 01:56:50 | 1 | 6,143 | Hernan |
75,562,763 | 9,443,671 | How to scrape data from a webpage? | <p>There's a webpage which is an interactive version of a dataset where you can view an data example and a few associated labels in boxes. I'm trying to get this data into a pandas dataframe where I extract the example and all the associated labels. The data is divided over multiple pages and has fixed boxes for each l... | <python><web-scraping><extract> | 2023-02-25 01:26:04 | 2 | 687 | skidjoe |
75,562,668 | 6,037,395 | What is the best way to organize Python import paths for multiple but independent projects? | <p>Say I have three projects A, B and C in my home directory, all written mainly in Python:</p>
<pre class="lang-bash prettyprint-override"><code>.
├── project_A
│ ├── data
│ ├── plot
│ ├── result
│ └── run.py
├── project_B
│ ├── data
│ ├── plot
│ ├── result
│ └── run.py
└── project_C
├── data
├... | <python><path><python-import> | 2023-02-25 01:01:22 | 0 | 1,654 | zyy |
75,562,510 | 1,513,168 | How to split string and only assign needed fields | <p>I want to split a string like this. I can do the following.</p>
<pre><code>f1, f2, f3, f4, f5 = 'field1_field2_field3_field4_field5'.split('_')
</code></pre>
<p>However, I only need let's say f1 and f4. I do not want to assign other fields (I do not want to keep the others in the memory). I guess I am looking for so... | <python> | 2023-02-25 00:21:11 | 3 | 810 | Supertech |
75,562,384 | 9,422,807 | How do multiple recursive calls work in Python | <p>Below is a recursion function to decode a string. Can somebody explain to me <strong>step by step</strong> how multiple recursive calls work? Does the func finish the first recursive call and move on to the next recursive call? or does it do a recursive call within a recursive call?</p>
<pre><code>def encodings(str,... | <python><recursion> | 2023-02-24 23:50:56 | 1 | 413 | Liu Yu |
75,562,368 | 2,328,721 | Performance issue with Rust vs Python | <p>After reading an <a href="https://www.gkbrk.com/2022/10/memorable-unique-identifiers-muid/" rel="nofollow noreferrer">article about "Memorable Unique Identifiers"</a> and seeing the author mention that they want to try to rewrite the example Python code to C to achieve better performance, I tried rewriting... | <python><rust><cryptography> | 2023-02-24 23:46:23 | 1 | 638 | Jakub S. |
75,562,311 | 7,519,434 | SQLAlchemy get secondary table from relationship | <p>I have the following three tables with irrelevant fields removed:</p>
<pre><code>class Users(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key = True)
project_memberships = db.relationship("ProjectMember", back_populates = "user")
def get_manage... | <python><sqlalchemy><flask-sqlalchemy> | 2023-02-24 23:33:32 | 1 | 3,989 | Henry |
75,562,233 | 2,607,447 | Django-guardian has_perm("codename", obj) is False even if group has the permission | <p>I'm trying to implement <code>django-guardian</code> permissions in my project.
In the <code>TestCase</code> below, I assigned <code>view_income</code> permission to <code>staff</code> group. That means, also <code>user_c</code> has the permission.</p>
<p>The problem is that <code>self.user_c.has_perm("view_inc... | <python><django><django-permissions><django-guardian> | 2023-02-24 23:20:40 | 0 | 18,885 | Milano |
75,562,161 | 20,803,947 | Why do programming languages behave this way when there is no precedence? | <p>I realized that in Python and Javascript when we do this kind of conditional the logic doesn't make much sense, because if we put console.log in each condition, we will see that it should return false != true, so we should go inside the if and print the message "Is true" in the terminal, but I would like t... | <javascript><python><logic> | 2023-02-24 23:07:10 | 2 | 309 | Louis |
75,562,106 | 12,870,750 | QgraphicsView slow line render | <p>I have been trying to make a line viewer in <code>PyQt5</code>, the main process is to load a geopackage file using geopandas and adding it to a <code>QGrapihcsView</code> scene. The <code>QGrapichsView</code> class is a zoom and pan capable.</p>
<p>For this example I used a generic line creator to best represent t... | <python><pyqt5><vispy><qtopengl> | 2023-02-24 22:57:35 | 1 | 640 | MBV |
75,562,085 | 1,627,106 | Use connection pooling with python sshfs (fsspec) in Python | <p>I'm using sshfs to fetch video files from a remote SSH storage:</p>
<pre><code>@app.get("/video/{filename}")
async def video_endpoint(
filename, range: str = Header(None), db=Depends(get_db)
): # pylint: disable=redefined-builtin
"""
Endpoint for video streaming
Accepts the... | <python><sshfs><fsspec> | 2023-02-24 22:54:20 | 1 | 1,712 | Daniel |
75,562,024 | 726,150 | Using Comprehension and Data frames to extract data from lists of dictionary's in Python | <p>I sure I should be able to find this but I have looked and I can't seem to fine how to do a few of the user cases I am looking for. I want to search a list of dictionaries and either pull back a subset or count how often a value appears.</p>
<p>for example from the below list I want to be able to say</p>
<p>return a... | <python><dictionary> | 2023-02-24 22:45:32 | 2 | 2,653 | DevilWAH |
75,561,986 | 6,410,450 | Python detect dates containing commas and remove comma from text file | <p>I have a txt file that contains dates in columns like below. The comma between the day and year is making it hard to import the data into pandas using pd.read_csv(). This is contained within a text file that has other data that should be ignored, so I can't perform some action on the entire document. I need to go... | <python><pandas><python-re> | 2023-02-24 22:39:26 | 2 | 2,245 | Troy D |
75,561,834 | 7,437,143 | How to include tests from root project directory in pip package, such that other pip packages can call it? | <h2>Context</h2>
<p>After creating a project directory with the following folder structure:</p>
<pre class="lang-py prettyprint-override"><code>src/snnalgorithms__main__.py
tests/some_test.py
tests/some_dir/other_test.py
</code></pre>
<p>and publishing it as a pip package, I receive the error:</p>
<pre><code>from snnal... | <python><pip><setuptools><setup.py><python-packaging> | 2023-02-24 22:13:16 | 0 | 2,887 | a.t. |
75,561,783 | 3,368,667 | Pandas rolling command erases column | <p>I'm running into an issues with the pandas <code>.rolling()</code> function and I'm not sure quite how to fix the issue.</p>
<p>Here's the dataframe and code</p>
<pre><code>dictionary = {'TimeStamp': {0: '2023-02-23 08:01:50.701',
1: '2023-02-23 08:01:50.798',
2: '2023-02-23 08:01:50.798',
3: '2023-02-23 08:01... | <python><pandas> | 2023-02-24 22:06:42 | 2 | 1,077 | tom |
75,561,763 | 9,190,503 | Django queryset show english translations | <p>This is my Django <code>models.py</code>:</p>
<pre><code>from django.db import models
class Blog(models.Model):
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.pub_date
class LanguagesCode(models.Model):
code = models.CharField(max_length=5)
def __str__(s... | <python><django><django-models><django-rest-framework><django-queryset> | 2023-02-24 22:03:17 | 2 | 1,041 | Ulvi |
75,561,746 | 3,123,109 | Having both .filter() on query_param and .all() functionality without adding another ViewSet and end-point | <p>I'm trying to avoid making another end-point to handle this query, but thinking there isn't a way around it. Wanted to run it by ya'll before doing so.</p>
<p>Basically, I have Documents related to Customers and Products. I want to retrieve only the Documents for a specific Customer and Product.</p>
<p>Here are the ... | <python><django><django-models><django-rest-framework><django-filter> | 2023-02-24 22:01:13 | 1 | 9,304 | cheslijones |
75,561,650 | 5,203,117 | Ranking, ranking, tra la la (ranking in pandas) | <p>I have a pandas dataframe that looks like this:</p>
<pre><code> SPX RYH RSP ... RYT RYU EWRE
Date ...
2022-03-04 NaN NaN NaN ... NaN NaN NaN
2022-03-11 -0.028774 -0.03... | <python><pandas> | 2023-02-24 21:45:25 | 1 | 597 | John |
75,561,566 | 6,357,916 | Random sampling with numpy works but cupy gives "Unsupported dtype <U20" | <p>I am trying translate my negative sampling code in numpy to cupy.</p>
<p>First I have following import in my jupyter notebook:</p>
<pre><code>import cupy as cp
</code></pre>
<p>I have a list of strings my jupyter notebook:</p>
<pre><code>In: l = ['aaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccc'... | <python><numpy><cupy> | 2023-02-24 21:33:01 | 0 | 3,029 | MsA |
75,561,489 | 14,460,824 | How to create nested dict with parent children hierachy for streamlit_tree_select from dataframe? | <p>To use <a href="https://github.com/Schluca/streamlit_tree_select" rel="nofollow noreferrer"><code>streamlit_tree_select</code></a> I need to convert a dataframe to its expected structure.</p>
<p>I guess to achieve the goal I could use <code>pandas.groupby('parkey')</code> to group the children, but I'm not sure how ... | <python><pandas><dataframe><dictionary><streamlit> | 2023-02-24 21:21:59 | 1 | 25,336 | HedgeHog |
75,561,432 | 1,062,643 | How do I create an extendable bar sprite in PyGame? | <p>I want to use the following asset in my game:
<a href="https://i.sstatic.net/ORv9A.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ORv9A.png" alt="bar asset" /></a></p>
<p>It has specific pixelated borders and corners. So I want it to scale "extending" the inner part of the asset by repeatin... | <python><pygame><sprite><scale><pygame-surface> | 2023-02-24 21:13:13 | 2 | 2,695 | kokoko |
75,561,325 | 4,165,235 | How do I scan cards and know when it have been successfully evaluated, without making an API call? | <p>So I have coded this:</p>
<pre><code>import cv2
from PIL import Image
import pytesseract
import re
import time
vid = cv2.VideoCapture(0)
def getText(frame):
# TODO Do I really need to convert to PIL from numpy array?
im = Image.fromarray(frame).convert('LA')
textAreaImage = im.crop((200, 70, 470, 105))... | <python><ocr><tesseract><opencv> | 2023-02-24 20:58:43 | 0 | 788 | Salviati |
75,561,265 | 14,385,099 | Updating string elements in a list in Python | <p>I have a list of string elements where <code>list = [X, Y, Z]</code>.</p>
<p>I want to update the elements in the list such that it becomes <code>[X_AAA, X_BBB, X_CCC, Y_AAA, Y_BBB, Y_CCC, Z_AAA, Z_BBB, Z_CCC]</code>. Essentially, I'm appending AAA, BBB and CCC to every element in this list of strings.</p>
<p>What i... | <python><data-wrangling> | 2023-02-24 20:50:02 | 1 | 753 | jo_ |
75,561,202 | 12,130,817 | Get training specifications for existing yolov5 model such as model version, image size and hyperparameters used during training | <p>I was wondering whether there is a way of getting information about how an existing custom yolov5 model was trained. For example, I would like to know the model version / release, on which image size the model was trained, and the hyperparameters used.</p>
<p>I was hoping for something like this:</p>
<pre class="lan... | <python><machine-learning><yolov5> | 2023-02-24 20:41:52 | 0 | 373 | Peter |
75,561,168 | 236,835 | Find overlaping area of two images and merge them together with python | <p>I have two images e.g. two screenshots of a web page. The end of one image is the same as the beginning of the second image.</p>
<p>How can I use python to find due overlap and merge the two images accordingly?</p>
<p>Unfortunately my idea does not work.</p>
<ol>
<li>load images with pillow</li>
<li>convert to grays... | <python><image><numpy><python-imaging-library> | 2023-02-24 20:37:34 | 2 | 3,179 | Marten Bauer |
75,561,153 | 1,504,016 | How to generrate odt files from templates in Python | <p>I'm working on a Python program that takes in input data from a database and open document templates (either .ott or .odt files directly) with anchors.</p>
<p>I would like the program to be able to generate at output .odt files filled with data from the database.</p>
<p>How should I proceed? I saw there were a few l... | <python><templates><odt><opendocument> | 2023-02-24 20:33:55 | 1 | 2,649 | ibi0tux |
75,560,945 | 17,696,880 | How to perform this replacement on a string only if a sequence of characters is separated from another substring by 2 or more words? | <pre class="lang-py prettyprint-override"><code>import re
def person_identification_of_personal_pronouns_le_and_les_func(input_text, number_of_people_involved="singular"):
if number_of_people_involved == "singular":
assumed_subject_of_sentence, personal_pronoun = "(SINGULAR_PERS)&... | <python><python-3.x><regex><replace><regex-group> | 2023-02-24 20:08:41 | 1 | 875 | Matt095 |
75,560,915 | 11,693,768 | Drop duplicates in a subset of columns per row, rowwise, only keeping the first copy, rowwise only if every column has the same duplicate | <p>This is another extension to my previous questions, <a href="https://stackoverflow.com/questions/75550770/drop-duplicates-in-a-subset-of-columns-per-row-rowwise-only-keeping-the-first/75551691#75551691">Drop duplicates in a subset of columns per row, rowwise, only keeping the first copy, rowwise</a> and <a href="htt... | <python><pandas><dataframe> | 2023-02-24 20:04:42 | 2 | 5,234 | anarchy |
75,560,780 | 11,693,768 | Drop duplicates in a subset of columns per row, rowwise, only keeping the first copy, rowwise only if there are 3 or more duplicates | <p>This is an extension to my previous question, <a href="https://stackoverflow.com/questions/75550770/drop-duplicates-in-a-subset-of-columns-per-row-rowwise-only-keeping-the-first/75551691#75551691">Drop duplicates in a subset of columns per row, rowwise, only keeping the first copy, rowwise</a> I also have a similar ... | <python><pandas><dataframe> | 2023-02-24 19:47:23 | 1 | 5,234 | anarchy |
75,560,602 | 197,937 | YouTube Data API: video.list endpoint returning 400 error invalid filters | <p>I am using YouTube Data Api v3 to fetch video statistics from a YouTube channel. But I am getting the error message below. I searched online, but couldn't figure out the error because I am not using the parameter in the request.</p>
<pre><code># Define the YouTube API request to fetch the statistics of the videos
vi... | <python><youtube-api><youtube-data-api><google-api-python-client> | 2023-02-24 19:24:23 | 0 | 2,571 | Karthik |
75,560,546 | 5,489,190 | Converting Python.Runtime.PyObject (Pythonnet) to C# native data types - it works for double but not for numpy.array | <p>Let's say that I will call a python 3.0 script from C# using Pythonnet. As long as the return is of type double it is pretty simple:</p>
<pre><code>var input1 = new double[] {15, 20, 25};
dynamic test = Py.Import("Py_file_name");
double r1 = test.function_name(input1);
</code></pre>
<p>The value returned f... | <python><c#><python-3.x><numpy><python.net> | 2023-02-24 19:16:35 | 1 | 749 | Karls |
75,560,514 | 15,781,591 | Creating reverse average calculation with constraints in python | <p>I am trying to work out how to use <code>solver()</code> from SymPy in python to solve my algebra problem with constraints.</p>
<p>I have two mystery values XX and YY that need to average to ZZ, where XX and YY both need to be greater than "lower_constraint" and less than "upper_constraint".</p>
... | <python><sympy><solver> | 2023-02-24 19:11:57 | 1 | 641 | LostinSpatialAnalysis |
75,560,495 | 5,868,293 | How to see if in-between two date columns, specific dates fall into, pandas | <p>I have a pandas dataframe that looks like this:</p>
<pre><code>import pandas as pd
pd.DataFrame({'date_start' : ['2022-12-06', '2022-12-25', '2022-12-16'],
'date_end': ['2022-12-08', '2022-12-26', '2022-12-30']})
date_start date_end
0 2022-12-06 2022-12-08
1 2022-12-25 2022-12-26
2 2022-12-16... | <python><pandas> | 2023-02-24 19:10:28 | 2 | 4,512 | quant |
75,560,424 | 7,281,675 | transformers refine-tune with different classes | <p>I want to fine-tune a BERT-based already fine-tuned model for classification with 7 classes another time on a 16 class dataset:</p>
<pre><code>MODEL_NAME_OR_PATH = 'some pretrained model for 7 class classification on huggingface repo'
model = build_model(MODEL_NAME_OR_PATH, learning_rate=LEARNING_RATE)
def build_mo... | <python><classification><huggingface-transformers><bert-language-model> | 2023-02-24 19:03:48 | 1 | 4,603 | keramat |
75,560,404 | 6,387,095 | cron - log file not being written to after a certain time? | <p>I have a <code>script</code> running via <code>crontab</code></p>
<p>It runs perfectly till a certain time and <code>print</code> statements show up in the <code>log</code> file.
After this particular time, the log file doesn't have any more entries.</p>
<p>I checked whether the <code>script</code> is still running:... | <python><ubuntu><cron> | 2023-02-24 19:00:37 | 1 | 4,075 | Sid |
75,560,117 | 1,577,947 | Does Python have a "PYTHONBUFFERED" Environment Variable? | <p>I see many people setting <code>ENV PYTHONBUFFERED=1</code> in their Dockerfile. Just <a href="https://www.google.com/search?q=%22PYTHONBUFFERED%22" rel="nofollow noreferrer">Google it</a>.</p>
<p>I know that <a href="https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUNBUFFERED" rel="nofollow noreferrer">PYT... | <python> | 2023-02-24 18:22:48 | 1 | 19,182 | Jarad |
75,560,107 | 12,210,377 | Count Each String In A List with One Character Mismatch | <p>I have a list of strings:</p>
<pre><code>my_list = 'AAA AAA BBB BBB DDD DDD DDA'.split()
my_list
['AAA', 'AAA', 'BBB', 'BBB', 'DDD', 'DDD', 'DDA']
</code></pre>
<p>I need to count every element appearing in the list. However, if two strings have one mismatch, we would count them as the same string and then count.</... | <python><string><dataframe> | 2023-02-24 18:22:08 | 1 | 1,084 | Roy |
75,560,025 | 1,857,373 | Reshape | values (ValueError) for impute transformation interative imputer fit transform on Bayesian Ridge: ValueError Expected 2D array, got 1D array | <p><strong>Problem</strong>
<strong>Updated with new Python code and new Error</strong></p>
<p>Created new imputer_bayesian_ridge() function not working on 2D requirements for IterativeImputer to impute training data. Sending in data frame training data, then immediately get data.values for numpy array variable, then ... | <python><arrays><scikit-learn><bayesian><imputation> | 2023-02-24 18:12:12 | 1 | 449 | Data Science Analytics Manager |
75,559,930 | 10,976,654 | How to create nested rec arrays | <p>Given the following arrays:</p>
<pre><code>name = np.array(['a', 'b', 'c'])
val = np.array([0.4, 0.5, 0.6])
alt = np.array([1.1, 2.1, 3.1])
b = np.array([17.2])
</code></pre>
<p>How can I combine them into a recarray (or structured array, same thing) that looks like this: <code>[('a', 'b', 'c'), (0.4, 0.5, 0.6), (1.... | <python><arrays><numpy><tuples><recarray> | 2023-02-24 18:01:43 | 2 | 3,476 | a11 |
75,559,776 | 9,072,753 | How to wait on multiple multiprocess.Process to finish execution when they exec()? | <p>I need to wait for multiple processes to finish execution. I am using multiprocess.Process, because I want to adjust oom score of the subprocesses before executing them. After research, I wanted to use multiprocessing.connection.wait and sentinel values of subprocesses to wait on them.</p>
<p>Consider the following ... | <python><python-3.x><linux><python-multiprocessing> | 2023-02-24 17:43:54 | 1 | 145,478 | KamilCuk |
75,559,726 | 2,811,074 | RuntimeError: numel: integer multiplication overflow | <p>I am trying to build a generative recurrent GAN architecture for a multi-variate time-series data. Here is the discriminator of my model:</p>
<pre><code>from torchgan.models import Generator, Discriminator
import torch
import torch.nn as nn
class RGANDiscriminator(Discriminator):
def __init__(self,
... | <python><lstm><recurrent-neural-network><tensor><generative-adversarial-network> | 2023-02-24 17:38:44 | 2 | 4,378 | Dalek |
75,559,703 | 2,610,522 | Is bilinear resampling to a coarser resolution is similar to weighted spatial averaging? | <p>I am using the <a href="https://xesmf.readthedocs.io/en/latest/index.html#" rel="nofollow noreferrer">xESMF</a> python package to resample NDVI (greeness) data from 500 * 500 m to 1 * 1 degree.To clarify, I'm increasing the scale of the data. The package offers several techniques, including bilinear and conservative... | <python><python-xarray><resampling> | 2023-02-24 17:36:17 | 1 | 810 | Ress |
75,559,699 | 4,981,251 | Currency pair strength list based on dataframe row values | <p>Based on the following currency strength rankings dataframe:</p>
<pre><code> EUR USD GBP JPY AUD CHF CAD NZD
2023-02-24 12:00:00 5.0 8.0 4.0 3.0 2.0 7.0 6.0 1.0
2023-02-24 13:00:00 6.0 8.0 4.0 3.0 2.0 7.0 5.0 1.0
2023-02-24 14:00:00 7.0 8.0 4.0 3.0 2.0 6.0 5.0 1.0
2023-02-24 15:00:00 7.0 8.0 6.0 2... | <python><pandas> | 2023-02-24 17:35:42 | 1 | 5,548 | nipy |
75,559,640 | 89,092 | How can I make pandas.read_sql_query ignore the datetime datatype of a column in the source database? | <p><strong>The error that I get is "ValueError: month must be in 1..12"</strong></p>
<p>I know that there is "weird" data in that column and I want pandas to treat it as text or ignore the rows with errors and populate the df with the remainder.</p>
<p>(Not a big deal but would be good to avoid havi... | <python><pandas><datetime><sage><pervasive> | 2023-02-24 17:28:47 | 0 | 1,704 | RobD |
75,559,596 | 1,739,681 | Is there a way to import every submodule using --hidden-import in pyinstaller? | <p>We are using Pyinstaller and we have a module that has several hidden "submodules".
So, currently, we need to use --hiden-import module.submodule1 --hiden-import module.submodule2 and so on.</p>
<p>I've tried --hiden-import module, but it didn't work.</p>
<p>Is there a way to import all the submodules in a... | <python><pyinstaller> | 2023-02-24 17:24:04 | 2 | 305 | julianofischer |
75,559,484 | 14,678,213 | IndexError: list index out of range in pypdf2 extract_text in specific pdf file | <p>I have tried:</p>
<pre><code>from PyPDF2 import PdfReader
input_pdf = PdfReader(open("pdfFile.pdf", "rb"))
thispage = input_pdf.pages[0]
print(thispage.extract_text())
</code></pre>
<p>And I got the following error:</p>
<pre><code>Traceback (most recent call last):
File "C:\Users\Usuario\... | <python><python-3.x><pdf><pypdf> | 2023-02-24 17:12:15 | 1 | 567 | Tomás Gomez Pizarro |
75,559,402 | 5,110,870 | Python: using try/except for a multi-step flow | <p>Let's assume that we have the following flow:</p>
<pre class="lang-py prettyprint-override"><code>def flow(input_val: Any) -> Any:
result1 = function1(input_val)
result2 = function2(result1)
result3 = function3(result2)
return result3
</code></pre>
<p>And let's say that I want to be able to catc... | <python><error-handling><try-except> | 2023-02-24 17:03:18 | 5 | 7,979 | FaCoffee |
75,559,166 | 75,103 | How do I add system_platform specifiers to pyproject.toml? | <p>I have a bare-bones pyproject.toml file in an empty directory:</p>
<pre><code>[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "test-virtualenvwrapper"
version = "0.1.0"
dependencies = [
'virtualenvwrapper ; system_pl... | <python> | 2023-02-24 16:41:09 | 1 | 27,572 | thebjorn |
75,559,153 | 11,269,090 | Python ProcessPoolExecutor pas-in single and multiple arg | <p>It is possible to pass in multiple arguments to <code>ProcessPoolExecutor</code> to execute a function that takes in multiple parameters with multiple processes:</p>
<pre><code>def fn(a, b, c):
print(f"{a}, {b}, {c}")
with ProcessPoolExecutor(max_workers=5) as exe:
entries_to_print = exe.map(fn, [1,... | <python><multiprocessing> | 2023-02-24 16:40:08 | 2 | 1,010 | Chen |
75,559,122 | 4,072,043 | Embedded external URL breaks Sphinx? | <p>I am trying to document some Python code with Sphinx, and I've added the following doc comment to a constant.</p>
<pre><code>#: `RFC 8415 §7.6 <https://www.rfc-editor.org/rfc/rfc8415.html#section-7.6>`_
_SOL_TIMEOUT = 1
</code></pre>
<p>This appears to break Sphinx; it considers anything before the colon to be... | <python><python-sphinx><autodoc> | 2023-02-24 16:37:05 | 1 | 1,628 | Ian Pilcher |
75,558,835 | 16,853,253 | I'm getting raise AttributeError(key) error in Flask | <p>In flask, I'm using <code>marshmallow_sqlalchemy</code> package to serialize and de-serialize model data. I have two models, <code>Account</code> and <code>Address</code>. I have Account foreign key to Address model. My model details are listed below.</p>
<p><code>models.py</code></p>
<pre><code>class Account(db.Mod... | <python><sqlalchemy><marshmallow><marshmallow-sqlalchemy> | 2023-02-24 16:10:26 | 1 | 387 | Sins97 |
75,558,714 | 1,503,669 | How to use python selenium to locate the scrollbar on the right and then scroll down continuously to fully load all items content? | <p>I want to scrape all the items' information from this page <a href="https://allinone.pospal.cn/m#/categories" rel="nofollow noreferrer">https://allinone.pospal.cn/m#/categories</a>, refer to the screenshot.</p>
<p>the content is loading dynamically when I scroll down the right side of the page to the bottom and this... | <python><selenium-webdriver><web-scraping><beautifulsoup><infinite-scroll> | 2023-02-24 15:59:56 | 1 | 513 | Panco |
75,558,702 | 2,600,161 | DataFrame.apply() to column with list values | <p>I am drawing a blank on how to do this properly, I have a dataframe containing bounding box coordinates as a <code>list</code> type.
ex:</p>
<pre><code> bb_box
0 [4, 565, 1088, 591]
1 [17, 820, 1092, 949]
2 [5, 746, 1084, 796]
3 [32, 240, 1104, 263]
4 [0, 187, 1111, 212]
...
</code></pr... | <python><pandas><dataframe><numpy> | 2023-02-24 15:58:34 | 1 | 504 | Zexelon |
75,558,575 | 11,422,610 | How do I switch users with their groups groups in Python? | <p>How do I switch to an admin-user account from this python script named <code>root_and_user.py </code> that was run with <code>doas</code> or <code>sudo</code>?</p>
<pre><code>#!/usr/bin/env python3
from os import geteuid, seteuid
from subprocess import run
from sys import argv, exit
def touch(fname):
with open(... | <python><argv><sys> | 2023-02-24 15:45:53 | 0 | 937 | John Smith |
75,558,567 | 15,613,309 | What are the names associated with Python Tkinter get_focus()? | <p>I have a Tkinter script that has multiple Entry widgets. I have a method that gets the Entry widget that has "focus": i.e. <code>focused = self.root.focus_get()</code> This will return something like this: <code>.!labelframe2.!entry</code></p>
<p>What I really need to know is</p>
<ol>
<li>The name of the... | <python><tkinter> | 2023-02-24 15:45:11 | 1 | 501 | Pragmatic_Lee |
75,558,553 | 11,546,773 | Fastest operation to combine 2 dataframes with 1D array in each cell to 1 dataframe with 2D array in each cell | <p>I need to create a dataframe with in each cell a 2D array. This 2D array is a combination of one array from dataframe A and one array from dataframe B.</p>
<p>I tried applying a function on dataframe A in which I tried to combine those array combination with numpy. However I'm not sure that this is the fastest/most ... | <python><pandas><dataframe><numpy> | 2023-02-24 15:44:31 | 1 | 388 | Sam |
75,558,482 | 5,489,190 | How to use Pythonnet in C# app deployment? It still requires python to be locally installed on any user machine | <p><strong>Background</strong></p>
<p>I was looking for something like IronPython for my C# app, but supporting numpy packages. I decided to give a try to Pythonnet. Everything works fine as long as I'm on my machine with Python installed. But when I deploy my app, and try to start it on another machine, it crashes. My... | <python><c#><python-3.x><python.net> | 2023-02-24 15:38:01 | 1 | 749 | Karls |
75,558,210 | 2,167,717 | How to find the smallest maximum of a column with pandas after filtering? | <p>I have a dataframe:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{'team': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'],
'variable': [8, 9, 10, 11, 2, 3, 4, 5],
'another_variable': [1, 1, 1, 2, 1, 1, 2, 2]}
)
</code></pre>
<p>I would like to find the largest value of <code>variable</code> (which is... | <python><pandas><group-by><max><min> | 2023-02-24 15:12:06 | 2 | 365 | Maxim Moloshenko |
75,558,054 | 6,409,572 | Is there a "bookmark/headline" Syntax for a document outline in Python/pyCharm, like #### works in R/RStudio? | <p>Coding R in RStudio allows you to bracket comments in <code>####</code> to generate a "table of contents" that one can use to jump back and forth to different code sections. I love the lean and quick way tis allows for structuring my code (like Markdown does for text documents). An example is shown below.<... | <python><pycharm> | 2023-02-24 14:58:21 | 1 | 3,178 | Honeybear |
75,557,939 | 11,001,493 | How to find number of days in a year column? | <p>I have a dataframe like this:</p>
<pre><code>df = pd.DataFrame({"Index":[0, 1, 2, 3, 4, 5],
"Year":[2019, 2020, 2021, 2022, 2023, 2024]})
df
Out[12]:
Index Year
0 0 2019
1 1 2020
2 2 2021
3 3 2022
4 4 2023
5 5 2024
</code></pre>
<p>I wo... | <python><pandas><date> | 2023-02-24 14:48:18 | 4 | 702 | user026 |
75,557,918 | 8,108,089 | How to pass use sync_to_async with a chain of methods | <p>I have a case like the following:</p>
<pre class="lang-py prettyprint-override"><code>async def handler(self):
await sync_to_async(Stock.objects.filter)(id__in=product_stock).update(is_filled=False)
</code></pre>
<p>Where I am trying to pass the product_stock to the filter method then call the update on the filte... | <python><django><python-asyncio> | 2023-02-24 14:46:01 | 1 | 878 | coredumped0x |
75,557,880 | 19,130,803 | proper way to handle max line length python | <p><strong>Que-1</strong> Break flake8 and black cycle</p>
<pre><code>class TaskInfo(StrEnum):
ABCDEFG_HELLOO_TASK_WELCOMEE_VALUE: str = "abcdefg_helloo_task_welcomee_value"
</code></pre>
<p>A message from Flake8 gives line too long (82 > 79 characters)</p>
<p>so I edit as below</p>
<pre><code>class... | <python> | 2023-02-24 14:41:28 | 3 | 962 | winter |
75,557,864 | 2,774,885 | how do I map/assign a list of format strings to a list of values when printing? | <p>Scenario: I've got a large list of mixed-type values: strings, floats, ints, etc. I want to print these in various different output formats. It would be much easier if I could keep a separate list of formats and then map the list of formats to the list of values.<br />
As a simple, specific example imagine that I ... | <python><string-formatting> | 2023-02-24 14:40:37 | 3 | 1,028 | ljwobker |
75,557,840 | 3,783,002 | SCONS PDB unable to find my file, even after I explicitly append it to the system path | <p>I'm trying to debug a scons file as follows: <code>scons --debug=pdb</code>. When I try to set a breakpoint in <code>SConstruct</code> using <code>b SConstruct:24</code> I get an error:</p>
<blockquote>
<p>*** 'SConstruct' not found from sys.path</p>
</blockquote>
<p>My SConstruct file is in the current directory. I... | <python><debugging><scons><pdb> | 2023-02-24 14:38:26 | 1 | 6,067 | user32882 |
75,557,453 | 5,235,665 | Pandas dataframe duplicate checking and error handling | <p>Brand new to <a href="https://pandas.pydata.org/" rel="nofollow noreferrer">Pandas</a>, and fairly new to Python. I have the following snippet of Pandas code:</p>
<pre><code># Check for Duplicates in Mapping Fields , throw error if True
map_df[right] = map_df[right].astype("str")
input_df[left] = input_df[... | <python><pandas> | 2023-02-24 13:58:27 | 1 | 845 | hotmeatballsoup |
75,557,245 | 8,913,402 | Create a decision tree with a custom node logic | <p>I want to estimate a human level performance of a certain classification task.</p>
<p>Let's say I have the following fixed logic:</p>
<pre><code>def classify(feature_1, feature_2):
if feature_1 <= threshold_1:
return 0
if feature_2 <= threshold_2:
return 1
return 2
</code></pre>
... | <python><machine-learning><scikit-learn> | 2023-02-24 13:38:40 | 1 | 1,383 | Grzegorz |
75,557,241 | 6,225,526 | How to execute a python wheel developed using Poetry? | <p>I have a poetry application and in poetry, one can set any python version in pyproject.toml. Once a wheel is built using poetry, I would like to share this to our users.Then, my users can execute this wheel similar to how they execute an exe in windows.</p>
<p>I checked pyinstaller but it generates a bulky exe.</p>
... | <python><python-poetry><pipx> | 2023-02-24 13:38:22 | 0 | 1,161 | Selva |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.