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,297,775 | 16,467,154 | How to properly figure out all possible "long entries" made based on the OHLC data and upper bound and lower bound price series? Pandas related | <p>Say you have a Pandas <code>df</code> that contains the OHLC (short for the Open, High, Low, Close) prices of a particular financial asset.</p>
<p>Also, you have two other Pandas dataframes to consider, one of them called <code>upper_bound</code> that contains a series of prices which are above the close price, and ... | <python><pandas><dataframe><data-science><back-testing> | 2023-01-31 13:17:50 | 1 | 875 | NoahVerner |
75,297,701 | 13,023,224 | Remove and replace multiple commas in string | <p>I have this dataset</p>
<pre><code>df = pd.DataFrame({'name':{0: 'John,Smith', 1: 'Peter,Blue', 2:'Larry,One,Stacy,Orange' , 3:'Joe,Good' , 4:'Pete,High,Anne,Green'}})
</code></pre>
<p>yielding:</p>
<pre><code>name
0 John,Smith
1 Peter,Blue
2 Larry,One,Stacy,Orange
3 Joe,Good
4 Pete,High,Anne,Green
</code>... | <python><pandas><replace> | 2023-01-31 13:11:34 | 4 | 571 | josepmaria |
75,297,565 | 4,783,029 | How to disable iPython Notebook's (ipynb) cell output line wrapping in VSCode? | <p>I use PySpark in VSCode <code>ipynb</code> documents. The text lines in the cells <strong>output</strong> are wrapped and it is not possible to understand them correctly.</p>
<p><a href="https://i.sstatic.net/Z0pz2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Z0pz2.png" alt="enter image description... | <python><visual-studio-code><jupyter-notebook> | 2023-01-31 13:01:10 | 0 | 5,750 | GegznaV |
75,297,555 | 9,281,109 | Is there anyway to use kubernetes pods with a shared resource NFS to save chunks of files as they come? | <p>I have encountered in this issue for some days and I cannot get along with it with this configuration. So basically the issue is to open a request stream with octet-stream and as I get the file write it down to a file in filesystem, this works perfectly locally and hosted on Debian Linux servers, but there are some ... | <python><kubernetes><fastapi><nfs> | 2023-01-31 13:00:05 | 0 | 2,372 | Edi |
75,297,516 | 2,141,427 | Python function to extract specific values from complex JSON logs data | <p>I am trying to write a Python function (for use in a Google Cloud Function) that extracts specific values from JSON logs data. Ordinarily, I do this using the standard method of sorting through keys:</p>
<pre><code>my_data['key1'], etc.
</code></pre>
<p>This JSON data, however is quite different, since it appears to... | <python><json><data-structures><google-cloud-functions> | 2023-01-31 12:57:21 | 0 | 333 | Jman |
75,297,454 | 4,534,466 | MLFlow - Experiment tracking - No such file or directory | <p>I want to run experiment tracking on my jupyter notebooks, I've installed mlflow and have set it up as such:</p>
<pre><code>Path("mlruns").mkdir(parents=True, exist_ok=True)
mlflow.set_tracking_uri("file:mlruns")
client = mlflow.MlflowClient()
experiment_id = client.create_experiment(
EXPERI... | <python><mlflow> | 2023-01-31 12:52:17 | 0 | 1,530 | João Areias |
75,297,426 | 5,190,087 | How to handle the callback with MagicMock | <pre><code>import unittest
from mock import Mock, MagicMock
import time
wait = False
def pushback_callback(self, res):
print("Received callback")
wait = True
def pushback_fcn(callback):
print("pushback_fcn")
def execute():
pushback_fcn(pushback_callback)
while wait == False:
... | <python><python-mock><magicmock> | 2023-01-31 12:49:29 | 1 | 1,598 | Swapnil |
75,297,406 | 222,529 | How to make pytest select tests having markers with arguments | <p><a href="https://docs.pytest.org/en/7.2.x/example/markers.html#passing-a-callable-to-custom-markers" rel="nofollow noreferrer">According to the official documentation</a>, it is possible to mark tests with custom markers that have positional or keyword arguments. For instance:</p>
<pre class="lang-py prettyprint-ove... | <python><pytest> | 2023-01-31 12:48:11 | 1 | 3,215 | Jir |
75,297,385 | 15,537,675 | Read large json file - update? | <p>I'm having a large json file which I'm struggling to read and work with in python. It seems I can for instance run <code>json.loads()</code> but then it crashes after a while.</p>
<p>There are two questions which are basically the same thing:</p>
<p><a href="https://stackoverflow.com/questions/10382253/reading-rathe... | <python><json> | 2023-01-31 12:47:02 | 1 | 472 | OLGJ |
75,297,220 | 16,591,917 | Why does objective function for some iteration shows as NaN | <p>I have a Gekko model and is currently experimenting with different objective functions. Most of the objective functions is built with <code>.COST</code> and <code>.DCOST</code> constructs on <code>CV</code> and <code>MV</code> variables augmented by some additional <code>Maximize</code> and <code>Minimize</code> s... | <python><gekko> | 2023-01-31 12:33:57 | 1 | 319 | JacquesStrydom |
75,297,212 | 3,593,246 | Find all tags containing a string in BeautifulSoup | <p>In BeautifulSoup, I can use <code>find_all(string='example')</code> to find all NavigableStrings that match against a string or regex.</p>
<p>Is there a way to do this using <code>get_text()</code> instead of <code>string</code>, so that the search matches a string even if it spans across multiple nodes? i.e. I'd wa... | <python><html><parsing><web-scraping><beautifulsoup> | 2023-01-31 12:33:29 | 2 | 362 | jayp |
75,297,205 | 20,185,574 | Compute Bernoulli numbers with Python recursive program | <p>I'm trying to solve a problem about Bernoulli numbers using Python. The aim is to output the numerator and the denominator of the $n$-th Bernoulli number. I use the conventions and the generic formula given in <a href="https://projectlovelace.net/problems/ada-lovelaces-note-g/" rel="nofollow noreferrer">this source<... | <python><recursion><math><fractions><python-fractions> | 2023-01-31 12:33:03 | 1 | 461 | Barbara Gendron |
75,297,138 | 12,297,666 | Why predict works without fit the model in Keras | <p>Check the following code:</p>
<pre><code>import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Conv1D, MaxPooling1D, Flatten
from sklearn.model_selection import train_test_split
# Data
X = np.random.rand(1000, 100, 1)
y = np.random.randint(0, 2, (1000, 1))
# Splitting into tr... | <python><keras> | 2023-01-31 12:28:00 | 1 | 679 | Murilo |
75,297,062 | 821,780 | pytest requests to fastapi in a separate process | <p>I am trying to have working tests for an API written with FastAPI.</p>
<p>I start the service in a separate process, run the tests with requests to the service, and check if the results are as expected.</p>
<p>I have extracted the key parts into a minimal working example, in the PD.</p>
<p>Running the MWE with the m... | <python><multiprocessing><pytest><fastapi> | 2023-01-31 12:21:59 | 1 | 1,498 | Trylks |
75,296,710 | 3,099,733 | Is it possible to limit YAML bool value literal in python? | <p>I am using YAML to describe some configuration that will be read by a Python tool using <code>ruamel</code>. The problem is I need to use string literal ON a lot and in YAML ON without quote will be treated as bool value <code>true</code>. I have to quote those 'ON' carefully or else the tool will throw unexpected r... | <python><yaml><pyyaml><ruamel.yaml> | 2023-01-31 11:50:06 | 1 | 1,959 | link89 |
75,296,495 | 13,490,682 | Sum the values of a column with Python | <p>I'm new to python, I would like to read a column of values from a csv file and add them together, but only those to the left of the ","
My csv File:</p>
<pre><code>Name Code
Angel 19;90
Eduardo 20;21
Miguel 30;45
</code></pre>
<p>I would like to be able to sum only the numbers to the left of... | <python><pandas><dataframe> | 2023-01-31 11:32:33 | 4 | 393 | Jacket |
75,296,469 | 13,184,183 | Is there a way to get version of production model in mlflow? | <p>I use <code>mlflow 1.23.1</code> and when trying to load model via <code>models:/model_name/Production</code> I receive error described <a href="https://github.com/mlflow/mlflow/issues/5171#issuecomment-1027234578" rel="nofollow noreferrer">here</a> with <code>405</code> code <code>Method not allowed</code>. Setting... | <python><mlflow> | 2023-01-31 11:30:09 | 1 | 956 | Nourless |
75,296,422 | 11,964,058 | Adding new key value to dictionary in a for loop | <p>I have a hugging face dataset in format</p>
<pre><code> test = [{'doc':document1, 'id':id1},{'doc':document2, 'id':id2}.......]
</code></pre>
<p>I'm trying to generate summaries for the dataset and append them to the doc.
The code below takes one dict from test and computes lex rank summary. This is stored in summar... | <python><dictionary><for-loop> | 2023-01-31 11:25:26 | 1 | 493 | Praveen Bushipaka |
75,296,322 | 17,176,270 | How can I retrieve relative document in MongoDB? | <p>I'm using Flask with Jinja2 template engine and MongoDB via pymongo. This are my documents from two collections (phone and factory):</p>
<pre><code>phone = db.get_collection("phone")
{
"_id": ObjectId("63d8d39206c9f93e68d27206"),
"brand": "Apple",
"... | <python><mongodb><pymongo> | 2023-01-31 11:16:56 | 1 | 780 | Vitalii Mytenko |
75,296,240 | 5,654,564 | Define timeout when tox is installing requirements | <p>I have a gitlab ci pipeline which basically do some stuff on the enviornment ( install python and other packages) then it simply run <code>tox</code> in order to run some tests.</p>
<pre><code>stages:
- check
before_script:
# here you can run any commands before the pipelines start
- apt-get -qq update ... | <python><gitlab><tox> | 2023-01-31 11:10:03 | 2 | 2,507 | Marco Fumagalli |
75,295,957 | 15,034,606 | why does Fuzzywuzzy python script take forever to generate results? | <p>To give an idea, I have an excel file(.xlsx format) within which I am working with 2 sheets at a time.</p>
<p>I am interested in 'entity name' from sheet a and 'name' from sheet b.</p>
<p>Sheet b has 'name' column written 7times.</p>
<p>my sheet a looks like this.</p>
<pre><code>Isin Entity Name
DE0005545503 1... | <python><excel><pandas><dataframe><fuzzywuzzy> | 2023-01-31 10:44:23 | 0 | 521 | technophile_3 |
75,295,935 | 5,343,362 | Improve text reading from image | <p>I am trying to read movie credits from a movie.
To make a MVP I started with a picture:<a href="https://i.sstatic.net/eR2ls.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eR2ls.jpg" alt="enter image description here" /></a></p>
<p>I use this code:</p>
<pre><code>print(pytesseract.image_to_string(cv2.... | <python><ocr><tesseract> | 2023-01-31 10:41:58 | 1 | 301 | Quentin M |
75,295,899 | 5,868,293 | How to add indicator column that lists all values of another column in pandas | <p>I have the following pandas dataframe:</p>
<pre><code>import pandas as pd
pd.DataFrame({'id': [1,1,1,1,2,2,2], 'col': ['a','b','c','c','a','b','d']})
id col
0 1 a
1 1 b
2 1 c
3 1 c
4 2 a
5 2 b
6 2 d
</code></pre>
<p>I would like to add a new column, which would contain the list of uniqu... | <python><pandas> | 2023-01-31 10:39:15 | 2 | 4,512 | quant |
75,295,856 | 9,038,295 | Pre-commit install-hooks does not work (SSLError) | <p>I use conda Python environments. Whenever I try to run <code>pre-commit install-hooks</code>, I get the error</p>
<pre><code> Could not fetch URL https://pypi.org/simple/ruamel-yaml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded w
ith url: /... | <python><ssl><pre-commit-hook><pre-commit><pre-commit.com> | 2023-01-31 10:35:14 | 2 | 501 | karu |
75,295,827 | 1,870,969 | Find tuples in a list of tuples, with consecutive values and turn them into bigger tuples | <p>I have a list of tuples, each having two elements. Example:</p>
<pre><code>my_tuples = [('black', 'grey'), ('red', 'orange'), ('blue', 'purple'),
('orange', 'yellow'), ('grey', 'white'), ('yellow', 'cream')]
</code></pre>
<p>I am looking for an efficient way to find all the tuples whose first values ar... | <python><list><sorting><tuples> | 2023-01-31 10:33:14 | 2 | 997 | Vahid S. Bokharaie |
75,295,687 | 7,318,120 | How can I Export Pandas DataFrame to Google Sheets (specific cell) using Python? | <ul>
<li>I can read data and write data to a google sheet.</li>
<li>I can also write a pandas dataframe to a google sheet <code>cell(1,1)</code>.</li>
</ul>
<p>I am now trying to write the same dataframe to a specific cell (like <code>cell(20,20)</code>) on a sheet.</p>
<p>resources:</p>
<ul>
<li><p>this link is close,... | <python><pandas><dataframe><google-sheets><google-sheets-api> | 2023-01-31 10:21:29 | 1 | 6,075 | darren |
75,295,639 | 19,580,067 | Split the text between the start and end words from a long String using Regex Python | <p>Extracted a threaded email body using pywin32 and I need to extract the signature part alone from the body.
I tried to split the text using the signature start as starting word and the next email From as the Ending word.
For ex: 'With Regards' will be the starting word and 'Von' will be the ending word.</p>
<p>Body ... | <python><regex><regex-lookarounds> | 2023-01-31 10:17:54 | 1 | 359 | Pravin |
75,295,398 | 9,962,007 | How to find which python package(s) require(s) certain dependency? | <p>Ideally using a one-liner, without the need for a dedicated script (e.g. looping and grepping over <code>pipdeptree -p</code> output with many packages). Ideally using standard tools (unless the extra package required is actively maintained).</p>
<p>Importantly, the package (said dependency) is not installed, so its... | <python><pip><dependencies><conda> | 2023-01-31 09:57:29 | 0 | 7,211 | mirekphd |
75,295,311 | 7,132,596 | Pandas qcut with infinite values | <p>I would like to have bins with infinite values on the left and right. This worked in older pandas versions (at least 1.1.5) but not in 1.5.</p>
<pre><code>pd.qcut([1,2,3,4,5,-np.inf, np.inf], q=3, duplicates="drop")
</code></pre>
<p>results in <code>ValueError: missing values must be missing in the same lo... | <python><pandas><numpy> | 2023-01-31 09:49:24 | 0 | 956 | Hans Bambel |
75,295,294 | 6,256,859 | Django - Can not join 2 models | <p><strong>Problem:</strong> Joining 2 models in Django.</p>
<p><strong>Error</strong>: Error during template rendering. Direct assignment to the reverse side of a many-to-many set is prohibited. Use entity_id.set() instead.</p>
<p>I have read through all the threads on SO. Tried all the suggested solutions, read the D... | <python><django><django-models><django-rest-framework><django-views> | 2023-01-31 09:47:33 | 1 | 1,080 | Andy |
75,295,132 | 13,983,136 | How to place specific constraints on the parameters of a Pydantic model? | <p>How can I place specific constraints on the parameters of a Pydantic model? In particular, I would like:</p>
<ul>
<li><code>start_date</code> must be at least <code>"2019-01-01"</code></li>
<li><code>end_date</code> must be greater than <code>start_date</code></li>
<li><code>code</code> must be one and onl... | <python><fastapi><pydantic> | 2023-01-31 09:35:26 | 2 | 787 | LJG |
75,295,115 | 7,657,180 | Remove corrupt exif warnings with tiff images | <p>I am trying to fix the corrupt exif warnings from tiff images and here's a code I am using</p>
<pre><code>from PIL import Image
def remove_exif(image_name):
image = Image.open(image_name)
if not image.getexif():
return
print('removing EXIF from', image_name, '...')
data = list(image.getdata(... | <python><python-imaging-library> | 2023-01-31 09:33:47 | 0 | 9,608 | YasserKhalil |
75,295,032 | 9,758,017 | Set steps on y-axis with matplotlib | <p>Currently I have the problem that I do not get the steps on the <strong>y-axis</strong> (score) changed. My representation currently looks like this:</p>
<p><a href="https://i.sstatic.net/c4yNt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c4yNt.png" alt="enter image description here" /></a></p>
<p>... | <python><matplotlib> | 2023-01-31 09:26:49 | 2 | 1,778 | 41 72 6c |
75,294,999 | 10,413,428 | Path from list of path parts with pathlib | <p>I want to generate a path based on a list inside the configuration toml. I have chosen a list to be able to support different operating systems.</p>
<p>For example the following list is stored inside my configuration.toml:</p>
<pre class="lang-ini prettyprint-override"><code>temporary_storage_folder = ["~"... | <python><python-3.x><pathlib><toml> | 2023-01-31 09:23:38 | 1 | 405 | sebwr |
75,294,852 | 11,710,304 | String manipulation in polars | <p>I have a record in polars which has no header so far. This header should refer to the first row of the record. Before I instantiate this row as header, I want to manipulate the entries.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
# Creating a dictionary with the data
data = {
"Co... | <python><string><dataframe><python-polars> | 2023-01-31 09:11:32 | 2 | 437 | Horseman |
75,294,739 | 10,488,923 | Rocket UniData/UniVerse: ODBC Unable to allocate sufficient memory | <p>Whenever I tried using <code>pyodbc</code> to connect to a Rocket UniData/UniVerse data I kept running into the error:</p>
<pre><code>pyodbc.Error: ('00000', '[00000] [Rocket U2][U2ODBC][0302810]Unable to allocate sufficient memory! (0) (SQLDriverConnect); [00000] [Rocket U2][U2ODBC][0400182]Connection not open. (0)... | <python><odbc><pyodbc><universe><unidata> | 2023-01-31 09:01:16 | 1 | 989 | Kagiso Marvin Molekwa |
75,294,735 | 10,829,044 | Sort column names using wildcard using pandas | <p>I have a big dataframe with more than 100 columns. I am sharing a miniature version of my real dataframe below</p>
<pre><code>ID rev_Q1 rev_Q5 rev_Q4 rev_Q3 rev_Q2 tx_Q3 tx_Q5 tx_Q2 tx_Q1 tx_Q4
1 1 1 1 1 1 1 1 1 1 1
2 1 1 ... | <python><pandas><string><list><dataframe> | 2023-01-31 09:01:08 | 3 | 7,793 | The Great |
75,294,711 | 9,879,869 | What would be the best way to return the result of asynchronous task to Django views? | <p>I am building a Djano app that processes image in a Celery task. A post inside the view method handles the input and triggers the task. Inside the task, I create a model instance based on the processed image. In the same view, I wanted to return a response of the de-serialization of the model instance. What is the b... | <python><django><asynchronous><django-rest-framework><celery> | 2023-01-31 08:58:37 | 0 | 1,572 | Nikko |
75,294,710 | 7,657,180 | Count pages on tiff raises TypeError: int() argument must be a string | <p>I am working on some images with tiff extension and I have a step that I should count the pages of each tiff image
Here's my try till now</p>
<pre><code>from pathlib import Path
from PIL import Image
import os
def count_pages(img):
i = 0 ... | <python><python-imaging-library> | 2023-01-31 08:58:35 | 1 | 9,608 | YasserKhalil |
75,294,667 | 5,641,924 | Flatten a column with nested dictionary in pandas | <p>I fetch data from MySQL database. The fetched data has a column with nested lists and dictionaries. This json is similar to the stored data in my database:</p>
<pre><code>my_dict = {'id': [1, 2, 3],
'b': [{'100': [{'p': 10, 'max': 20, 'min': 15},
{'p': 20, 'max': 30, 'min': 20}]
... | <python><pandas> | 2023-01-31 08:53:30 | 2 | 642 | Mohammadreza Riahi |
75,294,639 | 12,769,783 | Onnxruntime: inference with CUDNN on GPU only working if pytorch imported first | <p>I am trying to perform inference with the onnxruntime-gpu. Therefore, I installed CUDA, CUDNN and onnxruntime-gpu on my system, and checked that my GPU was compatible (versions listed below).</p>
<p>When I attempt to start an inference session, I receive the following warning:</p>
<pre class="lang-bash prettyprint-o... | <python><pytorch><onnxruntime> | 2023-01-31 08:50:24 | 0 | 1,596 | mutableVoid |
75,294,630 | 7,800,760 | Python: best way to check for list of URLs | <p>I have a file defining a list of RSS feeds:</p>
<pre><code>RSS_FEEDS = [
"https://www.fanpage.it/feed/",
"https://www.ilfattoquotidiano.it/feed/",
"https://forbes.it/feed/",
"https://formiche.net/feed/",
]
</code></pre>
<p>I wrote the following test:</p>
<pre><... | <python><unit-testing><rss> | 2023-01-31 08:49:24 | 2 | 1,231 | Robert Alexander |
75,294,337 | 5,159,404 | how to align matplotlib graphs | <p>I am plotting two different graphs with matplotlib. The two plots are separate and must be kept that way since I am saving them onto file and have different uses for them.</p>
<p>As it can be seen on the picture below they are misaligned because the ylabels on the top graph are occupying more space than the one on t... | <python><matplotlib> | 2023-01-31 08:20:38 | 0 | 1,002 | Wing |
75,294,118 | 10,731,820 | How to pass parameters from one Pass state to another? | <p>How to pass parameters from one Pass state to another?
<code>aws_stepfunctions.JsonPath.string_at</code> is working fine when invoking lambda function (insude <code>aws_stepfunctions.TaskInput.from_object</code>) but it is not working with Pass state (inside <code>aws_stepfunctions.Result.from_object</code></p>
<p>I... | <python><amazon-web-services><aws-cdk> | 2023-01-31 07:54:51 | 2 | 853 | psowa001 |
75,293,876 | 3,247,006 | How to reduce more `SELECT` queries which are already reduced by "prefetch_related()" to iterate 3 or more models? | <p>I have <code>Country</code>, <code>State</code> and <code>City</code> models which are chained by foreign keys as shown below:</p>
<pre class="lang-py prettyprint-override"><code>class Country(models.Model):
name = models.CharField(max_length=20)
class State(models.Model):
country = models.ForeignKey(Countr... | <python><django><postgresql><django-models><django-prefetch-related> | 2023-01-31 07:28:40 | 1 | 42,516 | Super Kai - Kazuya Ito |
75,293,854 | 6,494,707 | How to convert the radius from meter to pixel? | <p>I have a camera with these specs:</p>
<ul>
<li>full resolution 1280x1024</li>
<li>pixel size 0.0048mm</li>
<li>focal length 8 mm</li>
</ul>
<p>I need to detect a ball in this image. It is 4 meters away and its radius is 0.0373 meter.</p>
<p>How to convert the radius to from meter to pixel in this case?</p>
<p>the re... | <python><opencv><image-processing><geometry><camera-calibration> | 2023-01-31 07:26:25 | 1 | 2,236 | S.EB |
75,293,732 | 8,034,918 | How to resolve ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor | <p>I am trying to get the embedding for a siamese network written in keras and I keep having the issue below. Does anyone know how to solve this issue?</p>
<p>Here is the network:</p>
<pre><code>input = layers.Input((40, 1))
x = layers.Conv1D(8, 64, activation="relu", padding='same', kernel_regularizer=regula... | <python><tensorflow><keras> | 2023-01-31 07:12:03 | 1 | 439 | user8034918 |
75,293,644 | 2,989,330 | GUnicorn: Queue not working after re-starting worker | <h2>Problem Statement</h2>
<p>After booting the GUnicorn worker processes, I want the worker processes still be able to receive data from another process. Currently, I'm trying to use <code>multiprocessing.Queue</code> to achieve this. Specifically, I start a data management process before forking the workers and use t... | <python><multiprocessing><queue><python-multiprocessing><gunicorn> | 2023-01-31 07:01:35 | 1 | 3,203 | Green 绿色 |
75,293,413 | 1,173,495 | importlib.metadata error on pre-commit tool | <p>I have installed pre-commit 3.0.1 via asdf. When I try to run pre-commit -v throwing the following error</p>
<pre><code>Traceback (most recent call last):
File "/Users/san/.cache/pre-commit-zipapp/6Bkef3U7os33XPapd4VZ7HEfyUexbeBTjOn51afz0r8/python", line 47, in <module>
raise SystemExit(main())... | <python><pre-commit><pre-commit.com><asdf> | 2023-01-31 06:32:04 | 4 | 10,189 | SANN3 |
75,293,337 | 1,670,830 | How to print the value of a variable in the stack trace | <p>I want to print in the stack trace the value of a variable.</p>
<p>Indeed, when executing my program, I have an error and I would like to know the value of a variable.</p>
<p>I don't have access to the console.</p>
<hr />
<p>code:</p>
<pre><code>os.chdir(directoryName)
</code></pre>
<p>Error:</p>
<blockquote>
<p>os.... | <python> | 2023-01-31 06:21:13 | 2 | 3,563 | Colas |
75,293,289 | 14,808,637 | Adjacency matrix using numpy | <p>I need to generate the following adjacency matrices:</p>
<p><strong>No of Nodes = 3</strong></p>
<pre><code> A B C AB AC BC
A 0 1 1 0 0 1
B 1 0 1 0 1 0
C 1 1 0 1 0 0
AB 0 0 1 0 0 0
AC 0 1 0 0 0 0
BC 1 0 0 0 0 0
</code></pre>
<p>To genera... | <python><numpy><adjacency-matrix> | 2023-01-31 06:13:28 | 1 | 774 | Ahmad |
75,293,254 | 6,660,638 | How to remove space in cluster in python diagrams | <p>I am generating cluster with the below code</p>
<pre class="lang-py prettyprint-override"><code>from diagrams import Diagram, Cluster, Node
with Diagram('./output/output', show=False, outformat='svg') as d:
with Cluster('cluster'):
n1 = Node('A', height = '0.5', width = '5', labelloc = "c&q... | <python><graphviz><diagram> | 2023-01-31 06:07:07 | 1 | 9,097 | Epsi95 |
75,293,239 | 2,218,321 | Python3 error No module named 'attrs' when running Scrapy in Ubuntu terminal | <p>I am new to Python. I installed Scrapy on ubuntu linux. When I run <code>Scrapy shell</code> I get this error</p>
<pre><code> File "/home/user/.local/lib/python3.10/site-packages/scrapy/downloadermiddlewares/retry.py", line 25, in <module>
from twisted.web.client import ResponseFailed
File "/ho... | <python><python-3.x><scrapy> | 2023-01-31 06:05:14 | 3 | 2,189 | M a m a D |
75,293,146 | 2,543,424 | Unable to import definitions from submodule package | <p>I have a project that uses a git submodule to import a python package from a private repository, which is then installed via pip. The structure is something like this:</p>
<pre><code>my_project
_submodules
prvt_pkg
prvt_pkg
lib
__init__.py
types.py
__init__.py
... | <python><python-3.x> | 2023-01-31 05:50:54 | 1 | 1,301 | e-e |
75,293,106 | 4,897,973 | Shared code library between Docker containers | <p>I've seen a related question from 2017 <a href="https://stackoverflow.com/questions/46135315/cp-vs-rsync-vs-something-faster">here</a> and the linked GitHub discussion from 2014 <a href="https://github.com/moby/moby/issues/1676" rel="nofollow noreferrer">here</a>, but this behavior really doesn't make sense to me an... | <python><docker><web-services><dockerfile> | 2023-01-31 05:44:31 | 1 | 1,228 | beeselmane |
75,293,068 | 10,829,044 | pandas split string and extract upto n index position | <p>I have my input data like as below stored in a dataframe column</p>
<pre><code>active_days_revenue
active_days_rate
total_revenue
gap_days_rate
</code></pre>
<p>I would like to do the below</p>
<p>a) split the string using <code>_</code> delimiter</p>
<p>b) extract <code>n</code> elements from the delimiter</p>
<p>S... | <python><pandas><string><list><dataframe> | 2023-01-31 05:38:50 | 1 | 7,793 | The Great |
75,293,047 | 11,235,205 | Pytorch: Is there a way to implement layer-wise learning rate decay when using a Scheduler? | <p>I want to implement the layer-wise learning rate decay while still using a Scheduler. Specifically, what I currently have is:</p>
<pre class="lang-py prettyprint-override"><code>model = Model()
optim = optim.Adam(lr=0.1)
scheduler = optim.lr_scheduler.OneCycleLR(optim, max_lr=0.1)
</code></pre>
<p>Then, the learnin... | <python><pytorch> | 2023-01-31 05:35:04 | 1 | 2,779 | Long Luu |
75,292,769 | 3,099,733 | cloudpickle: unexpectly import my local module when it is not necessary | <p>In file ai2_kit/domain.py</p>
<pre class="lang-py prettyprint-override"><code>def fun(ctx):
def in_add(a, b):
print (a+b)
ctx.executor.run_python_fn(in_add)(1, 2) # this pass
ctx.executor.run_python_fn(out_add)(1, 2) # this failed, the error is: ModuleNotFoundError: No module named 'ai2_kit'
... | <python><pickle><cloudpickle> | 2023-01-31 04:40:01 | 1 | 1,959 | link89 |
75,292,737 | 7,415,134 | why these 2 sorting is opposite in order | <p>I am implementing bubble sort in Python and used range for indexing the array:</p>
<pre><code>"""
program to implement bubble sort
"""
a = [9,1,5,3,7,4,2,6,8]
for i in range(len(a)):
for j in range(i+1, len(a)):
if a[i] > a[j]:
a[i], a[j] = a[j], a[i]
print(a)... | <python><sorting><range><bubble-sort><enumerate> | 2023-01-31 04:31:26 | 2 | 379 | Sid |
75,292,736 | 4,893,753 | Adding packages to memgraph transformation | <p>I am writing a memgraph transformation in python.</p>
<p>When I import modules such as "requests" or "networkx", the transformation works as expected.</p>
<p>I have avro data w/ schema registry, so I need to deserialize it. I followed the memgraph example here: <a href="https://memgraph.com/docs/... | <python><avro><confluent-schema-registry><memgraphdb> | 2023-01-31 04:31:22 | 1 | 911 | Avocado |
75,292,657 | 787,463 | Is there a data serialisation language (or program/editor) without repeating property names? | <p>So I'm working on a program (one for my own amusement, as often is the case). Still nowhere near as good as I'd like to be <strong><em>snip long story</em></strong> anyways I'm trying for my first time to use an external configuration file rather than have variables littered throughout the source (Python, so not har... | <python><json><serialization><yaml> | 2023-01-31 04:16:36 | 1 | 325 | Slashee the Cow |
75,292,494 | 15,379,556 | How to write and call wrapper without decorator in python | <p>I'd like to write wrapper function for various functions.</p>
<p>How can I write the wrapper function and call it?</p>
<ul>
<li>Without decorator</li>
</ul>
<p>This is my expectation but doesn't work.</p>
<pre><code>import external_library # example
def wrapper(func):
return func()
def test1(a,b):
print(a,... | <python> | 2023-01-31 03:43:54 | 2 | 327 | HG K |
75,292,431 | 4,688,190 | Python function with excessive number of variables | <p>Very general question: I am attempting to write a fairly complext Python script.</p>
<pre><code>#Part A: 100 lines of python code
#Part B: 500 lines of python code
#Part C: 100 lines of python code
</code></pre>
<p>Assume that I want "Part B" taken out of the picture for readability and debugging purposes,... | <python> | 2023-01-31 03:27:35 | 1 | 678 | Ned Hulton |
75,292,400 | 1,572,146 | SQLalchemy with column names starting and ending with underscores | <p>Set <code>RDBMS_URI</code> env var to a connection string like <code>postgresql://username:password@host/database</code>, then on Python 3.9 with PostgreSQL 15 and SQLalchemy 1.14 run:</p>
<pre><code>from os import environ
from sqlalchemy import Boolean, Column, Identity, Integer
from sqlalchemy import create_engin... | <python><sqlalchemy> | 2023-01-31 03:21:20 | 1 | 1,930 | Samuel Marks |
75,292,326 | 1,070,833 | how to add custom format to QMovie in python | <p>I have a simple widget that uses QMovie to display animated gif on a QLabel. This works really well. I would like to implement my own format and add it to supported formats in QMovie (all in python). Is it possible?</p>
<p>QMovies <code>supportedFormats()</code> returns two supported formats:</p>
<p><code>[PySide2.Q... | <python><qt><pyqt><pyside> | 2023-01-31 03:06:17 | 0 | 1,109 | pawel |
75,292,270 | 5,805,389 | Poetry cannot handle sources which redirect after setting cert | <p>I have a pypi server, TLS server cert signed by self signed CA.</p>
<p>I added it as a source (default, secondary = false) to my <code>toml</code> file using</p>
<p><code>poetry source add mypypiserver https://server.url/</code></p>
<p>I added the CA cert using</p>
<p><code>poetry config certificates.mypypiserver.ce... | <python><ssl><python-poetry><http-status-code-303><pypiserver> | 2023-01-31 02:53:54 | 0 | 805 | Shuri2060 |
75,292,083 | 1,326,945 | reportlab.pdfgen generating corrupted PDF | <p>I have a Django Python 3.6.5 view that's intended to write and export a report to PDF using reportlab.pdfgen. I can get the PDF file to generate when the view is called, but the .pdf file that's generated is corrupted. I'm following reportlab's documentation as best as I can tell, is there an issue with how I'm crea... | <python><python-3.x><pdf-generation><reportlab> | 2023-01-31 02:15:50 | 0 | 1,585 | Chris B. |
75,291,919 | 5,942,100 | Positive and negative value sum separately in Pandas | <p>Find and sum all negative values
Find and sum all positive values</p>
<p><strong>DATA</strong></p>
<pre><code>ID value
A -1
B -5
AA 1
TT 3
UV 4
QA 50
WQ -40
QC 10
</code></pre>
<p><strong>DESIRED</strong></p>
<pre><code>positive 68
negative -46
</code></pre>
<p><strong>DOING</strong></p>
... | <python><pandas><numpy> | 2023-01-31 01:45:56 | 1 | 4,428 | Lynn |
75,291,891 | 4,573,162 | Python Unit Test to Assert Type Annotation of Object | <p>In Python versions <3.11 where the <code>assert_type</code> (<a href="https://docs.python.org/3/library/typing.html#typing.assert_type" rel="nofollow noreferrer">source</a>) isn't available, how does one assert a type annotation via the <code>unittest</code> <code>TestCase</code> class? Example of the problem:</p... | <python><python-3.x><unit-testing><python-typing> | 2023-01-31 01:40:58 | 2 | 4,628 | alphazwest |
75,291,569 | 14,890,683 | Python Plotly Scatterplot Highlight Group on Click | <p>Is there a way to highlight all points with attribute on click?</p>
<p>I am working within a Streamlit framework, so Dash solutions won't work.</p>
<p>Similar to this post: <a href="https://stackoverflow.com/questions/52532428/highlight-all-values-from-a-group-on-hover?noredirect=1&lq=1">Highlight all values fro... | <python><plotly><visualization><scatter-plot><streamlit> | 2023-01-31 00:25:21 | 0 | 345 | Oliver |
75,291,413 | 11,333,172 | Checking topological equivalence in shapely | <h1>Problem</h1>
<p>I am using shapely 2.0.0. I have a bunch of polygons in shapely as <code>shapely.Polygon</code> and I would like to check if any of the polygons is a rectangle. This can be done by checking if a polygon's minimum rotated rectangle is <strong>topologically equivalent</strong> to itself. I have tried... | <python><shapely> | 2023-01-30 23:56:24 | 0 | 620 | adrianop01 |
75,291,327 | 11,370,582 | Upload multiple Excel workbooks and concatanate - dcc.Upload, Plotly Dash | <p>I'm developing a interactive dashboard using Plotly Dash, which takes an Excel workbook as an input, formats the data into a pandas dataframe and displays as a bar graph.</p>
<p>It works well with a single workbook but when I add a variable to allow for multiple works to be loaded and concatenated into one long data... | <python><pandas><flask><plotly><plotly-dash> | 2023-01-30 23:37:35 | 1 | 904 | John Conor |
75,291,306 | 6,202,327 | Using sfepy to solve a simple 2D differential euqation | <p>I am trying to learn sfepy. To that effect I want to solve the differential equation</p>
<p><a href="https://i.sstatic.net/DQNfN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DQNfN.png" alt="enter image description here" /></a></p>
<p>On a triangle domain (2D).</p>
<p>There';s 2 things I don't under... | <python><math><numerical-methods><differential-equations><finite-element-analysis> | 2023-01-30 23:34:57 | 1 | 9,951 | Makogan |
75,291,295 | 4,047,084 | Dynamodb GSI containing boolean | <p>I have a dynamodb table of events that have specified start and end times. These events can be happening in realtime, in which case, the end timestamp is not yet written.</p>
<p>I have setup a global secondary index with the sort key being the binary field, <code>active</code>. When I try and update a record to set ... | <python><amazon-dynamodb><database-administration> | 2023-01-30 23:32:11 | 2 | 1,864 | Stuart Buckingham |
75,291,090 | 2,057,516 | Why don't I get a full traceback from a saved exception - and how do I get and save the full trace? | <p>I have a user submitted data validation interface for a scientific site in django, and I want the user to be able to submit files of scientific data that will aid them in resolving simple problems with their data before they're allowed to make a formal submission (to reduce workload on the curators who actually load... | <python><django> | 2023-01-30 23:05:19 | 1 | 1,225 | hepcat72 |
75,291,059 | 688,208 | What is the reason for list.__str__ using __repr__ of its elements? | <p>What is the reason for <code>list.__str__</code> using <code>__repr__</code> of its elements?</p>
<p>Example:</p>
<pre class="lang-python prettyprint-override"><code>class Unit:
def __str__(self): return "unit"
def __repr__(self): return f"<unit id={id(self)}>"
>>> str(Un... | <python><python-3.x> | 2023-01-30 23:00:00 | 2 | 493 | Number47 |
75,291,026 | 5,860,483 | Django rest framework unsupported media type with image upload | <p>this is my first time trying to upload image to django rest framework, i am using svelte for my front end and using the fetch api for requests.</p>
<p>i am have an error that i cannot solve. all requests containing images return an unsupported media type error.</p>
<p><strong>Back End</strong></p>
<p>i have added th... | <python><django><django-rest-framework><fetch><svelte> | 2023-01-30 22:55:11 | 1 | 330 | Omar Alhussani |
75,291,018 | 19,321,677 | How to create %lift from pandas dataframe comparing several variants to control group? | <p>my df looks like this:</p>
<pre><code>segment group purchase_amount
A control 2601
A variant1 2608
A variant2 2586
B control 2441
B variant1 2712
B variant2 2710
</code></pre>
<p>I would like a table wh... | <python><pandas> | 2023-01-30 22:54:34 | 2 | 365 | titutubs |
75,290,914 | 18,476,381 | Convert sql join data into list of dictionaries on certain same key | <p>From a sql stored proc that performs a join on two tables I get the data below.</p>
<pre class="lang-py prettyprint-override"><code>[
{"service_order_number": "ABC", "vendor_id": 0, "recipient_id": 0, "item_id": 0, "part_number": "string", &qu... | <python><sql><list><dictionary> | 2023-01-30 22:41:00 | 2 | 609 | Masterstack8080 |
75,290,880 | 1,130,785 | How do I aggregate array elements column-wise in pyspark? | <div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>col1</th>
<th>col2</th>
</tr>
</thead>
<tbody>
<tr>
<td>[1,2,3,4]</td>
<td>[0,1,0,3]</td>
</tr>
<tr>
<td>[5,6,7,8]</td>
<td>[0,3,4,8]</td>
</tr>
</tbody>
</table>
</div>
<p><code>desired result:</code></p>
<div class="s-table-container">
<table cl... | <python><arrays><apache-spark><pyspark><snowflake-cloud-data-platform> | 2023-01-30 22:35:52 | 2 | 2,027 | whisperstream |
75,290,789 | 6,524,326 | Efficient pythonic way to compute the difference between the max and min elements of each tuple in a large list of tuples | <p>Using the following code, I am trying to calculate the difference between the max and min elements of each tuple in a large list of tuples and store the results in a list. However, the code runs for long time and then OS kills it because it consumes huge amount of RAM. The large list is generated by choosing <code>n... | <python><algorithm> | 2023-01-30 22:22:59 | 3 | 828 | Wasim Aftab |
75,290,788 | 1,867,985 | numpy in a virtual environment: DLL load failure on attempted parallelization | <p>I'm doing some scientific computation in python, and recently switched away from Anaconda since it doesn't yet support python 3.10 (which has some new features I'd like to use). I am now running on python version <code>3.10.9</code>. I have a pipenv virtual environment set up for this, and in it I've got numpy ver... | <python><numpy><dll><virtualenv><pipenv> | 2023-01-30 22:22:56 | 0 | 325 | realityChemist |
75,290,706 | 21,046,803 | How to copy Stackoverflow example Dataframe into a pandas Dataframe for reproduction | <p>Is there an systematic approach do import copied dataframes from Stackoverflow Questions into your programm?
I often see Dataframes similar like the example below. But i usually have to put in some <code>":"</code> or some other formatting to turn it into a proper pandas Dataframe via <code>pd.read_cvs</co... | <python><pandas><dataframe><csv> | 2023-01-30 22:12:04 | 1 | 1,539 | tetris programming |
75,290,680 | 14,293,020 | How to gather arrays of different sizes in the same array with Numpy? | <p><strong>Context:</strong> I have 3 arrays. <code>A</code> that is <em>3x3</em>, <code>B</code> that is <em>5x2</em>, and <code>C</code> that is a <em>3D</em> array.</p>
<p><strong>Question:</strong> Is there a way to stack arrays of different sizes along the 1st dimension of a 3D array, with Numpy ?</p>
<p><strong>E... | <python><arrays><numpy> | 2023-01-30 22:08:42 | 1 | 721 | Nihilum |
75,290,517 | 18,476,381 | pymsql (1054, "Unknown column 'None' in 'call statement'") | <p>I am trying to call stored procedure with pymsql but it looks like I am getting an error when one of the param is passed in as None. My stored proc is able to handle cases of Null but ofcourse not None. I was under the impression that pymysql automatically converts None to Null. Below is the code I am using.</p>
<pr... | <python><sql><pymysql> | 2023-01-30 21:48:30 | 1 | 609 | Masterstack8080 |
75,290,501 | 9,663,207 | Is it possible to use SQLAlchemy where the models are defined in different files? | <p>I'm using SQLAlchemy for the first time and trying to define my models / schema. My only experience with ORM prior to this was with Rails and <a href="https://guides.rubyonrails.org/active_record_basics.html" rel="nofollow noreferrer">ActiveRecord</a>.</p>
<p>Anyway, following SQLAlchemy's ORM Quick Start, this is t... | <python><database><sqlalchemy><orm> | 2023-01-30 21:46:34 | 3 | 724 | g_t_m |
75,290,351 | 6,843,153 | Get Slack channel ID with python slack sdk | <p>I'm writing a Slack bot that requires updating already posted messages, so I implemented this code using Slack python SDK:</p>
<pre><code>def update_message(self, message_text, ts):
response = self.client.chat_update(channel=self.channel, ts=ts, text=message_text)
return response
</code></pre>
<p>The problem... | <python><slack><slack-api> | 2023-01-30 21:28:02 | 3 | 5,505 | HuLu ViCa |
75,290,271 | 7,056,539 | pyproject.toml listing an editable package as a dependency for an editable package | <p>Using setuptools, is it possible to list another editable package as a dependency for an editable package?</p>
<p>I'm trying to develop a collection of packages in order to use them across different production services, one of these packages (<code>my_pkg_1</code>) depends on a subset of my package collection (<code... | <python><pip><setuptools><pyproject.toml> | 2023-01-30 21:19:05 | 2 | 419 | Nasa |
75,290,101 | 3,357,935 | Could Match.start(0) ever return -1 in Python? | <p>I recently came across a code block using Python's <a href="https://docs.python.org/3.11/library/re.html#" rel="nofollow noreferrer"><code>re</code> library</a> that had a confusing sanity check.</p>
<pre><code>import re
def someFunctionName(pattern, string):
for match in re.finditer(pattern, string):
m... | <python><regex><python-re> | 2023-01-30 21:01:30 | 0 | 27,724 | Stevoisiak |
75,289,851 | 2,594,812 | Why does calling future.exception() in a done callback change the traceback | <p>I noticed that error messages in <a href="https://github.com/hadron/carthage" rel="nofollow noreferrer">Carthage</a> were sometimes getting truncated. That code is quite complex, so I worked on reproducing things in simpler form and found:</p>
<ul>
<li>If I attach a done callback to a coroutine that calls the <code... | <python><python-asyncio> | 2023-01-30 20:35:14 | 0 | 6,539 | Sam Hartman |
75,290,757 | 24,894 | Why is running 2 processes on 2 cores slower than on a single core? | <p>I would expect some overhead from context switching when running two processes on the same CPU core. What I didn't expect is so much overhead when running two processes on two separate CPU cores.</p>
<p>Here is my Python program to do some counting:</p>
<pre class="lang-python prettyprint-override"><code>import time... | <php><python><cpu-usage> | 2023-01-30 20:18:25 | 1 | 32,751 | kovshenin |
75,289,619 | 1,825,360 | problem.getSolutions() of constraint library yielding no solutions | <p>I'm trying to solve a small constraint problem using the "constraint" library in Python.
The code is as follows but the solutions is empty. I was expecting a solution for Km * wt_Km (1 *42). Can somebody help in solving this?
Thanks</p>
<pre><code>from constraint import *
wt_Nd = 1
wt_Qd = 1
wt_Km = 42
wt... | <python><constraint-programming> | 2023-01-30 20:10:30 | 1 | 469 | The August |
75,289,579 | 7,177,478 | Leetcode 393: UTF-8 Validation (Python) | <p>problem:</p>
<blockquote>
<p>Given an integer array data representing the data, return whether it
is a valid UTF-8 encoding (i.e. it translates to a sequence of valid
UTF-8 encoded characters).</p>
<p>A character in UTF8 can be from 1 to 4 bytes long, subjected to the
following rules:</p>
<p>For a 1-byte character, ... | <python><list><bit> | 2023-01-30 20:05:24 | 0 | 420 | Ian |
75,289,517 | 353,337 | Python string plus extra data, mutability | <p>I'm looking for a Python class that behaves exactly like <code>str</code> execpt that</p>
<ul>
<li>it should be mutable, i.e., its content modifyable in-place, and</li>
<li>it should carry some extra data.</li>
</ul>
<p>This</p>
<pre class="lang-py prettyprint-override"><code>class MyString(str):
def __init__(se... | <python><string> | 2023-01-30 19:59:52 | 2 | 59,565 | Nico Schlömer |
75,289,350 | 4,826,074 | Keep only outer edges of object in an image | <p>I have a number of grayscale images as the left one below. I only want to keep the outer edges of the object in the image using python, preferably OpenCV. I have tried OpenCV erosion and then get the right image below. However, as seen in the image there is still brighter areas inside of the object. I want to remove... | <python><opencv> | 2023-01-30 19:41:48 | 2 | 380 | Johan hvn |
75,289,188 | 8,119,069 | Trying to make a scrollable table with tkinter | <p>I'm trying to make a scrollable <strong>grid</strong> table. I had a look at some answers and it seems the way is to make a <strong>Frame</strong>, then put a <strong>Canvas</strong> and a <strong>Scrollbar</strong> next to eachother and apply some commands for scrolling. I have this code here, but I can't figure ou... | <python><python-3.x><tkinter><tkinter-canvas> | 2023-01-30 19:25:03 | 1 | 501 | DoctorEvil |
75,289,181 | 15,341,457 | Join rows and concatenate attribute values in a csv file with pandas | <p>I have a csv file structured like this:</p>
<p><a href="https://i.sstatic.net/qhA56.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qhA56.png" alt="enter image description here" /></a></p>
<p>As you can see, many lines are repeated (they represent the same entity) with the attribute 'category' being t... | <python><pandas><csv><join><row> | 2023-01-30 19:24:09 | 2 | 332 | Rodolfo |
75,289,130 | 4,718,335 | Flatten nested Pydantic model | <pre class="lang-py prettyprint-override"><code>from typing import Union
from pydantic import BaseModel, Field
class Category(BaseModel):
name: str = Field(alias="name")
class OrderItems(BaseModel):
name: str = Field(alias="name")
category: Category = Field(alias="category"... | <python><fastapi><pydantic> | 2023-01-30 19:18:16 | 5 | 1,864 | Russell |
75,289,020 | 5,278,205 | Remove duplicate numbers separated by a symbol in a string using Hive's REGEXP_REPLACE | <p>I have a spark dataframe with a string column that includes numbers separated by <code>;</code>, for example: <code>862;1595;17;862;49;862;19;100;17;49</code>, I would like to remove the duplicated numbers, leaving the following: <code>862;1595;17;49;19;100</code></p>
<p>As far as patterns go I have tried</p>
<ol>
<... | <python><regex><pyspark><hive><sparklyr> | 2023-01-30 19:07:09 | 1 | 5,213 | Cyrus Mohammadian |
75,288,973 | 6,387,095 | Pandas - compare day and month only against a datetime? | <p>I want to compare a <code>timestamp</code> datatype <code>datetime64[ns]</code> with a <code>datetime.date</code> I only want a comparison based on <code>day and month</code></p>
<p>df</p>
<pre><code> timestamp last_price
0 2023-01-22 14:15:06.033314 100.0
1 2023-01-25 14:15:06.213591 101.0... | <python><pandas><datetime> | 2023-01-30 19:02:22 | 2 | 4,075 | Sid |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.