QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 β |
|---|---|---|---|---|---|---|---|---|
76,195,211 | 48,956 | How to enforce in-order-of-receival processing of async message handlers? | <p>Suppose we have a message handler. Messages might be received from a TCP socket and dispatched to a handler:</p>
<pre class="lang-py prettyprint-override"><code>async def on_recv(msg):
await handle(msg)
while True:
msg = await socket.recv()
await on_recv(msg)
</code></pre>
<p>This is problematic because... | <python><python-asyncio> | 2023-05-07 16:56:55 | 1 | 15,918 | user48956 |
76,195,132 | 13,142,245 | Python dictionary filter only returning first valid occurrence | <p>I'm implementing filter functionality for a dictionary.</p>
<pre class="lang-py prettyprint-override"><code>class Filter:
def __init__(self, obj):
self.obj = obj
def isin(self, key, lst):
self.obj = {k:[v[i] for i in range(len(self.obj)+1) if self.obj[key][i] in lst]
for k,v in... | <python><filter><hashmap> | 2023-05-07 16:42:54 | 1 | 1,238 | jbuddy_13 |
76,195,047 | 753,707 | Get quotients and remainder from division of floats | <p>What is the Pythonic approach to getting a quotients and remainder from division of <strong>floats</strong>? So taking 8 divided by 3 which is 2.66666666666</p>
<p>so I want:</p>
<pre><code>aPythonOperator(8,3) = 2.0, 0.66666666666
</code></pre>
<p>but I cannot find a clean way of doing this without the remainder be... | <python> | 2023-05-07 16:24:43 | 3 | 454 | DUFF |
76,194,893 | 7,437,143 | How to overwrite a print statement line, after printing text below it? | <h2>Context</h2>
<p>I have difficulties finding the right stackoverflow question for this purpose:
I would like to update a printed line in python with a value that is computed after something else is printed. the <code>something else</code> should stay below the line that is updated.</p>
<p>For example:</p>
<pre class... | <python><printing> | 2023-05-07 15:46:26 | 2 | 2,887 | a.t. |
76,194,847 | 14,183,155 | Numpy reshape behaves differently on square matrices | <p>I have the following data:</p>
<pre class="lang-py prettyprint-override"><code>weights = [
np.array([np.array([1, 2, 3]), np.array([1, 2, 3])]),
np.array([np.array([1, 2, 3]), np.array([1, 2, 3])]),
np.array([np.array([1, 2, 3]), np.array([1, 2, 3])]),
np.array([np.array([1, 2, 3]), np.array([1, 2, 3... | <python><numpy> | 2023-05-07 15:37:19 | 1 | 2,340 | Vivere |
76,194,609 | 4,575,197 | if the name exists in the Excel, check if a folder for that name exists, if true copy the Folder | <p>I've been working on this for days but no luck. I have some folder in another folder and I need to check if the Name of these folders appear on a Excel sheet. If so I want to copy the files to another folder. It seems easy job to be, but I'm kind of new to python so I'm lost.</p>
<p>An Example of the list of names i... | <python><pandas><excel><algorithm><directory> | 2023-05-07 14:45:21 | 1 | 10,490 | Mostafa Bouzari |
76,194,563 | 18,904,265 | UnboundLocalError at ConnectionError for API call with requests | <p>I am trying to write myself a function to handle my calls to an API, which return a JSON. This is my function at the moment:</p>
<pre class="lang-py prettyprint-override"><code>import requests
def get_data(url:str, headers:str, timeout_seconds=5) -> str:
"""Return JSON file from API call."... | <python> | 2023-05-07 14:33:59 | 2 | 465 | Jan |
76,194,506 | 20,568,970 | why collide_mask is significantly slower than collide_rect in pygame? | <p>i have this piece of code here to add collision to my pygame game:</p>
<pre class="lang-py prettyprint-override"><code> collidable_sprites = self.tiles["ground"].sprites. Sprites() + self.tiles["fg_machines"].sprites.sprites()
for sprite in collidable_sprites:
if sprite... | <python><performance><pygame> | 2023-05-07 14:22:35 | 1 | 334 | nope |
76,194,364 | 12,894,926 | How to build a self-contained Python venv? | <p>Is that possible to build a self-contained Python virtual environment? By self-contained, I mean that all needed files to execute the program are there, <strong>including Python.</strong></p>
<p>I'm using Poetry to manage <code>venv</code>s. Looking at <code>venv</code>s I created using <code>poetry install</code> I... | <python><virtualenv><python-packaging><python-venv><python-poetry> | 2023-05-07 13:57:45 | 3 | 1,579 | YFl |
76,194,314 | 2,647,447 | Need to click text entering area before enter text successfully in selenium python | <p>I need to entering text in a text entering area. my command is:</p>
<pre><code>self.driver.find_element_by_xpath(f"{self.plateId_input}").send_keys(plateId)
</code></pre>
<p>but I have found out issue this command does not work. I have to issue the same command twice. The first time is to click the text ar... | <python><selenium-webdriver> | 2023-05-07 13:46:23 | 1 | 449 | PChao |
76,194,228 | 2,032,998 | In a polars dataframe, filter a column of type list by another column of type list | <p>I have a <a href="/questions/tagged/polars" class="s-tag post-tag" title="show questions tagged 'polars'" aria-label="show questions tagged 'polars'" rel="tag" aria-labelledby="tag-polars-tooltip-container" data-tag-menu-origin="Unknown">polars</a> dataframe as below:</p>
<p>Example input:</p>
<pre c... | <python><dataframe><python-polars> | 2023-05-07 13:29:54 | 1 | 433 | D_usv |
76,193,930 | 1,581,090 | How to call a method in a running python code from another code? | <p>I am running a small python code <code>background.py</code> as follows:</p>
<pre><code>class Background:
def __init__(self):
self.q = 0
def run(self):
while True:
print(f"test, q={self.q}")
time.sleep(5)
def setq(self, x):
self.q += x
pr... | <python> | 2023-05-07 12:28:48 | 0 | 45,023 | Alex |
76,193,921 | 1,779,532 | `object` class has does not have all magic methods, such as __add__(), but how the magic methods are supported by inheriting `object` class? | <p>In Python, all classes inherit 'object' class. I found that the 'object' class does not have all magic methods.</p>
<pre class="lang-py prettyprint-override"><code>>>> dir(object)
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__... | <python> | 2023-05-07 12:26:11 | 0 | 2,544 | Park |
76,193,710 | 5,561,144 | Plotting polar function using matplotlib | <p>I'm trying to plot this function using matplotlib.</p>
<p><a href="https://i.sstatic.net/yR0wj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yR0wj.png" alt="Desmos version" /></a></p>
<p>As you can see in the Desmos app, the equation correctly plot the function as circle, but when I try to port it t... | <python><numpy><matplotlib><polar-coordinates> | 2023-05-07 11:41:59 | 1 | 799 | Fahmi Noor Fiqri |
76,193,660 | 2,302,262 | In python, can I return a child instance when instantiating its parent? | <p>I have a zoo with animals, represented by objects. Historically, only the <code>Animal</code> class existed, with animal objects being created with e.g. <code>x = Animal('Bello')</code>, and typechecking done with <code>isinstance(x, Animal)</code>.</p>
<p>Recently, it has become important to distinguish between spe... | <python><class> | 2023-05-07 11:33:41 | 4 | 2,294 | ElRudi |
76,193,644 | 14,555,505 | Numpy variable slice size (possibly zero) | <p>Lets say I've got some time series data:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
x = np.linspace(0, 10, num=100)
time_series = np.sin(x) + np.random.random(100)
plt.plot(x, time_series)
</code></pre>
<p><a href="https://i.sstatic.net/V... | <python><numpy><indexing><slice> | 2023-05-07 11:30:54 | 2 | 1,163 | beyarkay |
76,193,476 | 12,487,076 | How to deal with OverflowError when you modify exif data for images? | <p>Inside a loop the code successfully modifies exif data for jpeg images,</p>
<pre><code>...
with open(f"{old_source_path}{item.path}", "rb") as im_file:
imexif = Image2(im_file)
# Description
imexif.copyright = "Copyright 2023 somebody. All Rights Reserved."
# GPS
i... | <python> | 2023-05-07 10:54:41 | 1 | 303 | ML Rozendale |
76,193,385 | 4,304,610 | How to find highlighted text in pdf with python (or differentiate it from its unhighlighted counterpart) | <p>I have several pdf files containing multiple choice questions where choices are formatted as a table and their answers formatted as the same but the correct answer is highlighted.</p>
<p>I want to create a pdf or txt file only with the questions and a seperate pdf or txt file only with the answers in order (like 1-D... | <python><pypdf> | 2023-05-07 10:32:51 | 0 | 313 | UΔur DinΓ§ |
76,193,289 | 4,002,633 | Django Many2Many query to find all `things` in a group of `categories` | <p>Given these Django models:</p>
<pre class="lang-py prettyprint-override"><code>from django.db import models
class Thing(models.model):
name = models.CharField('Name of the Thing')
class Category(models.model):
name = models.CharField('Name of the Category')
things = models.ManyToManyField(Thing, verbos... | <python><django><django-queryset><contains><m2m> | 2023-05-07 10:13:44 | 1 | 2,192 | Bernd Wechner |
76,193,177 | 5,760,497 | TypeError: '>=' not supported between instances of 'list' and 'dict' | <p>I wanted to create a permutation test in python, I have a dictionary of observed values, denoted as "a", and a randomly generated values, denoted as "b":</p>
<pre><code> a = {0: 4,1: 3.0,2: 4.0,3: 2.0,4: 3.0,5: 3.0,6: 3.0,7: 3.0,8: 3.0,9: 3.0,10: 2.0
,11: 3.0,12: 2.0, 13: 4,14: 2.0,15: ... | <python><numpy><dictionary><scipy><operators> | 2023-05-07 09:50:58 | 0 | 518 | Gerard |
76,193,111 | 7,895,542 | How can i speed up this combinatorical problem? | <p>I have the following problem: I want do calculate something that can be considered a distance between team trajectories in a 5 (v 5) player game to in the end do clustering on these trajectories.</p>
<p>I have a working setup. However, it is extremely slow to calculate the distances/clusters for any appreciable numb... | <python><performance><combinatorics> | 2023-05-07 09:32:41 | 1 | 360 | J.N. |
76,193,025 | 1,889,213 | How to get pipreqs to skip files that fail to run | <p>Many python files in my current project do not run / have syntax errors.</p>
<p>How can I get pipreqs to keep generating the requirements.txt, skipping those failures?</p>
| <python> | 2023-05-07 09:11:51 | 1 | 1,517 | user3180 |
76,192,974 | 1,008,728 | Shuffling sequences in a list | <p>I have a list containing sequences of various lengths. The pattern of a sequence is as follows:</p>
<p><code>x_k, y_k, ..., x_k_i, y_k_i, ... z_k</code></p>
<p>For example, a list having 4 sequences with lengths: 3, 3, 5, and 7 is as follows:</p>
<pre><code>input_list = ['x_1', 'y_1', 'z_1',
'x_2', 'y... | <python> | 2023-05-07 08:56:55 | 3 | 1,360 | Saad |
76,192,935 | 1,581,090 | How to run a permanent background process within the python-flask framework? | <p>I am about to code a simple browser-based game in which players can connect to it via browser using python and flask. Now, I want this game still to be running when no player is connected to the backend, as things are going on in the game. That can be handled by a separate process running and accessing a database, a... | <python><flask> | 2023-05-07 08:44:38 | 1 | 45,023 | Alex |
76,192,496 | 8,697,724 | Openai /v1/completions vs. /v1/chat/completions end points | <pre><code>class OpenaiClassifier():
def __init__(self, api_keys):
openai.api_key = api_keys['Openai']
def get_ratings(self, review):
prompt = f"Rate the following review as an integer from 1 to 5, where 1 is the worst and 5 is the best: \"{review}\""
respon... | <python><openai-api> | 2023-05-07 06:29:58 | 7 | 473 | David Zayn |
76,192,459 | 3,391,549 | How to convert pandas data frame to Huggingface Dataset grouped by column value? | <p>I have the following data frame <code>df</code></p>
<pre><code>import pandas as pd
from datasets import Dataset
data = [[1, 'Jack', 'A'], [1, 'Jamie', 'A'], [1, 'Mo', 'B'], [1, 'Tammy', 'A'], [2, 'JJ', 'A'], [2, 'Perry', 'C']]
df = pd.DataFrame(data, columns=['id', 'name', 'class'])
> df
id name class
0 1 ... | <python><pandas><huggingface> | 2023-05-07 06:17:41 | 1 | 9,883 | Adrian |
76,192,357 | 3,391,549 | How to convert a pandas data frame to a sliceable dictionary | <p>I have a pandas data frame <code>df</code> that looks like this</p>
<pre><code>import pandas as pd
data = [[1, 'Jack', 'A'], [1, 'Jamie', 'A'], [1, 'Mo', 'B'], [1, 'Tammy', 'A'], [2, 'JJ', 'A'], [2, 'Perry', 'C']]
df = pd.DataFrame(data, columns=['id', 'name', 'class'])
> df
id name class
0 1 Jack A
... | <python><pandas> | 2023-05-07 05:42:45 | 2 | 9,883 | Adrian |
76,192,245 | 3,511,656 | Trying to build a jacobian matrix using the multiprocessing library in python - how to share a matrix variable across multiple processes? | <p>I was trying to construct the jacobian matrix in python using central differences. I want to use multiple cores that I have access to to build this matrix. I tried to use the Process library. I wasn't sure if this or the pool library would let me utilize more cores to complete this task. Suggestions on what would be... | <python><matrix><multiprocessing> | 2023-05-07 04:52:39 | 1 | 1,133 | Eigenvalue |
76,192,202 | 806,160 | how can solve ANTLR Runtime version error in pyspark? | <p>I want run a code with pyspark that read a csv file. The code is :</p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import SparkSession
spark = (SparkSession.builder.appName("4-1")
.getOrCreate())
csv_file = "departuredelays.csv"
schema = "`date` STRING,... | <python><pyspark><runtime-error><antlr4> | 2023-05-07 04:32:26 | 0 | 1,423 | Tavakoli |
76,192,108 | 2,475,195 | Cursor in jupyter notebook is a green rectangle | <p>I think I may have inadvertently hit some keyboard shortcut on my laptop. Each time I click inside a cell, the cursor is a green rectangle, and it seems to behave in a command mode. If I enter <code>a</code> or <code>i</code> it goes back to normal (edit mode). Which is what I want pretty much all the time, so my ex... | <python><jupyter-notebook><jupyter> | 2023-05-07 03:44:46 | 1 | 4,355 | Baron Yugovich |
76,192,068 | 1,603,480 | Retrieving Continuation Token in Azure DevOps Python API v7.0+ for Paginated Results | <p>In earlier versions of the Azure DevOps Python API (until 6.0.0b4), when making a request on some items (e.g. WorkItems, Test Suites, ...), you had a response object with a value and a <code>continuation_token</code> that you could use to make a new request and continue parsing.</p>
<p>With more recent versions (in ... | <python><azure-devops><pagination> | 2023-05-07 03:25:01 | 1 | 13,204 | Jean-Francois T. |
76,192,051 | 8,936,561 | Why a GeneratorExit instance is replaced with another one inside an inner coroutine? | <p>I'm developing my own async-library, and have been facing an issue regarding <code>coroutine.throw()</code>. Take a look at the code below. This code works as I expect.</p>
<pre class="lang-py prettyprint-override"><code>import types
import pytest
@types.coroutine
def sleep_forever():
yield lambda __: None
a... | <python><python-3.x><async-await> | 2023-05-07 03:17:38 | 0 | 988 | NattΕsai MitΕ |
76,191,862 | 395,857 | How can I fine-tune mBART-50 for machine translation in the transformers Python library so that it learns a new word? | <p>I try to fine-tune mBART-50 (<a href="https://arxiv.org/pdf/2008.00401" rel="nofollow noreferrer">paper</a>, <a href="https://huggingface.co/facebook/mbart-large-50" rel="nofollow noreferrer">pre-trained model on Hugging Face</a>) for machine translation in the transformers Python library. To test the fine-tuning, I... | <python><huggingface-transformers><pre-trained-model><machine-translation><fine-tuning> | 2023-05-07 01:29:35 | 1 | 84,585 | Franck Dernoncourt |
76,191,788 | 2,150,411 | pydantic - (de)serialize list to dict | <p><strong>With:</strong> Pydantic, (de)serializing to/from JSON</p>
<p><em>Goal:</em> deserialize a List of objects, to a dictionary, lifting a property on the child object, as the key in the dictionary for the serialized form, and of course back again when deserializing.</p>
<p><strong>Example:</strong></p>
<p>I have... | <python><serialization><deserialization><pydantic> | 2023-05-07 00:44:03 | 1 | 501 | Ramon |
76,191,661 | 8,134,164 | Module 'swagger_client' has no attribute 'CustomSpeechTranscriptionsApi' | <p>I'm using Microsoft's official GitHub repository to set up <a href="https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/batch/python" rel="nofollow noreferrer">Azure Speech Services Batch Transcription API from Python</a></p>
<p>I receive an error from line number 142 in main.py which ... | <python><swagger><azure-cognitive-services><azure-speech> | 2023-05-06 23:48:49 | 1 | 4,372 | Indrajith Ekanayake |
76,191,616 | 7,662,164 | Jit a JAX function that select a function from a dictionary | <p>I have a JAX function that, given the order and the index, selects a polynomial from a pre-defined dictionary, as follows:</p>
<pre><code>poly_dict = {
(0, 0): lambda x, y, z: 1.,
(1, 0): lambda x, y, z: x,
(1, 1): lambda x, y, z: y,
(1, 2): lambda x, y, z: z,
(2, 0): lambda x, y, z: x*x,
(2,... | <python><dictionary><conditional-statements><jit><jax> | 2023-05-06 23:31:10 | 1 | 335 | Jingyang Wang |
76,191,444 | 2,256,031 | How to optimize n async concurrent calls made in Kotlin | <p>I have the following code in Kotlin and curious if there is a way to further optimize it compared to the Python implementation that I think is somewhat equivalent?</p>
<p>Kotlin version <code>1.8.20-release-327 (JRE 17.0.7+7</code></p>
<pre><code>import java.net.http.HttpClient
import java.net.http.HttpRequest
impor... | <python><kotlin><asynchronous><async-await><kotlin-coroutines> | 2023-05-06 22:27:09 | 1 | 1,785 | Petesta |
76,190,962 | 4,322 | Running a script after creation of instance in GCP Managed Instance Group | <p>I'm using the distributed compute framework Bacalhau[0]. The pattern for setting up a cluster is the following:</p>
<pre><code>$ curl -sL https://get.bacalhau.org/install.sh | bash
[...output...]
$ bacalhau serve
To connect another node to this private one, run the following command in your shell:
bacalhau serve --n... | <python><go><google-cloud-platform><google-cloud-storage> | 2023-05-06 20:21:46 | 2 | 7,148 | aronchick |
76,190,916 | 1,953,475 | Attrition Calculation Performance | <p>TLDR:</p>
<ol>
<li>how to speed up the SQL calculation for attrition given it is O(n^2)</li>
<li>how to distribute the python implementation for attrition given it maintains a counter (cumulative leavers and cumulative joiners)</li>
<li>any other ideas? (influxdb? kinetica? )</li>
</ol>
<p>I need to calculate <a hre... | <python><sql><pandas><pyspark><time-series> | 2023-05-06 20:10:19 | 1 | 19,728 | B.Mr.W. |
76,190,897 | 4,966,317 | How to split a column of defined strings written without spaces in pandas, e.g. appleorange to apple orange? | <p>I am trying to write a code in python that splits a column value in a pandas dataframe. This column will have values like <code>appleorangemango</code> that I want to split to <code>apple orange mango</code>. I will have a large set of unique words that I will split with respect to them.</p>
<p>Assume that I have th... | <python><python-3.x><pandas> | 2023-05-06 20:06:12 | 1 | 2,643 | Ambitions |
76,190,870 | 10,564,566 | Failing in the patching of a python function | <p>I have a problem with mocking functions outside classes in unittest.
Let's say that my project looks like that:</p>
<p><a href="https://i.sstatic.net/WxQwk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WxQwk.png" alt="enter image description here" /></a></p>
<p>file a.py:</p>
<pre><code>class A:
... | <python><python-3.x><unit-testing><mocking><python-unittest> | 2023-05-06 20:01:45 | 0 | 539 | Matmozaur |
76,190,787 | 6,567,212 | How to write a pandas dataframe to kdb+ partition table on disk | <p>I need to use kdb+ in Python, so tried <a href="https://github.com/exxeleron/qPython" rel="nofollow noreferrer">qpython</a> 2.0 to write a Pandas dataframe like this</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({'sym':['abc','def','ghi'],'price':[10.1,10.2,10.3]})
with qconnection.QConnectio... | <python><pandas><database><dataframe><kdb+> | 2023-05-06 19:41:29 | 1 | 329 | ningl |
76,190,747 | 595,305 | How can I install pyenv-win Python versions outside C:\Users? | <p>My C: drive is always too full, some useful stuff but 80% execrable, unremovable Microsoft bloatware. I always install new stuff on another drive.</p>
<p>I've tried <a href="https://github.com/pyenv-win/pyenv-win" rel="nofollow noreferrer">this installation page</a> for installing pyenv-win.</p>
<p>Even if I set the... | <python><windows-10><pyenv><installation-path> | 2023-05-06 19:32:19 | 2 | 16,076 | mike rodent |
76,190,703 | 21,784,274 | Is there anyway to protect Django source code from being revealed, after giving server access to the client? | <p>After deploying a Django project and giving server access to the client, is there anyway to protect the source code from being revealed?</p>
<p>Maybe somthing like seperating the servers for holding the database and the source code?<br />
Or having some lock or something on the docker container of the Django project... | <python><django><database><docker><source-code-protection> | 2023-05-06 19:21:57 | 0 | 947 | Mohawo |
76,190,531 | 13,055,818 | __radd__ operation with numpy number results to __getitem__ loop | <p>I am implementing a class that handles basic binary operations such as addition, multiplication, subraction and division with their respective variants (reversed, in-place). I encountered an unexpected behaviour that I am trying to understand. Unfortunately, even by looking at numpy's implementation of <code>__add__... | <python><numpy> | 2023-05-06 18:39:15 | 1 | 519 | Maxime Debarbat |
76,190,481 | 6,224,975 | Remove the the obersvations which is more than the i'th duplicated observation pandas | <p>Say I have a dataframe like</p>
<pre class="lang-py prettyprint-override"><code>a b c
1 2 3
1 2 3
.
.
</code></pre>
<p>and I want to allow, say, 100 duplicated values of <code>a</code> and <code>b</code> pairs i.e say theres 200 pairs of <code>a=1</code> and <code>b=2</code> then I want to keep 100 of those.</... | <python><pandas> | 2023-05-06 18:26:58 | 4 | 5,544 | CutePoison |
76,190,373 | 740,371 | Asyncio.create_task() not executed immediately in a callback function | <p>My code uses <code>FastAPI</code>, <code>WebSocket</code> and <code>Asyncio</code>, and I need to send messages through websockets from a callback function to give a real-time progress value to the user (5%, 10%, 15% and so on).</p>
<p>But all the messages from the callback function are sent after the main function ... | <python><websocket><fastapi> | 2023-05-06 18:04:04 | 0 | 1,640 | Yann Masoch |
76,190,265 | 10,754,437 | Using custom Python CDK lib build from Typescript source using jsii and jsii-pacmak | <p>I managed to generate 2 files defining a Python lib build from a Typascript code base as described in the AWS workshop:</p>
<p><a href="https://catalog.us-east-1.prod.workshops.aws/workshops/d93fec4c-fb0f-4813-ac90-758cb5527f2f/en-US/walkthrough/typescript/sample/target-construct/build-and-package" rel="nofollow nor... | <python><python-3.x><aws-cdk><aws-cdk-typescript> | 2023-05-06 17:37:54 | 1 | 2,597 | SecretIndividual |
76,190,124 | 12,466,687 | How to get struct datatype similar to value_counts() return in polars? | <p>I am trying to combine <strong>two columns</strong> row wise and get something similar to what <code>value_counts()</code> returns in <code>polars</code>.</p>
<p>I have tried to use the <code>to_struct</code> but that didn't give the result that I expected.</p>
<p>data:</p>
<pre><code>import polars as pl
df = pl.Da... | <python><dataframe><python-polars> | 2023-05-06 17:04:31 | 1 | 2,357 | ViSa |
76,190,115 | 9,835,749 | Fastest way to compute n-gram overlap matrix in Python | <p>I have a large corpus of documents that I want to merge if they have a notable n-gram overlap (in my case, I'm considering bigrams). Consider the list of sets:</p>
<pre><code>corpus = [{'example', 'bigram'}, {'another', 'example'}, {'some', 'outlier'}]
</code></pre>
<p>I have the following code to compute the simila... | <python><python-3.x><numpy><set><n-gram> | 2023-05-06 17:03:17 | 2 | 332 | errno98 |
76,190,079 | 2,386,605 | Expose FastAPI on two different ports | <p>I want to scrape some metrics from my FastAPI server. However, I do not want to show it to the public in contrast to the remaining API.</p>
<p>Hence, I resolved to create a second server and tried to run (inspired by this <a href="https://stackoverflow.com/questions/69641363/how-to-run-fastapi-app-on-multiple-ports"... | <python><docker><docker-compose><fastapi> | 2023-05-06 16:52:13 | 1 | 879 | tobias |
76,189,975 | 9,008,300 | Fine-tuning an already trained XGBoost classification model | <p>I have trained an XGBoost classification model for sentiment analysis of product reviews. However, there are certain cases where the model predictions are not as expected. For example, when I input the review "The delivery was a bit late but the product was awesome", the model classifies it as a negative r... | <python><xgboost><xgbclassifier> | 2023-05-06 16:27:58 | 1 | 422 | Chris |
76,189,964 | 275,552 | Regex pattern isn't matching in python but works in regex101 | <p>Given text that looks like this:</p>
<pre><code>146.204.224.152 - feest6811 [21/Jun/2019:15:45:24 -0700] "POST /incentivize HTTP/1.1" 302 4622
197.109.77.178 - kertzmann3129 [21/Jun/2019:15:45:25 -0700] "DELETE /virtual/solutions/target/web+services HTTP/2.0" 203 26554
156.127.178.177 - okuneva52... | <python><regex> | 2023-05-06 16:25:32 | 1 | 16,225 | herpderp |
76,189,924 | 6,071,128 | String manipulation - for each value in a dataframe column, extract a custom string of text comprised between two separators | <p>I have an imported dataframe which includes mainly text values under the column <code>'full_name'</code> . The values look typically like this: <code>'Insulation, glass wool, water repellent, kraft paper lining, 2.25 Km2/W, 90 mm, 12 kg/m3, 1.08 kg/m2, IBR (Isover)'</code></p>
<p>Now I would like to extract from the... | <python><pandas><string><text> | 2023-05-06 16:17:02 | 1 | 1,093 | Andreuccio |
76,189,836 | 12,129,443 | How to interpret the xaxis values of a density histogram when there's an offset | <p>I have a list of 100000 values, all are around 299800 as shown below.</p>
<pre><code>values = [299850.3 299856.4 299855.9 ... 299843.7 299847.2 299860.9]
</code></pre>
<p>When I plot a Probability Density Function (PDF) of these values using <code>matplotlib.pyplot.hist</code>, I am getting the plot whose X-axis and... | <python><matplotlib><histogram> | 2023-05-06 15:57:35 | 0 | 668 | Srinivas |
76,189,830 | 10,973,108 | Docker compose is loading files that should ignore? | <p>Why my container has files/folders that should be ignored?</p>
<p>example:</p>
<pre class="lang-bash prettyprint-override"><code>β ~ docker exec -it athena-app-container /bin/bash
root@db2ecfd0967b:/project# ls
__pycache__ app extensions should_ignore.txt
api constants serializers utils
root@db2ecfd096... | <python><bash><docker><docker-compose><devops> | 2023-05-06 15:56:25 | 0 | 348 | Daniel Bailo |
76,189,815 | 12,724,372 | AWS lambda throwing import error because of URLLIB | <p>Im running a python script on aws lambda and its throwing the following error.</p>
<pre><code> {
"errorMessage": "Unable to import module 'app': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with OpenSSL 1.0.2k-fips 26 Jan 2017. See: https://github.com/urllib3/u... | <python><amazon-web-services><urllib> | 2023-05-06 15:53:48 | 11 | 1,275 | Devarshi Goswami |
76,189,806 | 8,750,051 | How does inferSchema for PySpark really work? | <p>Reading the documentation <a href="https://spark.apache.org/docs/latest/sql-data-sources-csv.html#data-source-option" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/sql-data-sources-csv.html#data-source-option</a>, it is very clear that inferSchema "Infers the input schema automatically from dat... | <python><pyspark><etl><data-processing> | 2023-05-06 15:52:08 | 0 | 422 | RoiMinuit |
76,189,808 | 4,180,276 | Making a binary package for my open source project | <p>I currently have the following open source project, <a href="https://github.com/nadermx/backgroundremover" rel="nofollow noreferrer">https://github.com/nadermx/backgroundremover</a> I followed the tutorial <a href="https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/" rel="nofol... | <linux><python><pip> | 2023-05-06 15:50:32 | 0 | 2,954 | nadermx |
76,189,742 | 8,236,050 | Integrate Google Colab GPUs with docker | <p>I am trying to build a Reinforcement Learning tool, but I have no access to a GPU nor can I afford it. Due to this, I was thinking on using the GPU resources provided freely, for example, by Google Colab. Nevertheless, my project cannot be executed as a python notebook, because it is a very big project consisting on... | <python><docker><gpu><google-colaboratory> | 2023-05-06 15:38:49 | 0 | 513 | pepito |
76,189,730 | 8,281,276 | Flask uploaded file size is not correct | <p>Why flask's uploaded file byte length is shorter than what it is actually? I'm seeing same behavior for several images.</p>
<pre><code>from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
f = file.read()
print(len(f)) #... | <python><flask> | 2023-05-06 15:35:32 | 1 | 1,676 | Wt.N |
76,189,618 | 12,845,199 | Trasnforming, kg ml, l, proportion into g proportion | <p>I have the following pd.Series</p>
<pre><code>s = pd.Series(['3.95/kg', '3.30/kg', '3.49/kg', '3.96/g', '8.49/kg', '3.19/kg',
'0.0154/g', '8.98/kg', '6.35/kg', '5.79/kg', '3.79/kg', '6.59/kg',
'3.50/kg', '3.85/kg', '3.55/kg', '5.59/kg', '5.98/kg', '0.0152/g',
'5.99/kg', '3.20/gr', '8.99/kg', '16... | <python><pandas> | 2023-05-06 15:10:23 | 1 | 1,628 | INGl0R1AM0R1 |
76,189,260 | 1,185,254 | Flask render_template does not update the page | <p>I am trying to upload a file, make some calculations to generate an image and then to display it. I came up with the following, but the page does not refresh after the <code>redirect</code>. Even though I get the correct codes:</p>
<pre><code>"POST /result HTTP/1.1" 302 -
"GET /display_image/census_20... | <python><flask><http-redirect><request><response> | 2023-05-06 13:53:22 | 1 | 11,449 | alex |
76,189,129 | 10,970,202 | pyspark dataframe to tfrecords not working | <p>pyspark 3.2.0</p>
<p>I've downloaded spark-tensorflow-connector.jar file from <a href="http://spark.apache.org/third-party-projects.html" rel="nofollow noreferrer">http://spark.apache.org/third-party-projects.html</a>.</p>
<p>After creating spark session with jar file added
from pyspark.sql import SparkSession</p>
<... | <python><apache-spark><pyspark> | 2023-05-06 13:23:50 | 1 | 5,008 | haneulkim |
76,188,882 | 10,164,750 | comparing all the rows with in a group pyspark dataframe | <p>I have dataframe as below, where I need to compare the row values of column <code>first_nm</code> and <code>sur_nm</code> within a group based on <code>company</code>. Based on the matching I would assign a value to <code>status</code> column in the output.</p>
<pre><code>+--------+--------+----------------+--------... | <python><dataframe><apache-spark><pyspark> | 2023-05-06 12:26:38 | 2 | 331 | SDS |
76,188,656 | 21,725,164 | Can't run python3 in command line | <p>I have installed python 3.11 on my Widnows from its official website, and when I want to run it in command line by typing "python3" it doesn't run Python for me; Instead it opens Microsoft store for me to download Python!</p>
<p>I tried reinstalling it but it didn't fix. Did I miss anything before installi... | <python><python-3.11> | 2023-05-06 11:38:13 | 1 | 608 | Hr.Panahi |
76,188,468 | 7,476,542 | Retrieve the return value of a function used in threading.Timer method | <p>I have a function <code>check_is_window_open</code> which checks if a Windows application is open or not ? If the application is open then it will return 1 else 0</p>
<p>Here is the function :</p>
<pre><code>from pywinauto import Application,keyboard
def check_is_window_open():
try:
app = Application(bac... | <python><multithreading><timer><pywinauto> | 2023-05-06 10:52:40 | 1 | 303 | Sayandip Ghatak |
76,188,369 | 4,305,436 | Running Pytest test cases in transaction isolation in a FastAPI setup | <p>I have a FastAPI application, with MySQL and <code>asyncio</code>.</p>
<p>I have been trying to integrate some test cases with my application, with the ability to rollback the changes after every test case, so that all test cases can run in isolation.</p>
<p>This is how my controller is set up, with a DB dependency ... | <python><mysql><sqlalchemy><python-asyncio><fastapi> | 2023-05-06 10:23:17 | 1 | 796 | Sidharth Samant |
76,188,348 | 7,553,746 | Why is my JSON data with null not returning 0 causing an exception? | <p>I have an API which returns null when there are no results, else it's usually got a count with an int. In this minimal example with a similar data structure, if either value is null I'd hope to return 0.</p>
<p>I thought that adding <code>{}</code> usually allows traversing deeper into the data I get the following:... | <python><json> | 2023-05-06 10:16:48 | 2 | 3,326 | Johnny John Boy |
76,188,316 | 3,783,002 | Is `PYTHONPATH` really an environment variable? | <p>The <a href="https://docs.python.org/3/library/sys.html#sys.path" rel="noreferrer">docs</a> for <code>sys.path</code> state the following:</p>
<blockquote>
<p>A list of strings that specifies the search path for modules. Initialized from the environment variable PYTHONPATH, plus an installation-dependent default.</p... | <python><environment-variables><pythonpath> | 2023-05-06 10:09:37 | 1 | 6,067 | user32882 |
76,188,195 | 6,630,397 | Cleanest way of changing dtype of several DataFrame columns | <p>I have four columns of type <code>object</code> in a Pandas (2.0.1) <a href="https://pandas.pydata.org/docs/reference/frame.html" rel="nofollow noreferrer">DataFrame</a> which want to convert to <code>int</code>.</p>
<p>Applying the following method:</p>
<pre><code>cols = ['x1','x2','y1','y2']
df[cols] = df[cols].a... | <python><pandas><dataframe><dtype> | 2023-05-06 09:43:08 | 3 | 8,371 | swiss_knight |
76,188,133 | 7,025,033 | Python, numpy performance inconsistency | <p>I am creating a cell-automata, and I was doing a performance test on the code.</p>
<p>I did it like this:</p>
<pre><code>while True:
time_1 = perf_counter_ns()
numpy.fnc1()
time_2 = perf_counter_ns()
numpy.fnc2()
time_3 = perf_counter_ns()
numpy.fnc3()
time_4 = perf_counter_ns()
numpy... | <python><numpy><performance> | 2023-05-06 09:26:03 | 1 | 1,230 | Zoltan K. |
76,187,997 | 7,195,332 | Azure QueueClient Python can't use DefaultAzureCredential | <p>I'm using <em>DefaultAzureCredential()</em> from <em>azure.identity</em> to get credential and use it to establish TableServiceClient (azure.data.table) connection. It works.
If I am trying to do the same for QueueClient (azure.storage.queue), I'm getting following error.
As far as I understand documentation, it sho... | <python><azure><azure-functions><azure-sdk-python> | 2023-05-06 08:54:01 | 1 | 333 | Caishen |
76,187,968 | 8,281,276 | Feed input as test case for a source code in string | <p>I'm making a simple quiz app that asks a user to write a source code. For example, a user is asked to "Given n values, add them and print it". Input is</p>
<pre class="lang-none prettyprint-override"><code>N
a[0], a[1], ..., a[N-1]
</code></pre>
<p>and output is</p>
<pre class="lang-none prettyprint-overri... | <python> | 2023-05-06 08:47:02 | 1 | 1,676 | Wt.N |
76,187,889 | 4,692,635 | Why does regular expression think chr(181) and chr(956) are the same when ignoring case? | <h1>1. What I met</h1>
<p>My following code:</p>
<pre class="lang-py prettyprint-override"><code>import re
txt = 'ΞΌ'
lst = [
chr(181),
chr(956)
]
for c in lst:
print(c)
reObj = re.compile(c, re.IGNORECASE | re.VERBOSE )
print(list(re.finditer(reObj, txt)))
</code></pre>
<p>displays:</p>
<pre><cod... | <python><regex><unicode><python-re> | 2023-05-06 08:26:10 | 0 | 567 | oyster |
76,187,525 | 3,234,803 | Type function that returns a function wrapper | <p>I'm trying to annotate the return type of the function below:</p>
<pre class="lang-py prettyprint-override"><code>from concurrent.futures import Executor
from typing import Callable
from typing_extensions import Concatenate, ParamSpec, TypeVar
_P = ParamSpec("_P")
_R = TypeVar("_R")
def make_... | <python> | 2023-05-06 06:53:42 | 1 | 6,718 | Zizheng Tai |
76,187,493 | 16,783,860 | SOLVED Why is np.empty == np.zeros True, and np.empty == np.zeros False | <p>New to python and maybe misunderstanding some fundamentals here, but having trouble making sense of the following.</p>
<pre><code>print(numpy.empty(3) == numpy.zeros(3))
#Result
[True True True]
</code></pre>
<pre><code>print(numpy.empty(3) == numpy.empty(3))
#Result
[False False False]
</code></pre>
<p>My origina... | <python><numpy> | 2023-05-06 06:42:39 | 3 | 383 | kenta_desu |
76,187,402 | 16,770,405 | Implementing Kosaraju's algorithm to detect a cycle in a list of edges | <p>I'm going off the pseudo code in this <a href="https://en.wikipedia.org/wiki/Kosaraju%27s_algorithm" rel="nofollow noreferrer">link</a> but I can't seem to get it working to detect the SCCs or any cycles. Trying to detect cycles in a list of edges Any help is appreciated.</p>
<pre class="lang-py prettyprint-override... | <python><directed-acyclic-graphs><directed-graph> | 2023-05-06 06:08:16 | 1 | 323 | Kevin Jiang |
76,187,395 | 8,283,848 | Aggregate sum of values from Django JSONField | <p>Consider I have a simple model setup with <strong><code>JSONField</code></strong></p>
<pre class="lang-py prettyprint-override"><code>from django.db import models
import random
def simple_json_callable():
return {"amount": random.randint(1, 100)}
def nested_json_callable():
data = {
&q... | <python><django><django-orm><django-jsonfield><jsonfield> | 2023-05-06 06:06:32 | 1 | 89,380 | JPG |
76,187,256 | 8,237,910 | ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3 | <p>After <code>pip install openai</code>, when I try to <code>import openai</code>, it shows this error:</p>
<blockquote>
<p>the 'ssl' module of urllib3 is compile with LibreSSL not OpenSSL</p>
</blockquote>
<p>I just followed a tutorial on a project about using API of OpenAI. But when I get to the first step which is ... | <python><openai-api><urllib3> | 2023-05-06 05:11:42 | 21 | 1,923 | maimai |
76,187,161 | 3,681,795 | QR Code with extra payload via steganography | <p>I'm trying to use the approach described on <a href="https://ieeexplore.ieee.org/document/8985346" rel="nofollow noreferrer">this paper</a> to "watermark" a QR Code with a special payload.</p>
<p>The whole flow seems to be correct, but I'm having some trouble saving the payload as bytes to be xor'd against... | <python><python-imaging-library><qr-code><steganography> | 2023-05-06 04:40:36 | 2 | 382 | Victor |
76,187,052 | 281,873 | Altair: How to use an aggregate that adds a facet (e.g., an extra column with the aggregate)? | <p>Aggregate and joinaggregate don't seem to be <em>quite</em> what I want here. I would like to add another facet to my plot that is an aggregation. I want to start with something like:</p>
<pre><code>import altair as alt
import pandas as pd
data = {
"Dataset": ["A", "B", "A&quo... | <python><altair> | 2023-05-06 03:49:56 | 2 | 385 | jowens |
76,187,045 | 10,464,107 | Django - if statement in template not working | <p>I have a Django site using the following models:</p>
<pre><code>class User_Posts(models.Model):
message = models.TextField(max_length=CONFIG['MODEL_SETTINGS']['User_Posts']['message_length'])
post_date = models.DateTimeField(auto_now_add=True)
character = models.ForeignKey(Characters, related_name='user_... | <python><django><django-models><django-views> | 2023-05-06 03:47:06 | 0 | 347 | DeathbyGreen |
76,187,007 | 6,063,706 | Weld mocap body to point of other body mujoco | <p>I am trying to weld a mocap body to the tip of a finger in mujoco. I am using the following code:</p>
<pre><code> <equality>
<weld body1="mocap_test" body2="finger1_distal" solimp="0.9 0.95 0.001" solref="0.02 1" anchor="0.0 0.1035 0.0"></weld>
... | <python><mujoco> | 2023-05-06 03:31:39 | 0 | 1,035 | Tob |
76,186,981 | 3,826,733 | manually test azure-cosmos sdk exceptions in python | <p>How do I force test exceptions in this below code. In the below code I am creating a record inside of Azure cosmos db and I want to manually test all types of failure scenarios?</p>
<pre><code>def resolve_createUser(_, info, user):
print(user)
try:
result = container.create_item({
"i... | <python> | 2023-05-06 03:21:52 | 0 | 3,842 | Sumchans |
76,186,944 | 3,789,200 | Can't import a method in a file in Python | <p>I'm creating a project with the following format.</p>
<p><a href="https://i.sstatic.net/6zMwA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6zMwA.png" alt="enter image description here" /></a></p>
<p>In the data_transformation.py following import is made.</p>
<pre><code>from src.utills import save_o... | <python><import> | 2023-05-06 03:09:25 | 1 | 1,186 | user3789200 |
76,186,763 | 9,371,999 | Value error using scikit-learn transformers | <p>I am having trouble with a piece of code I am writing. Specifically a pipeline. The data is a simple numerical dataframe (firewall logs) which is being split in X_train and X_test very commonly. After splitting, I devised a pipeline. This pipeline has 3 steps:</p>
<ol>
<li>ColumnTransformer(...some stuff going on he... | <python><scikit-learn><scikit-learn-pipeline> | 2023-05-06 01:42:42 | 1 | 529 | GEBRU |
76,186,738 | 1,290,170 | How to use Barrier to limit number of simultaneous threads? | <p>I am using multithreading in python to send HTTP requests, but if I send too many simultanesouly, my request gets blocked.</p>
<p>So I would like to send the requests 5 by 5. This is what I tried to do, but this doesn't seem to work.
Where in that code am I supposed to use the barrier, and what code is missing?</p>
... | <python><multithreading> | 2023-05-06 01:32:39 | 1 | 1,567 | alexx0186 |
76,186,506 | 2,478,485 | Creating python virtualenv is failing | <p>Creating <code>python3.10</code> <code>virtualenv</code> is failing</p>
<pre class="lang-py prettyprint-override"><code>$python -v -m virtualenv --python /usr/bin/python3.10 py310
# /home/test/.local/lib/python3.7/site-packages/virtualenv/activation/python/__pycache__/__init__.cpython-37.pyc matches /home/test/.l... | <python><virtualenv> | 2023-05-05 23:45:39 | 2 | 3,355 | Lava Sangeetham |
76,186,486 | 1,290,170 | How can I create delays in multithreading for HTTP requests? | <p>I am using multithreading in python to send HTTP requests, but if I send too many simultanesouly, my request gets blocked.</p>
<p>So I would like to send the requests 5 by 5.
This is what I tried to do, but this doesn't seem to work.</p>
<pre><code>for task in tasks:
thread = Thread(target=send_request,args=(a... | <python><multithreading> | 2023-05-05 23:42:24 | 1 | 1,567 | alexx0186 |
76,186,459 | 5,091,720 | Pandas 12 month Rolling average | <p>I am trying to get a 12 month rolling average and having a hard time with it.</p>
<p>This is the example data and the code.</p>
<pre><code>data = {
'Att' : ['red','red','red','red','tan','tan','tan','tan','cyan','cyan','cyan','cyan','cyan','red','red','red','red','tan','tan','tan','tan','cyan','cyan','red'],
... | <python><pandas><dataframe> | 2023-05-05 23:32:43 | 1 | 2,363 | Shane S |
76,186,389 | 1,663,528 | IDNA Encode Adding Apostrophes and letter B? | <p>I am using the IDNA library to encode/decode unicide domain names but when I encode a domain name, it adds apostrophes either side of the string and prepends the letter b?</p>
<p>For example:</p>
<pre><code>import idna
print(idna.encode('espaΓ±ol.com'))
</code></pre>
<p>Output: <code>b'xn--espaol-zwa.com'</code></p>
... | <python><punycode> | 2023-05-05 23:11:18 | 1 | 8,579 | Mr Fett |
76,186,356 | 1,302,606 | chromedriver suddenly slow (scraping with python, selenium) | <p>Have a python script running some scrapers using selenium and chromedriver.</p>
<p>Have been scraping the same sites for a few years now with no issues. Starting last night, the same sites have started to load EXTREMELY slowly when loaded through chromedriver, though loading on my regular un-automated browser is tot... | <python><selenium-webdriver><selenium-chromedriver><undetected-chromedriver> | 2023-05-05 23:00:53 | 4 | 425 | snn |
76,186,339 | 396,014 | Can I create a pandas dataframe that contains 2d arrays instead of lists? | <p>I have accelerometer/gyro dataβseries of x,y,z values for acceleration, angle, and angular velocityβthat I am trying to process to produce charts. I have the charts part worked out, but I currently process them one parameter at a time and would like to do all of them in one run. The data look like this (series trunc... | <python><pandas><dataframe><numpy-ndarray> | 2023-05-05 22:55:27 | 1 | 1,001 | Steve |
76,186,321 | 18,533,248 | Python: How to check if adding/subtracting two 8 bit integers causes a carry or a borrow? | <p>My question is as the title says: How to check if adding/subtracting two 8 bit integers causes a carry or a borrow?</p>
<p>Thanks!</p>
| <python><binary><integer><addition> | 2023-05-05 22:49:04 | 1 | 501 | kamkow1 |
76,186,317 | 2,302,262 | Bypass expensive initialisation when called internally | <p>Let's say I have a class with an init function that does many expensive checks on the input data, before storing it as an attribute:</p>
<pre class="lang-py prettyprint-override"><code>
def expensive_function_to_verify_data_is_ok(data) -> bool:
(...)
class MyClass:
def __init__(self, data):
if no... | <python><class> | 2023-05-05 22:47:44 | 1 | 2,294 | ElRudi |
76,186,239 | 6,846,071 | create a new column that compares rows in another column if it's different plus 1 | <p>I have a column named Customer and trying to create a new column Line ID, where it starts from 1 and increase by one whenever the customer is different from the previous customer. I'm using pandas dataframe.</p>
<p>example:</p>
<pre><code> Customer | Line ID
Pepsi | 1
Pepsi | 1
Lego ... | <python><pandas> | 2023-05-05 22:25:39 | 1 | 395 | PiCubed |
76,186,132 | 4,045,275 | Group and sum a numpy array based on the position of the columns in another array | <h3>What my data looks like</h3>
<p>I run certain numerical simulations in numba.</p>
<p>The output is a set of numpy arrays; each array represents a metric, and each array has shape <code>(periods x items)</code>.</p>
<p>E.g. <code>metric_1[p,i]</code> tells me the value of metric_1 at time <code>p</code> for item <co... | <python><pandas><numpy><group-by> | 2023-05-05 21:58:12 | 2 | 9,100 | Pythonista anonymous |
76,185,856 | 2,471,211 | AWS Wrangler - Pandas red_sql to S3 in a limited memory environment | <p>I am looking for a way to extract data from a database and push that data into a parquet dataset in S3 in a environment with limited memory. If I proceed like this:</p>
<pre><code>with someDB.connect() as connect:
df = pd.read_sql("SELECT * FROM table", connect)
wr.s3.to_parquet(df, dataset=True, p... | <python><pandas><amazon-s3><memory-management><parquet> | 2023-05-05 20:51:00 | 1 | 485 | Flo |
76,185,767 | 3,072,174 | How to print out the result of the last statement of an arbitrary Python script (not in interactive shell)? | <p>In an interactive Python shell, I can get the result of the last statement <a href="https://stackoverflow.com/questions/200020/get-last-result-in-interactive-python-shell">by using an underscore</a>:</p>
<pre class="lang-py prettyprint-override"><code>>>> x = 1
>>> y = 2
>>> x+y
3
>>... | <python> | 2023-05-05 20:36:21 | 1 | 1,577 | Dmitry Petrov |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.