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,237,862 | 17,630,139 | Snowflake-connector-python fails to install. Returns "ModuleNotFoundError: No module named 'cmake'" | <p>I'm trying to install <code>snowflake-connector-python</code> using pip, but it's giving me this error stack trace:</p>
<pre class="lang-py prettyprint-override"><code> copying pyarrow/tests/parquet/test_metadata.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
copyi... | <python><snowflake-cloud-data-platform> | 2023-01-25 17:47:00 | 1 | 331 | Khalil |
75,237,818 | 8,479,344 | DRF: Dynamic literal type hint for models.TextChoices | <p>Given this model</p>
<pre class="lang-py prettyprint-override"><code>from django.db import models
class Olympian(models.Model):
MedalType = models.TextChoices('MedalType', 'GOLD SILVER BRONZE')
medal = models.CharField(max_length=6, choices=MedalType.choices, default=MedalType.GOLD)
</code></pre>
<p>and thi... | <python><django><django-rest-framework><enums> | 2023-01-25 17:41:56 | 0 | 711 | Fullchee Zhang |
75,237,748 | 8,247,997 | In a scatterplot, how do I plot a line that is an average of the all vertical coordinates of datapoints that has the same x coordinate | <p>I want something like the plots shown in figure below, where the blue line is the average line that is generated by plotting the mean of all y-coordinate values of data-points that have the same x-coordinate values.</p>
<p><a href="https://i.sstatic.net/9JsDe.png" rel="nofollow noreferrer"><img src="https://i.sstat... | <python><matplotlib><seaborn><data-science> | 2023-01-25 17:34:26 | 1 | 346 | Somanna |
75,237,664 | 17,945,841 | Deleting observations from a data frame, according to a bernoulli random variable that is 0 or 1 | <p>I have a data frame with 1000 rows. I want to delete 500 observations from a specific column <code>Y</code>, in a way thet the bigger the values of <code>Y</code>, the probability it will be deleted is bigger.
One way to do that is to sort this column in an ascending way. For <code>i = 1,...,1000</code>, toss a bern... | <python><numpy><statistics> | 2023-01-25 17:24:24 | 1 | 1,352 | Programming Noob |
75,237,628 | 1,816,135 | tokenizer.save_pretrained TypeError: Object of type property is not JSON serializable | <p>I am trying to save the GPT2 tokenizer as follows:</p>
<pre><code>from transformers import GPT2Tokenizer, GPT2LMHeadModel
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
tokenizer.pad_token = GPT2Tokenizer.eos_token
dataset_file = "x.csv"
df = pd.read_csv(dataset_file, sep=",")
input_... | <python><huggingface-transformers><gpt-2> | 2023-01-25 17:21:03 | 1 | 1,002 | AKMalkadi |
75,237,532 | 386,861 | I don't why parsing error in parsing list within list in python | <p>Created a list that looks like this. Two lists within bigger list.</p>
<pre><code>topics = [gender_subset = [3, 4],
age_subset = [5, 6, 7, 8, 9, 10, 11]]
for t in topics:
print(t)
</code></pre>
<p>But get this error:</p>
<pre><code>Cell In[49], line 1
topics = [gender_subset = [3, 4],
... | <python> | 2023-01-25 17:13:03 | 3 | 7,882 | elksie5000 |
75,237,528 | 9,640,238 | Group by first occurrence of each value in a pandas dataframe | <p>I have a pandas dataframe that looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>user</th>
<th>action</th>
<th>timestamp</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Jim</td>
<td>start</td>
<td>12/10/2022</td>
</tr>
<tr>
<td>2</td>
<td>Jim</td>
<td>start</td... | <python><pandas><dataframe> | 2023-01-25 17:12:37 | 1 | 2,690 | mrgou |
75,237,390 | 12,934,163 | Decision Tree Based Survival Analysis with time-varying covariates in Python | <p>I'd like to predict the remaining survival time with time-varying covariates using Python. I already used <a href="https://lifelines.readthedocs.io/en/latest/Time%20varying%20survival%20regression.html" rel="nofollow noreferrer">lifelines' CoxTimeVaryingFitter</a> and would like to compare it to a decision tree base... | <python><random-forest><survival-analysis><lifelines><scikit-survival> | 2023-01-25 17:01:19 | 0 | 885 | TiTo |
75,237,274 | 5,199,660 | Pandas String Series, return string if length equals number, otherwise return empty string | <p>I have a Pandas string series as the following:</p>
<pre><code>s = pd.Series(["12345678.0","45678912.0", "0", "2983129416.0", "62441626.0"])
</code></pre>
<p>I first of all must cut the decimal part, and then...</p>
<pre><code>result = s.str.split(".", 1, e... | <python><pandas><string><conditional-statements><series> | 2023-01-25 16:49:57 | 3 | 656 | Eve |
75,237,246 | 5,789,997 | Filter list-valued columns | <p>I have this kind of dataset:</p>
<pre><code>id value cond1 cond2
a 1 ['a','b'] [1,2]
b 1 ['a'] [1]
a 2 ['b'] [2]
a 3 ['a','b'] [1,2]
b 3 ['a','b'] [1,2]
</code></pre>
<p>I would like to extract all the rows using the conditions, something like</p>
<pre><co... | <python><pandas> | 2023-01-25 16:47:57 | 1 | 1,063 | Ilja |
75,237,101 | 2,635,863 | empirical distribution from data - python | <p><a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wasserstein_distance.html" rel="nofollow noreferrer">wasserstein_distance function</a> requires that the input data are "<strong>Values observed in the (empirical) distribution</strong>".</p>
<p>My data arrays range between -4 and 8:... | <python><scipy> | 2023-01-25 16:37:28 | 0 | 10,765 | HappyPy |
75,236,978 | 2,276,188 | How do you add the degree to every vertex in a list in Gremlin using python? | <p>I'm trying to add the degree (number of vertexes connected to the given vertexes) to each one of the vertexes in a list.</p>
<p>Generating the degree for each vertex works-</p>
<pre class="lang-py prettyprint-override"><code>c.g.V(ids).as_('vertex'). \
both(). \
groupCount(). \
by(select('vertex')).toList()
</... | <python><graph><gremlin><amazon-neptune> | 2023-01-25 16:27:56 | 1 | 365 | Guy |
75,236,869 | 8,056,248 | Get partitioned indices of sorted 2D list | <p>I have "2D" list and I want to make partitions/groups of the list indices based on the first value of the nested list, and then return the sorted index of the partitions/groups based on the second value in the nested list. For example</p>
<pre><code>test = [[1, 2], [1, 1], [1, 5], [2, 3], [2, 1], [1, 10]]
... | <python> | 2023-01-25 16:20:31 | 2 | 1,283 | Andrew Holmgren |
75,236,857 | 7,500,995 | Django REST framework - parse uploaded csv file | <p>I have setup Django REST framework endpoint that allows me to upload a csv file.</p>
<p>The serializers.py looks like this:</p>
<pre><code>from rest_framework import serializers
class UploadSerializer(serializers.Serializer):
file_uploaded = serializers.FileField()
class Meta:
fields = ['file_upload... | <python><django><django-rest-framework> | 2023-01-25 16:19:53 | 2 | 771 | Marin Leontenko |
75,236,850 | 2,618,377 | Version mismatch between scipy and poetry | <p>I'm using the poetry dependency manager for some of my development (RTL-SDR application). However, when I try to add scipy to the environment (calling <code>poetry add scipy</code> inside Windows 11 Powershell), I get the following output:</p>
<pre><code> Using version ^1.10.0 for scipy
Updating dependencies
Re... | <python><scipy><python-poetry> | 2023-01-25 16:19:00 | 2 | 421 | Pat B. |
75,236,722 | 5,091,720 | Flask How to make a tree in jinja2 html? | <p>I have in python a dictionary that represents a tree style parent child relationship. I want to display the dictionary on the webpage. FYI: The dictionary will end up being all names and will very base on the person entering info.</p>
<p>Example dictionary from Python:</p>
<pre><code>dict_ = {'A':['B', 'C'], 'B':['D... | <python><jinja2> | 2023-01-25 16:08:52 | 1 | 2,363 | Shane S |
75,236,716 | 6,837,658 | Anyway to get rid of `math.floor` for positive odd integers with `sympy.simplify`? | <p>I'm trying to simplify some expressions of positive odd integers with sympy. But sympy refuses to expand <code>floor</code>, making the simplification hard to proceed.</p>
<p>To be specific, <code>x</code> is a positive odd integer (actually in my particular use case, the constraint is even stricter. But sympy can o... | <python><sympy><symbolic-math> | 2023-01-25 16:08:38 | 2 | 621 | Scott Chang |
75,236,681 | 19,283,541 | Python AST - finding particular named function calls | <p>I'm trying to analyse some Python code to identify where specific functions are being called and which arguments are being passed.</p>
<p>For instance, suppose I have an ML script that contains a <code>model.fit(X_train,y_train)</code>. I want to find this line in the script, identify what object is being fit (i.e.,... | <python><abstract-syntax-tree> | 2023-01-25 16:07:05 | 1 | 309 | radishapollo |
75,236,604 | 15,376,262 | Check if column name of a pandas df starts with "name" and split that column based on existing white space | <p>Let's say I have a pandas dataframe that looks like this:</p>
<pre><code>df = pd.read_json('{"id":{"0":"21 Delta","1":"38 Bravo","2":"Charlie 37","3":"Alpha 56"},"name_1":{"0":"Tom","1":&... | <python><pandas> | 2023-01-25 15:59:47 | 2 | 479 | sampeterson |
75,236,567 | 7,839,535 | What is the reliable way to select current directory's python with pyenv + pipenv or pip | <p>I have two problems:</p>
<p>pipenv ignores pyenv settings;</p>
<p>my pip shortcuts are ignoring pyenv settings too:</p>
<pre class="lang-bash prettyprint-override"><code>iuri@tartaruga:~$ pyenv version
3.9.16 (set by /home/iuri/.pyenv/version)
iuri@tartaruga:~$ pyenv local 3.10
iuri@tartaruga:~$ pyenv version
3.10.9... | <python><pip><virtualenv><pipenv><pyenv> | 2023-01-25 15:57:30 | 0 | 471 | Iuri Guilherme |
75,236,563 | 5,152,497 | Pandas DataFrame plot, colors are not unique | <p>According to <strong>Pandas</strong> <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.html" rel="nofollow noreferrer">manual</a>, the parameter <em><strong>Colormap</strong></em> can be used to select colors from matplotlib colormap object. However for each bar, in the case of a bar diagra... | <python><pandas><plot><unique> | 2023-01-25 15:57:21 | 1 | 3,487 | JΓΌrgen K. |
75,236,516 | 7,531,433 | How can I type hint arbitrary generic type aliases in Python? | <p>I've implemented a Python function, which takes a generic type alias, from which it extracts the origin and arguments for further processing.</p>
<p>Now I want to use a static type checker (MyPy) and want to provide a type hint for the <code>alias</code> argument.
One idea would be to use the <a href="https://docs.p... | <python><generics><python-typing><mypy> | 2023-01-25 15:54:09 | 0 | 709 | tierriminator |
75,236,509 | 6,367,971 | Extract MMDDYYY date from dataframe rows | <p>I have a dataframe where some rows of data contain a long string with a date in <code>MMDDYYY</code> format in the middle.</p>
<pre><code>ID
-
blah
unc.abc.155gdgeh0t4ngs8_XYZ_01252023_US_C_Home_en-us_RS_Nat'l-vs-UNC
blah
unc.abc.52gst4363463463_RST_01272023_US_C_Away_en-us_RS_Nat'l-vs-UNC
unc.abc.534gs23ujgf9d8f_U... | <python><pandas><extract> | 2023-01-25 15:53:34 | 2 | 978 | user53526356 |
75,236,478 | 2,587,904 | how to use vectorized H3 functions from h3-py? | <pre><code>import numpy as np
lats = np.random.uniform(0, 90, 1_000_000)
lons = np.random.uniform(0, 90, 1_000_000)
import h3
import h3.api.numpy_int
</code></pre>
<p>Passing numpy arrays straight away:</p>
<pre><code>fails with: TypeError: only size-1 arrays can be converted to Python scalars
h3.api.numpy_int... | <python><h3> | 2023-01-25 15:51:32 | 1 | 17,894 | Georg Heiler |
75,236,229 | 1,977,609 | python version interpretation indiscrepencies | <p>i am following along with the online book "data science from the command line" by ___. i have no experience with python, so am unfamiliar with it's syntax and interpretation intricacies.</p>
<p>while running this code, copied verbatim from the book:</p>
<p>`</p>
<pre><code>import sys
CYCLE_OF_15 = ["... | <python> | 2023-01-25 15:32:43 | 1 | 747 | Andrew |
75,236,134 | 8,573,902 | Training with tensorflow is much slower using GPU rather than CPU on M1 Max | <p>I tried to run the example below (a simplified version of a part of <a href="https://github.com/ageron/handson-ml3/blob/main/15_processing_sequences_using_rnns_and_cnns.ipynb" rel="nofollow noreferrer">this tutorial</a>).
I was extremely surprised to see that for this model at least, the training was more than 50x f... | <python><tensorflow><keras><deep-learning><gpu> | 2023-01-25 15:25:20 | 1 | 513 | Amiel |
75,235,933 | 13,566,716 | flask_jwt_extended.exceptions.NoAuthorizationError: Missing Authorization Header | <p><strong>Server-side flask</strong></p>
<pre><code>@project_ns.route('/projects')
class ProjectsResource(Resource):
@project_ns.marshal_list_with(project_model)
@jwt_required()
def get(self):
"""Get all projects """
user_id = User.query.filter_by(username=get... | <python><reactjs><python-3.x><react-native><flask> | 2023-01-25 15:08:35 | 1 | 369 | 3awny |
75,235,923 | 7,575,552 | File not found error when copying images from one folder to another | <p>I have a text file containing the names of images to be copied from a source folder to a destination folder. The source folder contains several sub-folders as shown below. The images may come from any of these sub-folders.</p>
<pre><code>animals (source folder)
|-cats_1
|-cats_2
|-tigers_1
|-lions_1
|-lions_2
<... | <python><path><copy> | 2023-01-25 15:08:08 | 1 | 1,189 | shiva |
75,235,809 | 1,014,217 | Postcommands not working properly in Github Codespaces | <p>I want to create a codespace for python development with some post commands like:
creating a conda environment
activate it
installing ipkyernel and creating a kernel
install requirements.txt</p>
<p>However when I rebuild the container I dont have any error, and when I open the codespace terminal and type conda env ... | <python><github><conda><codespaces><github-codespaces> | 2023-01-25 14:58:23 | 0 | 34,314 | Luis Valencia |
75,235,686 | 14,667,788 | How to find a center of an object in image in python | <p>I have a following image:</p>
<p><a href="https://i.sstatic.net/9yTpv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9yTpv.png" alt="enter image description here" /></a></p>
<p>I would like to find the center of the main object in the image - the book in this case.</p>
<p>I follow this answer: <a hre... | <python><opencv> | 2023-01-25 14:50:12 | 0 | 1,265 | vojtam |
75,235,598 | 17,487,457 | MinmaxScaler: Normalise a 4D array of input | <p>I have a 4D array of input that I would like to normalise using <code>MinMaxScaler</code>. For simplicity, I give an example with the following array:</p>
<pre class="lang-py prettyprint-override"><code>A = np.array([
[[[0, 1, 2, 3],
[3, 0, 1, 2],
[2, 3, 0, 1],
[... | <python><numpy><multidimensional-array><scikit-learn><normalize> | 2023-01-25 14:42:37 | 3 | 305 | Amina Umar |
75,235,561 | 4,659,729 | Speed up python split process | <p>I have a very big 4+ GB size of textfile and I have a script which splits the file into small files based on what characters are before the first coma. eg.: 16,.... line goes to 16.csv, 61,.... line goes to 61.csv. Unfortunately this script runs for ages, I guess because of the write out method. Is there any way to ... | <python><csv><split> | 2023-01-25 14:39:53 | 4 | 352 | Tamas Kosa |
75,235,548 | 871,947 | How to continously wait on any of multiple concurrent tasks to complete? | <p>Let's say there are multiple sources of events I want to monitor and respond to in an orderly fashion - for instance multiple connected sockets.</p>
<p>What's the best way to continuously await until any of them has data available to be read?</p>
<p><code>asyncio.wait</code> seems promising, but I am unsure about ho... | <python><asynchronous><python-asyncio> | 2023-01-25 14:39:06 | 1 | 1,306 | JanLikar |
75,235,531 | 18,948,596 | Problem when installing Python from source, SSL package missing even though openssl installed | <h1>The Problem</h1>
<p>Trying to install Python-3.11.1 from source on Zorin OS (Ubuntu16 based) I get the following errors when I try to pip install any package into a newly created venv:</p>
<pre><code>python3.11 -m venv venv
source venv/bin/active
pip install numpy
WARNING: pip is configured with locations that requ... | <python><ssl><installation><pip><ubuntu-16.04> | 2023-01-25 14:37:41 | 2 | 413 | Racid |
75,235,467 | 2,587,904 | How to parallelize a pandas UDF in polars (h3 polyfill) for string typed UDF outputs? | <p>I want to execute the following lines of python code in Polars as a UDF:</p>
<pre><code>w = wkt.loads('POLYGON((-160.043334960938 70.6363054807905, -160.037841796875 70.6363054807905, -160.037841796875 70.6344840663086, -160.043334960938 70.6344840663086, -160.043334960938 70.6363054807905))')
polygon (optionally in... | <python><pandas><geopandas><python-polars><h3> | 2023-01-25 14:31:02 | 2 | 17,894 | Georg Heiler |
75,235,457 | 11,251,373 | Modify method call if chained | <p>Better to provide an example i guess (a littler bit pseudo-codish...)</p>
<pre class="lang-py prettyprint-override"><code>from django.db import transaction
from somewhere import some_job
from functools import partial
class Foo:
def do_something(self, key, value):
return some_job(key, value)
@property
... | <python> | 2023-01-25 14:30:05 | 3 | 2,235 | Aleksei Khatkevich |
75,235,435 | 8,800,836 | Simulation of Markov chain slower than in Matlab | <p>I run the same test code in Python+Numpy and in Matlab and see that the Matlab code is faster by an order of magnitude. I want to know what is the bottleneck of the Python code and how to speed it up.</p>
<p>I run the following test code using Python+Numpy (the last part is the performance sensitive one):</p>
<pre c... | <python><numpy><performance><matlab> | 2023-01-25 14:28:41 | 1 | 539 | Ben |
75,235,422 | 11,269,090 | XGBoost XGBRegressor predict with different dimensions than fit | <p>I am using <a href="https://xgboost.XGBRegressor" rel="nofollow noreferrer">the xgboost XGBRegressor</a> to train on a data of 20 input dimensions:</p>
<pre><code> model = xgb.XGBRegressor(objective='reg:squarederror', n_estimators=20)
model.fit(trainX, trainy, verbose=False)
</code></pre>
<p><code>trainX</co... | <python><machine-learning><time-series><regression><xgboost> | 2023-01-25 14:27:31 | 2 | 1,010 | Chen |
75,235,367 | 5,159,404 | How can I plot a line with a confidence interval in python using plotly? | <p>I am trying to use plotly to plot a graph similar to the one here below:</p>
<p><a href="https://i.sstatic.net/JWRib.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JWRib.png" alt="enter image description here" /></a></p>
<p>Unfortunately I am only able to plot something like this
<a href="https://i.s... | <python><plotly> | 2023-01-25 14:21:46 | 1 | 1,002 | Wing |
75,235,331 | 13,579,159 | Referencing objects depends on relative and absolute import of a package | <p>I have just faced with with behaviour I don't yet understand and don't know how to name it. I'll reproduce it here.</p>
<p>Let's say we have a project with the structure as lined below.</p>
<pre class="lang-bash prettyprint-override"><code>src
β __init__.py
β main.py
β
ββββutils
β __init__.py
β data.... | <python><package><python-import><relative-import><python-3.11> | 2023-01-25 14:19:07 | 0 | 341 | Gennadiy |
75,235,221 | 911,576 | Unable to Sign Solana Transaction using solana-py throws not enough signers | <p>using solana library from pip</p>
<pre><code>pip install solana
</code></pre>
<p>and then trying to perform <code>withdraw_from_vote_account</code></p>
<pre><code>txn = txlib.Transaction(fee_payer=wallet_keypair.pubkey())
# txn.recent_blockhash = blockhash
txn.add(
vp.withdraw_from_vote_account(
... | <python><solana><anchor-solana> | 2023-01-25 14:10:09 | 2 | 7,498 | anish |
75,235,095 | 3,399,638 | Pandas conditional join and calculation | <p>I have two Pandas dataframes, df_stock_prices and df_sentiment_mean.</p>
<p>I would like to do the following:</p>
<ol>
<li><p>Left join/merge these two dataframes into one dataframe, joined by Date and by ticker. In df_stock_prices, ticker is the column name, for example AAPL.OQ and in df_sentiment_mean ticker is f... | <python><pandas><dataframe><data-munging> | 2023-01-25 14:00:13 | 1 | 323 | billv1179 |
75,234,820 | 2,404,988 | Dynamically add extra versions constraints to pip managed dependencies | <p>Is there a way to provide additional constraints on transitive dependencies to pip ?</p>
<p>For example, if you were to pip install scikit-optimize v0.8.1, <a href="https://github.com/scikit-optimize/scikit-optimize/blob/v0.8.1/setup.py#L47" rel="nofollow noreferrer">its setup.py</a> would say it depends on scikit-l... | <python><pip> | 2023-01-25 13:38:34 | 0 | 8,056 | C4stor |
75,234,789 | 6,734,243 | pip install -e is not resolved by python3 | <p>everything was fine until December 2022 when packages installed in editable mode are not resolved anymore.</p>
<p><strong>reproducible example:</strong></p>
<p>from my terminal I run:</p>
<pre><code>git clone git@github.com:pydata/numexpr.git
pip install -e --user numexpr
</code></pre>
<p>In my local folder, I find ... | <python><pip> | 2023-01-25 13:36:00 | 1 | 2,670 | Pierrick Rambaud |
75,234,649 | 12,734,492 | Python pandas: left join by key and value in list of values: | <p>Code:</p>
<pre><code>df1 = pd.DataFrame({'key': ['A', 'B', 'C', 'D'],
'value': [1, 2, 3, 4]})
df2 = pd.DataFrame({'key': ['B', 'D', 'D', 'F'],
'list_values': [[2, 4, 6], [4, 8], [1, 3, 5], [7, 9]]})
</code></pre>
<p>I need to make a left join by :</p>
<ol>
<li><code>df1['key']... | <python><pandas><dataframe> | 2023-01-25 13:24:14 | 2 | 487 | Galat |
75,234,556 | 1,192,393 | When using importlib to load a module, can I put it in a package without an __init__.py file? | <p>My Python application loads plugins from a user-specified path (which is not part of <code>sys.path</code>), according to <a href="https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly" rel="nofollow noreferrer">the importlib documentation</a>:</p>
<pre><code>import importlib.util
import ... | <python><python-3.x><dynamic><python-import> | 2023-01-25 13:18:03 | 0 | 411 | Martin |
75,234,294 | 4,796,629 | Is it possible for a class to provide convenient direct access to the methods of specific objects initialised within it? | <p>This may be highly abnormal, but I feel like it may be a useful thing. I have a range of classes that do different jobs in my package. I want to keep them seperate to keep the logic modular, and allow advanced users to use the classess directly, but I also want users to have a main convenience class that gives them ... | <python><class> | 2023-01-25 12:55:36 | 2 | 581 | James Allen-Robertson |
75,234,291 | 4,562,115 | how to get modulus difference of values of two json objects in python | <p>I have two JSON arrays , I need to get the modulus difference of the JSON object keys. My array list can have 1000s of elements. How to calculate it efficiently? Is there a way to do it parallelly without using loop?</p>
<p>For example</p>
<pre><code>js1 = [{'myVal':100},{'myVal':200}]
js2 = [{'myVal':500},{'myVal':... | <python><arrays><json><key><modulo> | 2023-01-25 12:55:17 | 1 | 802 | Varuni N R |
75,234,258 | 4,499,574 | Unable to call OpenAI API from within a docker container | <p>I am trying to call the OpenAI API from within my docker container but the request is timing out. The same curl works on my machine but not from within my container</p>
<p>I tried running this curl. It worked on the host machine but not in the container.</p>
<pre><code> curl https://api.openai.com/v1/models \
-H ... | <python><docker><docker-compose><openai-api> | 2023-01-25 12:52:53 | 0 | 1,105 | Shahrukh Mohammad |
75,234,243 | 1,107,474 | Python convert string to datetime but formatting is not very predictable | <p>I'm extract the execution time of a Linux process using Subprocess and <code>ps</code>. I'd like to put it in a datetime object, to perform datetime arithmetic. However, I'm a little concerned about the output <code>ps</code> returns for the execution time:</p>
<pre><code>1-01:12:23 // 1 day, 1 hour, 12 minutes, ... | <python><python-3.x><datetime><timedelta> | 2023-01-25 12:51:15 | 1 | 17,534 | intrigued_66 |
75,234,217 | 13,596,837 | Gibberish / malformed negative y-axis values in plotly charts in python | <p>Im trying to plot a bar plot in plotly that is representing net-gains (will have positive and negative bar values). But somewhat the negative values in the y-axis are being represented in gibberish. I tried several things, including using <code>update_layout</code> function, but nothing seems to work. Im using the <... | <python><python-3.x><pandas><matplotlib><plotly> | 2023-01-25 12:48:42 | 3 | 399 | marksman123 |
75,234,161 | 5,986,907 | Python Docker SDK "Error while fetching server API version" | <p>In the Python Docker SDK, When I do</p>
<pre><code>import docker
docker.from_env()
</code></pre>
<p>I see</p>
<pre class="lang-none prettyprint-override"><code>docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
</code></... | <python><docker><python-poetry> | 2023-01-25 12:43:25 | 2 | 8,082 | joel |
75,234,152 | 13,184,183 | How to load model from mlflow with custom predict without local file? | <p>I want to log model with custom predict. Example of signature</p>
<pre class="lang-py prettyprint-override"><code>from sklearn.ensemble import RandomForestRegressor
class CustomForest(RandomForestRegressor):
def predict(self, X, second_arg=False):
pred = super().predict(X)
value = 1 if second_arg... | <python><mlflow> | 2023-01-25 12:42:43 | 1 | 956 | Nourless |
75,234,099 | 11,622,712 | Iterate over rows and calculate values | <p>I have the following pandas dataframe:</p>
<pre><code>temp stage issue_datetime
20 1 2022/11/30 19:20
21 1 2022/11/30 19:21
20 1 None
25 1 2022/11/30 20:10
30 2 None
22 2 2022/12/01 10:00
22 2 2022/12/01 10:01
31 3 2022/12/02 11:00
3... | <python><pandas> | 2023-01-25 12:38:44 | 1 | 2,998 | Fluxy |
75,233,951 | 9,182,743 | Plotly: bar plot with color red<0, green>0, divided by groups | <p>Given a dataframe with 2 groups: (group1, group2), that have values > and < than 0:
plot:</p>
<ul>
<li>Bar plot</li>
<li>x = x</li>
<li>y = values, divided by group1, group2</li>
<li>color = red if value<0, green if value>0</li>
<li>legend shows group1, grou2 with different colors.</li>
</ul>
<p>My curre... | <python><pandas><plotly> | 2023-01-25 12:23:48 | 3 | 1,168 | Leo |
75,233,893 | 357,313 | Can itertools.groupby use pd.NA? | <p>I <a href="https://stackoverflow.com/a/59543818/357313">tried using</a> <code>itertools.groupby</code> with a pandas Series. But I got:</p>
<blockquote>
<p>TypeError: boolean value of NA is ambiguous</p>
</blockquote>
<p>Indeed some of my values are <code>NA</code>.</p>
<p>This is a minimal reproducible example:</p>... | <python><pandas><itertools-groupby> | 2023-01-25 12:19:19 | 1 | 8,135 | Michel de Ruiter |
75,233,891 | 1,275,973 | Create a new dictionary with the key-value pair from values in a list of dictionaries based on matches from a separate list | <p>I am trying to get a new dictionary with the k: v pair from values in a list of dictionary based on matches from a separate list.</p>
<p>The casing is different.</p>
<p>My data looks like this:</p>
<pre><code>list_of_dicts = [
{'fieldname': 'Id', 'source': 'microsoft', 'nullable': True, 'type': 'int'},
{'fieldnam... | <python><dictionary><dictionary-comprehension> | 2023-01-25 12:19:11 | 1 | 326 | alexei7 |
75,233,794 | 2,823,719 | How is the multiprocessing.Queue instance serialized when passed as an argument to a multiprocessing.Process? | <p>A related question came up at <a href="https://stackoverflow.com/questions/75193175/why-i-cant-use-multiprocessing-queue-with-processpoolexecutor">Why I can't use multiprocessing.Queue with ProcessPoolExecutor?</a>. I provided a partial answer along with a workaround but admitted that the question raises another que... | <python><multiprocessing><queue> | 2023-01-25 12:11:15 | 2 | 45,536 | Booboo |
75,233,726 | 18,291,356 | Locust AttributeError: object has no attribute | <p>I am using python 3.10 and here is my locust file.</p>
<pre class="lang-py prettyprint-override"><code>from locust import HttpUser, task, between
import string
import random
import time
import datetime
WAIT_TIME_MIN = 1
WAIT_TIME_MAX = 5
h = {
"Content-Type": "application/json"
}
random.se... | <python><locust> | 2023-01-25 12:04:56 | 1 | 432 | Serdar |
75,233,627 | 9,274,940 | Pythonic way of counting max elements by index in a dictionary with list values | <p>I want to compare the lists inside a dictionary (as values) by each index, and save in another dictionary how many times each "key" had the highest value.</p>
<p>Let's put an example, I have this dictionary:</p>
<pre><code>my_dict = {'a': [1, 2, 5], 'b': [2, 1, 4], 'c': [1, 0, 3]}
</code></pre>
<p>I want t... | <python> | 2023-01-25 11:56:29 | 3 | 551 | Tonino Fernandez |
75,233,582 | 15,376,262 | Split pandas dataframe column of type string into multiple columns based on number of ',' characters | <p>Let's say I have a pandas dataframe that looks like this:</p>
<pre><code>import pandas as pd
data = {'name': ['Tom, Jeffrey, Henry', 'Nick, James', 'Chris', 'David, Oscar']}
df = pd.DataFrame(data)
df
name
0 Tom, Jeffrey, Henry
1 Nick, James
2 Chris
3 David, Oscar
</code></pre>
<p>I know I can split the ... | <python><pandas><split> | 2023-01-25 11:52:23 | 1 | 479 | sampeterson |
75,233,393 | 3,905,832 | Is it possible with `click` library to limit choices of a command argument, based on the value of a previous argument? | <p><strong>The context</strong></p>
<p>I have a CLI tool named <code>mytool</code> written in python 3.9 and using the <code>click</code> library for handling CLI commands, arguments and options. Autocompletion is working.</p>
<p><strong>What I want to achieve</strong></p>
<p>In a directory <code>D</code> I have the fo... | <python><python-click> | 2023-01-25 11:34:53 | 0 | 2,885 | Kraal |
75,233,364 | 12,709,265 | Extract the gesture from GestureRecognizerResult | <p>In the <code>mediapipe</code> library, there is a task called <code>GestureRecognizer</code> which can recognize certain hand gestures. There is also a task called <code>GestureRecognizerResult</code> which consists of the results from the <code>GestureRecognizer</code>. <code>GestureRecognizerResult</code> has an a... | <python><python-3.x><mediapipe> | 2023-01-25 11:32:19 | 1 | 1,428 | Shawn Brar |
75,233,331 | 10,954,152 | Convert dataframe column into set of text files | <p>I have a dataframe which contains <code>topic</code> and <code>keywords</code> column as shown below:</p>
<pre><code>topic keyword
0 ['player', 'team', 'word_finder_unscrambler', ...
1 ['weather', 'forecast', 'sale', 'philadelphia'...
2 ['name', 'state', 'park', 'health', 'dog', 'ce...
3 ['... | <python><pandas><dataframe> | 2023-01-25 11:29:28 | 1 | 967 | think-maths |
75,233,280 | 14,860,526 | Get the main type out of a composite type in Python | <p>let's assume I have types defined as:</p>
<pre><code>data_type1 = list[str]
data_type2 = set[int]
</code></pre>
<p>and so on, how can I get just the main type (like list or set) by analyzing the two data types?</p>
<p>I tried:</p>
<pre><code>issubclass(data_type1, list)
issubclass(data_type2, set)
</code></pre>
<p>b... | <python><python-typing> | 2023-01-25 11:25:01 | 2 | 642 | Alberto B |
75,233,196 | 10,037,034 | How can i see my files on remote Jupyter server? (Vscode) | <p>I want to use vscode on my computer using remote jupyter connection.
I applied the steps for the connection, i can create a new notebook and run on this remote server.
Bu i want to see my folders on remote server. I want to edit them or create a new file in this server.</p>
<p><a href="https://i.sstatic.net/nI8NV.pn... | <python><visual-studio-code><jupyter-notebook><vscode-remote> | 2023-01-25 11:18:38 | 1 | 1,311 | Sevval Kahraman |
75,233,177 | 1,551,817 | Why does this Python function not require an argument when it itself is being used as an argument? | <p>I'm looking at a function that acts as a class factory and takes a function as an argument:</p>
<pre><code>def Example(func):
class Example(object):
def __init__(self, name):
self._name = name
return Example
</code></pre>
<p>There is also another separate function:</p>
<pre><code>de... | <python><function><class> | 2023-01-25 11:17:06 | 3 | 7,561 | user1551817 |
75,233,043 | 1,092,632 | When can "s != s" occur in a method? | <p>I found a code snippet, which is a custom metric for tensorboard (pytorch training)</p>
<pre><code>def specificity(output, target, t=0.5):
tp, tn, fp, fn = tp_tn_fp_fn(output, target, t)
if fp == 0:
return 1
s = tn / (tn + fp)
if s != s:
s = 1
return s
def tp_tn_fp_fn(out... | <python><pytorch> | 2023-01-25 11:03:37 | 1 | 2,713 | PrimuS |
75,233,016 | 7,800,760 | Managing python project CI/CD with Conda, Poetry and pip | <p>I have read through a couple of dozens of writeups on how to equip a modern python project to automate linting, testing, coverage, type checking etc (and eventually deploy it on cloud servers. Not interested in the latter part yet.)</p>
<p>I am thinking about using <strong>conda</strong> as my environment manager. T... | <python><continuous-integration><github-actions><conda><python-poetry> | 2023-01-25 11:01:35 | 0 | 1,231 | Robert Alexander |
75,232,897 | 1,654,930 | Is it possible to get the iteration number of a lambda map? | <p>I have this simple map:</p>
<pre><code>list( map(lambda p: mappingFunction(p,index?), data )
</code></pre>
<p>I'd like, on my mapping function, to be able to access the index, so to have 0,1,2,3,... and track the iteration number.
Is that possible?</p>
| <python> | 2023-01-25 10:51:46 | 2 | 6,752 | Phate |
75,232,776 | 5,928,682 | Test case where assert should check the content of the response body | <p>I am new to writing a test case.</p>
<p>I am trying to check if the response body has certain value.</p>
<p>Response a power shell script I want to check if that script has the modified values or not.</p>
<pre><code>def test_get_script_remotes_auth():
payload = json.dumps("")
headers = ... | <python><amazon-web-services><pytest> | 2023-01-25 10:42:02 | 1 | 677 | Sumanth Shetty |
75,232,761 | 3,344,139 | How do I run poetry install in a subprocess without reference to the current virtualenv? | <p>I am writing some auto setup code in a command line tool that we have.
This command line tool is installed with poetry, so when someone is invoking the command line tool, it is from within a virtual environment setup by poetry.</p>
<p>The command I am trying to invoke is <code>poetry install</code> for <em>another d... | <python><subprocess><virtualenv><python-poetry> | 2023-01-25 10:40:42 | 1 | 4,885 | RunOrVeith |
75,232,570 | 2,046,185 | How to run a python file as a module with the "Run Python File" button in VS Code? | <p>I have Visual Studio Code 1.74.3 with the Microsoft Python extension v2022.20.2.</p>
<p>I am talking about the button to run a python file and specifically not about run/debug configurations or tasks.</p>
<p><a href="https://i.sstatic.net/Vaahz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Vaahz.png... | <python><visual-studio-code> | 2023-01-25 10:26:30 | 2 | 617 | Fabian |
75,232,413 | 13,840,270 | Plotly Scatterplot3d display x-y grid that does not "climb" z-axis | <p><a href="https://i.sstatic.net/tWBGZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tWBGZ.png" alt="Desired plot (Pang 2021)" /></a></p>
<p><a href="https://i.sstatic.net/aKVpv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aKVpv.png" alt="My plot with gridlines on z-axis" /></a></p>
... | <python><plotly><scatter3d> | 2023-01-25 10:11:15 | 0 | 3,215 | DuesserBaest |
75,232,276 | 1,497,720 | `index` in OpenGPT API output | <p>The following is the code</p>
<pre><code>import os
import openai
openai.api_key = "..."
response = openai.Completion.create(
model="text-davinci-003",
prompt="I am happy!",
temperature=0, #creativity
max_tokens=10,
top_p=1,
frequency_penalty=0.0,
presence_penalty=... | <python><openai-api> | 2023-01-25 09:58:30 | 1 | 18,765 | william007 |
75,232,117 | 15,476,955 | get the list of partition keys in a dynamodb with boto3 | <p>Actually, I'm using <code>scan</code> and take the partition key in every item but that's really not efficient, my dynamodb is too big and it takes too much time.</p>
<p>Is there a way to <code>query</code> only the partition key so we have an optimized unexpensive way to get all the partition key of a dynamoDB with... | <python><amazon-dynamodb><boto3> | 2023-01-25 09:46:13 | 1 | 1,168 | Utopion |
75,232,007 | 12,083,557 | IOError when opening/writing file with "a" mode | <p>I have the following Python code:</p>
<pre><code>try:
with open(self.file_name, "a") as log_file:
log_file.write(...))
except IOError:
print("I couldn't open the file")
</code></pre>
<p>The file is opened with <strong>"a"</strong> mode,... | <python><io> | 2023-01-25 09:36:08 | 0 | 337 | Life after Guest |
75,231,984 | 6,266,810 | read_sql in chunks with polars | <p>I am trying to read a large database table with polars. Unfortunately, the data is too large to fit into memory and the code below eventually fails.</p>
<p>Is there a way in polars how to define a chunksize, and also write these chunks to parquet, or use the lazy dataframe interface to keep the memory footprint low?... | <python><dataframe><python-polars> | 2023-01-25 09:34:21 | 3 | 996 | WilliamEllisWebb |
75,231,942 | 9,374,372 | How do I make sure a super method is called on child classes method on Python? | <p>How to make it sure in a parent class method that <code>super</code> is called in its children methods which override the parent method? I found this question in SO for other languages except for Python.</p>
| <python><inheritance><super> | 2023-01-25 09:29:52 | 3 | 505 | Fernando Jesus Garcia Hipola |
75,231,870 | 16,306,516 | sort a list of string numerically in python | <p>I know there are many questions regarding this type of sorting, I tried many time by referring to those questions and also by going through the <code>re</code> topic in python too</p>
<p>My question is:</p>
<pre><code>class Example(models.Model):
_inherit = 'sorting.example'
def unable_to_sort(self):
... | <python> | 2023-01-25 09:23:32 | 4 | 726 | Sidharth Panda |
75,231,843 | 14,125,436 | Removing duplicates from animation's lened of a 3d plot in python | <p>I am exporting an animation in python but the legend is repeating. I have only one plot and want to have one single legend item in every frame of the animation. This is my script:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
x = np.linspace(0., 10., 100)
y = np.l... | <python><matplotlib><matplotlib-animation> | 2023-01-25 09:20:40 | 3 | 1,081 | Link_tester |
75,231,661 | 6,695,762 | GCP Dataflow ReadFromKafka creating a lot of connections | <p>We are creating Dataflow job using Python to read data from Kafka (Amazon MSK, 6 brokers, 5 partitions topic). Dataflow job is deployed in a VPC that has a Cloud NAT (single public IP) and this IP is fully allowed on out on AWS side.</p>
<p>I turned on <code>commit_offset_in_finalize=True</code> and set <code>group.... | <python><google-cloud-platform><apache-kafka><google-cloud-dataflow><apache-beam> | 2023-01-25 09:02:02 | 1 | 629 | fl0r3k |
75,231,549 | 1,436,800 | How to compare list of models with queryset in django? | <p>I have a serializer:</p>
<pre><code>class MySerializer(serializers.ModelSerializer):
class Meta:
model = models.MyClass
fields = "__all__"
def validate(self, data):
user = self.context.get("request").user
users = data.get("users")
users_l... | <python><django><django-rest-framework><django-queryset><django-serializer> | 2023-01-25 08:51:36 | 3 | 315 | Waleed Farrukh |
75,231,386 | 4,720,018 | How to serialize a Mock object? | <p>In my unit-tests there are some (nested) <a href="https://docs.python.org/3/library/unittest.mock.html#the-mock-class" rel="nofollow noreferrer"><code>unittest.mock.Mock</code></a> objects.</p>
<p>At some point, these <code>Mock</code> objects need to be serialized using <a href="https://docs.python.org/3/library/js... | <python><json><serialization><python-unittest.mock> | 2023-01-25 08:34:28 | 0 | 14,749 | djvg |
75,231,185 | 11,067,209 | How to get an isomorphic graph from another in networkx? | <p>Good morning, everyone.</p>
<p>I am currently doing a unit test of a function that processes graphs and it should give similar results in front of isomorphic graphs. So, I would like to output only an isomorphic graph from a networkx graph, but I can't find if that functionality exists. <a href="https://networkx.org... | <python><graph><networkx><isomorphism> | 2023-01-25 08:10:55 | 1 | 665 | Angelo |
75,231,162 | 7,359,831 | Polars: settings not to display ellipsis | <p>Polars chops some text instead of showing all text like the following</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Link</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>https://...</td>
<td>name1</td>
</tr>
<tr>
<td>https://...</td>
<td>name2</td>
</tr>
</tbody>
</table>
</div>
<p>I... | <python><python-3.x><python-polars> | 2023-01-25 08:08:15 | 1 | 1,786 | Pytan |
75,231,091 | 7,122,272 | deepface: Don't print logs from MTCNN backend | <p>I have a very simple code that I use for face detection from an image, for example:</p>
<pre><code>from deepface.commons import functions
import numpy as np
random_image = np.random.randint(
0, 255, size=(360, 360, 3)
)
detected_face = functions.detect_face(
img=random_image,
detector_backend="mtc... | <python><logging><deepface> | 2023-01-25 08:00:34 | 2 | 7,715 | Jaroslav BezdΔk |
75,231,045 | 3,318,528 | Python Flet Async | <p>I'm trying to use Flet libray with an async function to login into telegram.
The functionality at the moment are really basic, it just detects if the user is already logged in or not, and if not opens a login page, with a phone number field and a button:</p>
<pre><code>import flet as ft
from flet import AppBar, Elev... | <python><flet> | 2023-01-25 07:54:55 | 1 | 335 | Val |
75,231,014 | 16,891,669 | Understanding input in iter | <p>I was looking for solutions to take multiline input in python. I found <a href="https://stackoverflow.com/a/11664675/16891669">this</a> answer which uses the following code.</p>
<pre class="lang-py prettyprint-override"><code>sentinel = '' # ends when this string is seen
for line in iter(input, sentinel):
pass #... | <python> | 2023-01-25 07:51:23 | 1 | 597 | Dhruv |
75,230,803 | 11,332,693 | Row wise concatenation and replacing nan with common column values | <p>Below is the input data
df1</p>
<pre><code>A B C D E F G
Messi Forward Argentina 1 Nan 5 6
Ronaldo Defender Portugal Nan 4 Nan 3
Messi Midfield Argentina Nan 5 Nan 6
Ronaldo Forward Portugal 3 Nan 2 3
Mbappe Forward France 1 3 2 5
</code></pre>
<p>Below... | <python><pandas><dataframe><string-concatenation><method-missing> | 2023-01-25 07:27:49 | 2 | 417 | AB14 |
75,230,775 | 5,015,382 | Why is this tkinter function not displaying any pictures | <p>I have code to display 2x5 images and change them when I click on them. However, the code I wrote does not display any images in the tkinter windows. Why?</p>
<p>Some details:</p>
<ul>
<li>the URLs are working fine</li>
</ul>
<pre><code>import tkinter as tk
from PIL import Image, ImageTk
# Create the main window
ro... | <python><tkinter> | 2023-01-25 07:24:16 | 3 | 452 | Jan Janiszewski |
75,230,541 | 8,026,274 | Plotting complex graph in pandas | <p>I have the following dataset</p>
<pre><code>ids count
1 2000210
2 -23123
3 100
4 500
5 102300120
...
1 million 123213
</code></pre>
<p>I want a graph where I have group of <code>ids</code> (all unique ids) in the x axis and <code>... | <python><pandas><dataframe> | 2023-01-25 06:50:26 | 2 | 339 | Mikasa |
75,230,353 | 3,904,031 | How to get control of the size and shape of images using .insert_image() with XlsxWriter in macOS? | <p>I'm trying to write a Python script that builds a workbook of thousands of thumbnails of images from a few hundred folders to a few hundred sheets (one sheet per top-level folder).</p>
<p>The formatting of my sheets depends upon getting the thumbnails to have a controlled size, but I'm getting inconsistent results.<... | <python><python-3.x><macos><image><xlsxwriter> | 2023-01-25 06:25:51 | 1 | 3,835 | uhoh |
75,230,198 | 169,992 | What are the TensorFlow equivalents of these PyTorch functions? | <p>I am looking to port something from PyTorch to Tensorflow, and could use some help in making sure I get the functions mapped correctly from one framework to the other. I have already started, for example both frameworks have the same <code>torch.where</code> and <code>tf.where</code> function, and <code>torchTensor.... | <python><tensorflow><pytorch> | 2023-01-25 06:02:44 | 1 | 80,366 | Lance Pollard |
75,230,112 | 10,748,412 | Detectron2 - undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE | <pre><code>File /home/xyzUser/MyProject/.env/lib/python3.8/site-packages/detectron2/layers/deform_conv.py", line 11, in <module>
from detectron2 import _C
ImportError: /home/xyzUser/MyProject/.env/lib/python3.8/site-packages/detectron2/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7r... | <python><pytorch><huggingface-transformers><detectron> | 2023-01-25 05:48:27 | 0 | 365 | ReaL_HyDRA |
75,230,017 | 5,089,311 | How to convert my dictionary query to properly formatted string without getting garbage? | <p>Assume this is my dictionary:</p>
<pre><code>dc = { 0 : { "name" : "A", "value" : 4}, 1 : {"name" : "B", "value" : 5}, 2: {"name" : "C", "value" : 7}}
</code></pre>
<p>I need to transform all values from keys <code>value</code>... | <python> | 2023-01-25 05:34:23 | 1 | 408 | Noob |
75,229,994 | 1,245,659 | STContains returns points OUTSIDE polygon. Should return points INSIDE polygon | <p>I have this very long jupyter notebook</p>
<pre><code>#!/usr/bin/env python
# coding: utf-8
# In[1]:
#Setting Environment
from ipyleaflet import Map, basemaps, Marker, Polygon
import pyodbc
import json
#Getting ODBC Connection
cnxn = pyodbc.connect('DRIVER={ODBC Driver 18 for SQL Server};SERVER=<<SERVER>... | <python><sql-server><geospatial><spatial> | 2023-01-25 05:30:21 | 0 | 305 | arcee123 |
75,229,988 | 6,751,456 | python django serializer wrong date time format for DateTimeField | <p>I'm using Django <code>3.0.2</code>.</p>
<p>I have a serializer defined:</p>
<pre><code>class ValueNestedSerializer(request_serializer.Serializer):
lower = request_serializer.DateTimeField(required=True, allow_null=False, format=None, input_formats=['%Y-%m-%dT%H:%M:%SZ',])
upper = request_serializer.DateTime... | <python><django><django-serializer><django-validation> | 2023-01-25 05:29:24 | 1 | 4,161 | Azima |
75,229,981 | 6,077,239 | How to use polars cut method returning result to original df | <p><strong>Update:</strong> <code>pl.cut</code> was removed from Polars. Expression equivalents were added instead:</p>
<p><a href="https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.cut.html#polars.Expr.cut" rel="nofollow noreferrer"><code>.cut()</code></a> <a href="https://docs.pola.rs/api/p... | <python><python-polars> | 2023-01-25 05:28:47 | 3 | 1,153 | lebesgue |
75,229,967 | 4,531,757 | Pandas - Build sequnce in the group while resetting by fixed value - Issue in summary table | <p>I am resetting my flow by '000' when the patient sees that value in the pattern.But my summary table is mixing all patterns and giving only one value like shown in the out data frame. However, I like to show the same patient in all patterns individually shown the 'desired' data frame. Please help.</p>
<pre><code>df2... | <python><pandas><numpy> | 2023-01-25 05:24:50 | 1 | 601 | Murali |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.