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,987,396 | 7,991,581 | Debug python coredump with python callstack | <p>I'm currently trying to debug a complex multi-threaded python script on a production environment which sometimes crashes using python3.10.10</p>
<p>I can't reproduce the bug on a development environment and the issue seems to come from low-level C libraries so I need to inspect a coredump in order to understand what... | <python><c><linux><gdb><coredump> | 2023-04-11 15:03:15 | 0 | 924 | Arkaik |
75,987,346 | 17,388,934 | Unable to get coloured column header to excel for multiple pandas dataframes | <p>I want to write multiple dataframes to excel and also add color to column headers.
I have written below code to achieve this however, it colors only the column header for the first dataframe, but not the others.</p>
<pre><code># example data frame
df = pd.DataFrame(np.random.randn(15).reshape(5, 3))
# adding _backg... | <python><excel><pandas><dataframe> | 2023-04-11 14:59:00 | 0 | 319 | be_real |
75,987,248 | 18,253,588 | Black images or memory issue with Hugging Face StableDiffusion pipleline, M1 Pro, PyTorch | <p>So I'm making a project for a school that offers image generation using stable diffusion. It was working perfectly fine until I upgraded the Pytorch version for "stabilityai/stable-diffusion-x4-upscaler" model. Since then all the other images generated are black because they get flagged NSFW.</p>
<p>The co... | <python><pytorch><apple-m1><huggingface-transformers><huggingface> | 2023-04-11 14:49:48 | 1 | 395 | itsDanial |
75,987,105 | 2,228,592 | Django Returning Items outside filter when filtering by time | <p>I have a snippet of code designed to grab the entries that are <24 hours old</p>
<pre class="lang-py prettyprint-override"><code> yesterday = datetime.now() - timedelta(days=1)
items = get_model(name=p).objects.filter(tagid=tag.id, t_stamp__gt=yesterday).order_by('t_stamp')
for... | <python><django> | 2023-04-11 14:35:18 | 1 | 9,345 | cclloyd |
75,987,044 | 5,409,315 | How to best use non-concurrent futures? | <p>In my program</p>
<ol>
<li>Objects are created expensively,</li>
<li>later modified expensively, and</li>
<li>finally, objects are used to generate debugging output in a very distant area of the code</li>
</ol>
<p>My main goal is to only to execute the creation and modification if debugging. To keep the code cleaner... | <python><concurrent.futures> | 2023-04-11 14:27:52 | 0 | 604 | Jann Poppinga |
75,986,929 | 1,978,146 | Mean of classes by groups of rows and columns | <p>I have a Pandas dataframe including a class <code>iv</code> that holds sequences <code>A</code> and <code>B</code> with different features (<code>score1</code> and <code>score2</code>). I would like to obtain a dataframe with the mean of each of the features.</p>
<pre><code>import pandas as pd
df = pd.DataFrame({
... | <python><pandas> | 2023-04-11 14:15:59 | 1 | 383 | Noque |
75,986,870 | 14,015,493 | Docker compose usage of external firebird service | <p>The architecture of the app I planning to create consist of an React, Python and Firebird component. The React part will serve as front-end, the Python part will be the back-end which communicates with the Firebird DB. The React and Firebird component will run in Docker and has to communicate with a Firebird server,... | <python><docker><docker-compose><firebird> | 2023-04-11 14:09:13 | 1 | 313 | kaiserm99 |
75,986,866 | 3,190,076 | How to test for race conditions on Pandas DataFrames? | <p>I would like to use <a href="https://schedule.readthedocs.io/en/stable/" rel="nofollow noreferrer">schedule</a> to run some functions every x seconds. The functions modify a global Dataframe. I know that Pandas is not thread-safe, so I have added a lock to each function call to mitigate that.
The code below (a minim... | <python><pandas><schedule> | 2023-04-11 14:09:00 | 0 | 10,889 | alec_djinn |
75,986,854 | 10,791,217 | Permission Denied while using Shutil | <p>I am moving around files using the following script and am getting Permission Denied on random folders. This is a SharePoint site that is synced with my OneDrive and therefore on my File Explorer. A few of the files are working one step above in the folder structure, but this particular folder is not. I also can man... | <python><python-3.x><shutil> | 2023-04-11 14:07:44 | 0 | 720 | RCarmody |
75,986,836 | 15,673,412 | python - find coincidences within a certain time windows | <p>I'm struggling with the following task in python:</p>
<p>I have 4 lists of differet length with timestamps (float values).</p>
<pre><code>timestamps
[[0.2, 0.6, 1.5, 4.3],
[1.1, 1.4, 3.5, 3.6, 7.9],
[0.1, 0.7, 1.3, 3.7, 12.2, 36.2],
[1.3, 1.9, 3.8, 4.0, 21.7]]
</code></pre>
<p>I want to keep only the timestamps ... | <python><arrays><numpy><numpy-ndarray> | 2023-04-11 14:06:34 | 0 | 480 | Sala |
75,986,798 | 6,372,859 | Memory allocation error concatenating zeroes to arrays | <p>I have a large 2D numpy array with each sub-array of different length, for example:</p>
<pre><code>[[1,2],[3,4,5,6],[7,8,9]]
</code></pre>
<p>I would like to add zeroes at the end of each sub-array smaller than the largest one, something like:</p>
<pre><code>[[1,2,0,0],[3,4,5,6],[7,8,9,0]]
</code></pre>
<p>To this e... | <python><numpy><out-of-memory><numpy-ndarray> | 2023-04-11 14:03:12 | 2 | 583 | Ernesto Lopez Fune |
75,986,754 | 19,553,193 | django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.33). in Django | <p>I have this error when performing migrations to my file command</p>
<p>I tried this command</p>
<pre><code>python manage.py makemigrations
</code></pre>
<p><strong>but Error insist</strong></p>
<pre><code>django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.33).
</code></pre>
<p>Is there anyway... | <python><django> | 2023-04-11 13:58:29 | 7 | 335 | marivic valdehueza |
75,986,745 | 1,689,811 | python lambda as callback | <p>I have been reading example of astersik ARI in python and could not understand the following code clearly
full sample code :</p>
<pre><code>#!/usr/bin/env python
"""Example demonstrating ARI channel origination.
"""
#
# Copyright (c) 2013, Digium, Inc.
#
import requests
import ari
f... | <python><lambda> | 2023-04-11 13:57:18 | 0 | 334 | Amir |
75,986,727 | 532,570 | Getting the value of a ListItem/ListView in Textualize/Textual | <p>I am struggling with something that I can't help but feel is very basic.</p>
<p>I am using the <a href="https://github.com/Textualize/textual" rel="nofollow noreferrer">Textual framework</a>, with python, and am having difficulty getting the Selected value from a ListItem.</p>
<p>In the code below, I have the <code>... | <python><textual> | 2023-04-11 13:55:55 | 1 | 582 | toast |
75,986,339 | 21,420,742 | How to get the ID from one dataframe to match the name from another datframe in Python | <p>I have two dataframes one has the <strong>ID</strong> and <strong>Name</strong> and one just has the <strong>Name</strong>. I want to match the name to the ID and for those without a ID leave as null.</p>
<p>DF1:</p>
<pre><code>ID Name
1 John Doe
2 Mary Sue
3 Josh Smith
4 Sarah Moore... | <python><python-3.x><pandas><dataframe><numpy> | 2023-04-11 13:16:09 | 0 | 473 | Coding_Nubie |
75,986,315 | 13,224,380 | Translate SQL to Polars and Pandas | <p>Can someone help me translate</p>
<pre class="lang-sql prettyprint-override"><code>SELECT (TRUNC(lat/0.5)*0.5) AS ll_lat, (TRUNC(lon/0.5)*0.5) AS ll_lon, COUNT(lat) AS strikes FROM lightning GROUP BY ll_lat, ll_lon;
</code></pre>
<p>into Pandas and Polars code as I tried</p>
<pre class="lang-py prettyprint-override... | <python><sql><pandas> | 2023-04-11 13:13:54 | 1 | 401 | Curious |
75,986,302 | 20,220,485 | What is the most efficient way of checking XML for a set of attributes? | <p>I have a folder <code>m_d</code> of very many identically structured xml files that I want to sort. Two examples are below. If any word element of any xml file contains attributes <code>"N", "E", "D", "P", "L"</code> I want to copy the file to another folder. Only 'x... | <python><xml><lxml> | 2023-04-11 13:12:57 | 2 | 344 | doine |
75,986,167 | 2,082,884 | Runtime Warning when setting an GObject property on Gobject derived instance in python | <p>In my new library I have I like to present stimuli to a user for psychological experiments. Such as presenting circles and other types of visual stimuli or sounds. I like to base my C library on glib and gobject, as that makes it relatively easy to have language bindings, and glib provides many handy algorithms/data... | <python><c><pygobject><gobject> | 2023-04-11 12:57:28 | 0 | 4,441 | hetepeperfan |
75,986,114 | 3,840,183 | ffibuild generate dll with dependencies | <p>I´m using CFFI for generating a DLL from python source code. It works well but it depends of python3x.dll and need some .pyd files.
Is it possible to package all dependencies inside the dll or a static library ?</p>
| <python><dll><dependencies><ffi><cffi> | 2023-04-11 12:50:05 | 0 | 591 | Erwan Douaille |
75,986,062 | 17,596,179 | Cannot import local module python | <p>I am trying to import local modules in python but for some reason it cannot find the modules. I know that you can import them by adding them to your path with sys. But I don't want to use sys for this.
My file structure looks like this</p>
<pre><code>scraper_backend
- jobs
- extract.py
- load.py
... | <python><python-3.x><import><python-import><modulenotfounderror> | 2023-04-11 12:45:58 | 1 | 437 | david backx |
75,985,838 | 2,593,480 | How to get RTL (right-to-left) text working in VS Code integrated terminal? | <p>If I print in the DEBUG CONSOLE it's fine, every where else VS code display Hebrew just fine, just when the script print to the TERMINAL the Hebrew is upside down, why?
<a href="https://i.sstatic.net/REUYT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/REUYT.png" alt="enter image description here" />... | <python><visual-studio-code><right-to-left><hebrew> | 2023-04-11 12:20:00 | 2 | 581 | Yam Shargil |
75,985,680 | 14,653,659 | Deactivate some color categories by default | <p>Hello I am creating an offline html dashboard which consists of multiple plots.
Per default all group option are set to active after the plot is created. I would like to manually set deactivate some of the option. Is there a way to do this?</p>
<p>E.g.
I create a chart with the following code:</p>
<pre><code>fig = p... | <python><plotly> | 2023-04-11 12:01:31 | 0 | 807 | Manuel |
75,985,662 | 3,387,716 | multiprocessing.Pool(processes=0) not allowed? | <p>In a parallelized script I would like to keep the ability to do the processing in a single CPU. In order to do that it seems that I need to duplicate the code that iterates over the results:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import multiprocessing
# argparsed parameters:
num... | <python><multiprocessing> | 2023-04-11 11:59:44 | 2 | 17,608 | Fravadona |
75,985,647 | 11,106,507 | What is the most memory efficient way to add multiple columns from different dataframes together? | <p>I have some very large dataframes and often run out of memory when I want to combine them via a weighted sum.</p>
<p>So what I am doing now is:</p>
<pre><code>dfA[col] = dfA[col]*wA dfB[col]*wB + dfC[col]*wC + dfD[col]*wD
</code></pre>
<p>Where <code>wA</code> is the weight of the A-th dataframe.
I run out of memory... | <python><pandas> | 2023-04-11 11:58:28 | 3 | 1,166 | Olli |
75,985,611 | 1,485,926 | Get specific tag from repository using PyGithub | <p>I have this very simple code using <a href="https://github.com/PyGithub/PyGithub" rel="nofollow noreferrer">PyGithub</a></p>
<pre><code>from github import Github
g = Github('<offuscated token>')
repo = g.get_repo("telefonicaid/fiware-orion")
repo.get_git_tag("3.8.0")
</code></pre>
<p>The r... | <python><pygithub> | 2023-04-11 11:53:44 | 2 | 12,442 | fgalan |
75,985,596 | 1,000,343 | Override Theme Coloring for Just One Character (in VS Code using Python) | <p>I want to be able to use the terminal to see RGB coloring for just one "swatch" character (■) as this is pretty convenient. I also like the dark themes (In my case I use Dark+ theme). The problem is that I can't see the true color of the swatch because the dark theme overrides it.</p>
<p>In Python termin... | <python><python-3.x><visual-studio-code> | 2023-04-11 11:51:08 | 2 | 110,512 | Tyler Rinker |
75,985,522 | 245,549 | Is it possible to access the history of calls done by LangChain LLM object to external API? | <p>When we create an Agent in LangChain we provide a Large Language Model object (LLM), so that the Agent can make calls to an API provided by OpenAI or any other provider. For example:</p>
<pre><code>llm = OpenAI(temperature=0)
agent = initialize_agent(
[tool_1, tool_2, tool_3],
llm,
agent = 'zero-shot-re... | <python><openai-api><langchain> | 2023-04-11 11:44:33 | 3 | 132,218 | Roman |
75,985,464 | 9,947,412 | Selenium EdgeDriver options | <p>How do I integrate selenium webdriver Edge options into EdgeDriver in python?</p>
<p>I tried to use:</p>
<pre class="lang-py prettyprint-override"><code>from selenium.webdriver.edge.options import Options
# with
from selenium.webdriver import Edge
</code></pre>
<p>PS: I do not want to use another package like <em>... | <python><selenium-webdriver><selenium-edgedriver> | 2023-04-11 11:39:01 | 1 | 907 | PicxyB |
75,985,455 | 6,936,582 | Sort dataframe by multiple columns and specify how for each column | <p>I'd like to sort this (I have many more columns of different data types in the real df):</p>
<pre><code>import pandas as pd
from natsort import index_natsorted
import numpy as np
data = {"version":["3.1.1","3.1.10","3.1.2","3.1.3", "4.1.6"],
"... | <python><pandas> | 2023-04-11 11:37:59 | 1 | 2,220 | Bera |
75,985,407 | 5,587,736 | How to access Flask app context from test_client using pytest? | <p>I feel like I don't fully understand <code>app_context</code> and its usage. When I turn my app into a test_client, I can't seem to access the fields that are within the apps context, which means I can't test in my unit tests whether the element was successfully added to the state of the app. How do I access the app... | <python><flask><testing><pytest> | 2023-04-11 11:33:46 | 1 | 697 | Kroshtan |
75,985,214 | 1,639,908 | Why does a "bad format" error occur when importing a key into phantom app? | <p>I use <a href="https://solanacookbook.com/references/keypairs-and-wallets.html#how-to-generate-a-mnemonic-phrase" rel="nofollow noreferrer">example in docs solana for python</a></p>
<p>I try get key pair and import to phantom by private key:</p>
<pre><code>from solders.keypair import Keypair
from mnemonic import Mne... | <python><solana> | 2023-04-11 11:11:54 | 1 | 2,595 | Leo Loki |
75,985,210 | 10,413,428 | Forbid QDialog to be moved by the user | <p>I want to disable that the user can move a displayed custom QDialog. I could not find a solution while googling. Maybe move is the wrong term as it showed many results based on the mouse move event.</p>
<p>I need to use a non-frameless dialogue because I need the close button.</p>
| <python><qt><pyside><pyside6> | 2023-04-11 11:11:14 | 0 | 405 | sebwr |
75,984,983 | 18,140,022 | Polars: change a value in a dataframe if a condition is met in another column | <p>I have this dataframe</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.from_repr("""
┌─────┬───────┐
│ one ┆ two │
│ --- ┆ --- │
│ str ┆ str │
╞═════╪═══════╡
│ a ┆ hola │
│ b ┆ world │
└─────┴───────┘
""")
</code></pre>
<p>And I want to change... | <python><dataframe><python-polars> | 2023-04-11 10:43:17 | 3 | 405 | user18140022 |
75,984,943 | 5,573,294 | In python, replace triple-nested if-else with more elegant way to clean up dataframe columns | <pre><code>data = [[1, 2.4, 3, np.nan], [4, 5.3, 6, np.nan], [np.nan, 8, 3, np.nan]] # Example data
output_data = pd.DataFrame(data, columns=['total', 'count1', 'count2', 'count3'])
output_data
total count1 count2 count3
0 1.0 2.4 3 NaN
1 4.0 5.3 6 NaN
2 NaN 8.0 3 ... | <python><pandas><dataframe> | 2023-04-11 10:37:34 | 1 | 10,679 | Canovice |
75,984,892 | 5,016,028 | Function of matrices in Maxima | <p>I have two matrices Ac and Ep and a parameter k. I need to implement this matrix, which is a function of my prior matrices and k :</p>
<pre><code>ProbEnt(k)[i,j] := if (k < wmax) then binomial(Ac[i,j], k)*Ep[i,j]^k * (1-Ep[i,j])^(Ac[i,j]-k) else 0;
</code></pre>
<p>For some reason it will not allow me to define ... | <python><matrix><sage><maxima><wxmaxima> | 2023-04-11 10:29:35 | 1 | 4,373 | Qubix |
75,984,808 | 11,332,693 | Python drop duplicates by conditions | <p><strong>Problem Statement:</strong> Recruiter wants to recruit an aspirant for a particular job with specific skill and City on the basis of first cum serve. For ex if candidate P1 is selected for JOB 'A'then both JOB 'A' and candidate 'P1' should be dropped for next selection.</p>
<p>Below is the sample dataframe</... | <python><pandas><duplicates> | 2023-04-11 10:18:18 | 1 | 417 | AB14 |
75,984,731 | 4,001,592 | What is the meaning of the re.DEBUG flag? | <p>The <code>re.DEBUG</code> flag offers a peek at the inner workings of a regular expression pattern in Python, for example:</p>
<pre><code>import re
re.compile(r"(a(?:b)){1,3}(c)", re.DEBUG)
</code></pre>
<p>Returns:</p>
<pre><code>MAX_REPEAT 1 3
SUBPATTERN 1 0 0
LITERAL 97
LITERAL 98
SUBPATTERN ... | <python><regex> | 2023-04-11 10:09:57 | 2 | 62,150 | Dani Mesejo |
75,984,675 | 14,594,208 | How to keep the values of one column per index? | <p>Consider the following Pandas dataframe:</p>
<pre class="lang-py prettyprint-override"><code> col_a col_b col_c
0 10 15 20
0 10 15 20
1 10 15 20
1 10 15 20
1 10 15 20
1 10 15 20
2 10 15 20
</code></pre>
<p>Now, let's consider that we'd like th... | <python><pandas> | 2023-04-11 10:06:45 | 3 | 1,066 | theodosis |
75,984,225 | 1,073,476 | Doing ctypes.memset as of Python 3.11? | <p>I'm implementing a memset function that's supposed to set a bytes object buffer to zero.</p>
<p>As of Python 3.11 the buffer api functions <a href="https://docs.python.org/3/c-api/buffer.html#c.PyObject_GetBuffer" rel="nofollow noreferrer">PyObject_GetBuffer() and PyBuffer_Release()</a> are now part of the Stable AB... | <python><ctypes><cpython> | 2023-04-11 09:13:01 | 1 | 429 | johanrex |
75,984,105 | 5,852,506 | Access localhost from within a docker image | <p>I have the following .gitlab-ci.yml file :</p>
<pre><code>image: python:3.8
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python -V # Print out python version for debugging
- pip install --upgrade pip
- pip install virtualen... | <python><docker><gitlab><gitlab-ci> | 2023-04-11 09:00:26 | 2 | 886 | R13mus |
75,984,086 | 1,779,532 | Asking a detailed guideline to forece parameters as positional-only, positional- or keyword-argument, and keyword only when using *args and **kwargs | <p><a href="https://docs.python.org/3/tutorial/controlflow.html#special-parameters" rel="nofollow noreferrer">https://docs.python.org/3/tutorial/controlflow.html#special-parameters</a></p>
<pre><code>def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
----------- ---------- ----------
| | ... | <python><arguments><keyword-argument> | 2023-04-11 08:58:30 | 1 | 2,544 | Park |
75,983,988 | 4,355,695 | enum type create with skip logic working in workbench but not in program with psycopg2 execute | <p>Postgresql query to create an enum type in postgresql, and skip over if its already created:</p>
<pre class="lang-sql prettyprint-override"><code>DO $$ BEGIN
CREATE TYPE operated_by_enum AS ENUM ('opA', 'opB');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
</code></pre>
<p>courtesy <a href="https://stac... | <python><postgresql><psycopg2> | 2023-04-11 08:45:24 | 0 | 6,252 | Nikhil VJ |
75,983,861 | 4,876,058 | Scrapy Crawl only first 5 pages of the site | <p>I am working on the solution to the following problem, My boss wants from me to create a <code>CrawlSpider</code> in <code>Scrapy</code> to scrape the article details like <code>title</code>, <code>description</code> and paginate only the first 5 pages.</p>
<p>I created a <code>CrawlSpider</code> but it is paginatin... | <python><scrapy> | 2023-04-11 08:29:05 | 1 | 1,019 | Ven Nilson |
75,983,384 | 15,452,168 | daily sunshine hours/ minutes from weather API | <p>I am currently using <code>meteostat</code> weather API and extracting data, but I see that sunshine minutes is NaN for mostly all the countries. Am I doing something wrong? Should I look for a Paid weather API? my major focus is Sunshine minutes or hours per day for last 3 years.</p>
<p>I m using the below code sni... | <python><python-3.x><openweathermap><weather><meteostat> | 2023-04-11 07:24:38 | 1 | 570 | sdave |
75,983,163 | 16,383,578 | What exactly does `psutil.net_io_counters().byte_recv` mean? | <p>I use ExpressVPN and my physical connection is a wired Ethernet connection. I am currently connected to the VPN and in my "Control Panel\Network and Internet\Network Connections" page there is an adapter for the Ethernet and an adapter named "Local Area Connection 2" for the VPN connection.</p>
<... | <python><python-3.x><network-programming><psutil> | 2023-04-11 06:57:13 | 1 | 3,930 | Ξένη Γήινος |
75,983,000 | 648,045 | ValueError: cannot reindex on an axis with duplicate labels while using assign | <p>I am trying to split the values inside the <code>engine_type</code> column using <code>_</code> delimiter using the following code</p>
<pre><code>df = pd.read_csv("/content/sample_data/used_cars.csv")
dds = df.assign(engines_type= lambda x: x['engine_type'].str.split(r'\s*_\s*').explode()).reset_index()
</... | <python><pandas> | 2023-04-11 06:33:23 | 1 | 4,953 | logeeks |
75,982,868 | 258,279 | Where does the axis of the great circle through two points meet the sphere? | <p>The great circle through two points with lat/lon φ1, λ1 and φ2, λ2 can be calculated. The axis of this great circle meets the sphere at two antipodal points. Do these points have a name? What is the formula to derive them from φ1, λ1 and φ2, λ2?</p>
| <python><latitude-longitude><great-circle><spherical-coordinate> | 2023-04-11 06:13:38 | 1 | 381 | user258279 |
75,982,281 | 149,900 | How to do interactive "su -c command -" with AsyncSSH | <p>I have successfully executed <code>su -c whoami -</code> using <strong>paramiko</strong> like such:</p>
<pre class="lang-py prettyprint-override"><code>def amiroot(ssh: paramiko.client.SSHClient, root_pass: str) -> bool:
session = ssh.get_transport().open_session()
session.set_combine_stderr(True)
ses... | <python><asyncssh> | 2023-04-11 03:55:53 | 1 | 6,951 | pepoluan |
75,982,050 | 3,044 | In the Hypothesis library for Python, why does the text() strategy cause custom strategies to retry? | <p>I have a custom strategy built using <code>composite</code> that draws from <code>text</code> strategy internally.</p>
<p>Debugging another error (<code>FailedHealthCheck.data_too_large</code>) I realized that drawing from the <code>text</code> strategy can cause my composite strategy to be invoked roughly twice as ... | <python><hypothesis-test><python-hypothesis><property-based-testing> | 2023-04-11 02:45:22 | 1 | 8,520 | levand |
75,982,049 | 12,931,358 | How to convert a four dimensional Tensor to image by PIL? | <p>For example, if my tensor is</p>
<pre><code>t1 = torch.randn(1,3,256,256) #batch_size/ch/height/width
</code></pre>
<p>it is easily to convert to one image by <code>squeeze()</code></p>
<pre><code>import torchvision.transforms as T
transform = T.ToPILImage()
one_img = transform(t1.squeeze())
one_img.save("test1... | <python><pytorch> | 2023-04-11 02:44:53 | 1 | 2,077 | 4daJKong |
75,982,032 | 4,420,797 | Convert json file into labels.csv | <p>I have <code>labels.json</code> file containing the image name and ground truth value. Due to the changing in library I have to modify my data inside <code>json</code> file</p>
<p><strong>Inside Json</strong></p>
<pre><code>{"자랑스럽다_2730052.jpg": "자랑스럽다", "만족스럽다_1299150.jpg": "만족스럽다... | <python><pandas><dataframe> | 2023-04-11 02:38:44 | 1 | 2,984 | Khawar Islam |
75,981,852 | 4,420,797 | How to extract the file name from a column of paths | <p>I am converting the <code>.txt</code> file into <code>labels.csv</code> by adding some columns in a data frame. How I can remove <strong>images/0/</strong> from the column contains <code>images/1/19997.jpg, images/1/19998.jpg images/1/19999.jpg</code> <code>/0</code> is folder name and it varies time to time</p>
<p>... | <python><pandas><dataframe> | 2023-04-11 01:43:48 | 1 | 2,984 | Khawar Islam |
75,981,727 | 21,305,238 | TypedDict: Mark a set of keys as incompatible | <p>I have an interface named <code>Foo</code> which is supposed to have, aside from other common keys, either one of the two given keys, <code>bar</code> and <code>baz</code>. To let PyCharm know, I wrote two interfaces:</p>
<pre class="lang-py prettyprint-override"><code>from typing import TypedDict
class Foo1(TypedD... | <python><pycharm><python-typing><typeddict> | 2023-04-11 01:02:41 | 0 | 12,143 | InSync |
75,981,677 | 13,392,257 | How to create db migrations for local tortoise project? | <p>I have a FastAPI + tortose projects and I want to run the project locally with database <code>postgres://lom:lom@localhost:5432/lom</code> (database is created)</p>
<p>My code</p>
<pre><code># lom/app.py
class App:
storage: S3Storage
def __init__(self):
self.config = Config(_env_file=".env"... | <python><fastapi><tortoise-orm> | 2023-04-11 00:45:07 | 1 | 1,708 | mascai |
75,981,636 | 4,930,914 | Highlight python-docx with regex and spacy | <p>I want to highlight regex pattern in docx files in a folder using python-docx. I am able to achieve it through the normal regex code below.</p>
<p>Issue comes when I want to achieve the same through spacy nlp.</p>
<pre class="lang-py prettyprint-override"><code>from docx import Document
from docx.enum.text import WD... | <python><regex><spacy> | 2023-04-11 00:30:37 | 1 | 915 | Programmer_nltk |
75,981,635 | 12,349,101 | Tkinter - Zoom with text and other elements in Canvas | <p>I'm trying to add support for zooming in and out inside a Canvas widget, containing both text element (created using <code>create_text</code>) and non-text elements, such as rectangles (created with <code>create_rectangle</code>), etc.</p>
<p>So far, I made the following MRE using both part of <a href="https://stack... | <python><tkinter> | 2023-04-11 00:30:37 | 2 | 553 | secemp9 |
75,981,439 | 11,938,023 | How do xor a dataframe slice with the next num and insert the answer in column 'dr' | <p>Ok I have this data frame which you notice is names solve and I'm using a slice of 4</p>
<pre><code>In [13147]: solve[::4]
Out[13147]:
rst dr
0 1 0
4 3 0
8 7 0
12 5 0
16 14 0
20 12 0
24 4 0
28 4 0
32 4 0
36 3 0
40 3 0
44 5 0
48 5 0
52 13 0
5... | <python><pandas><numpy><xor> | 2023-04-10 23:29:02 | 1 | 7,224 | oppressionslayer |
75,981,283 | 13,142,245 | Efficient days between two dates in Pandas | <pre class="lang-py prettyprint-override"><code># works
pre_start['exposure_days'] = (datetime.now() - pd.to_datetime(pre_start['First_Exposure']))
# doesn't work
pre_start['exposure_days'] = (datetime.now() - pd.to_datetime(pre_start['First_Receive_Date'])).days
</code></pre>
<p>The error I get is <code>AttributeErro... | <python><pandas><datetime> | 2023-04-10 22:50:19 | 1 | 1,238 | jbuddy_13 |
75,981,262 | 850,781 | Compute moving average with non-uniform domain | <p><a href="https://stackoverflow.com/q/14313510/850781">How to calculate rolling / moving average using python + NumPy / SciPy?</a> discusses the situation when the observations are <em>equally spaced</em>, i.e., the index is equivalent to an integer range.</p>
<p>In my case, the observations come at arbitrary times a... | <python><numpy><convolution><rolling-computation><moving-average> | 2023-04-10 22:43:43 | 1 | 60,468 | sds |
75,981,048 | 4,358,137 | How to name a model checkpoint with a metric involving a period? | <p>I would like to name my checkpoint like so:</p>
<pre class="lang-py prettyprint-override"><code>mcp_save = tf.keras.callbacks.ModelCheckpoint('effnet-{epoch:02d}-{val_f0.5-score:.4f}.mdl_wts.hdf5', save_best_only=True, monitor='val_f0.5-score', mode='max')
</code></pre>
<p>But because the metric has a period I get a... | <python><tensorflow><keras><filenames> | 2023-04-10 22:00:18 | 1 | 1,566 | Seth Kitchen |
75,981,046 | 11,092,636 | openpyxl writing in a cell and copying previous format doesn't work: format is not applied | <p>To preserve the background colour and the font colour when updating a cell value with <code>openpyxl</code>, I tried to store the original background colour and font colour to then re-apply it after modifying the value since setting a value would remove the formatting. However, it does not work and I'm not sure I un... | <python><excel> | 2023-04-10 21:59:19 | 1 | 720 | FluidMechanics Potential Flows |
75,981,036 | 3,904,557 | Python OpenAI Whisper FileNotFoundError when running a standalone created with PyInstaller | <p>I made a small Python program that uses <a href="https://github.com/openai/whisper" rel="nofollow noreferrer">OpenAI whisper's library</a>. Everything works fine in my virtual environment.</p>
<p>I generated a <code>.exe</code> of the whole thing with <a href="https://pyinstaller.org/en/stable/" rel="nofollow norefe... | <python><pyinstaller><openai-whisper> | 2023-04-10 21:56:50 | 2 | 5,526 | Ryan Pergent |
75,980,839 | 814,730 | Merge a Python Array Along an Axis | <p>I've been trying to populate a training data set for use in a Keras model. Using numpy's <code>append</code> function everything <em>works</em> fine, but it is <strong>incredibly slow</strong>. Here's what I'm doing right now:</p>
<pre class="lang-py prettyprint-override"><code>def populateData():
images = np.ze... | <python><arrays><numpy><multidimensional-array><append> | 2023-04-10 21:21:32 | 2 | 8,628 | Sam Spencer |
75,980,805 | 2,924,334 | pygal: How to show the data labels in the saved png | <p>If I include <code>label</code> as in the code snippet below, it shows the data labels when rendered as svg and mouse-hover. However, how do I make the labels show up in a saved png?</p>
<pre><code>import pygal
chart = pygal.XY()
chart.add('line A', [{'value': (10, 2), 'label': 'A0'}, {'value': (15, 20), 'label': '... | <python><pygal> | 2023-04-10 21:16:38 | 1 | 587 | tikka |
75,980,255 | 9,918,823 | Convolving two arrays in python without for loops | <p>I have two arrays(<code>arr_1,arr_2</code>), and need to generate an output(<code>arr_out</code>) as follows:</p>
<pre><code>arr_1 = [21, 28, 36, 29, 40]
arr_2 = [0, 225, 225, 0, 225]
arr_out = [-1, 28, 36, -1, 40]
</code></pre>
<p>The outputarr_out should have -1 at an index if the product of the elements in arr_1... | <python> | 2023-04-10 19:52:49 | 2 | 991 | harinsamaranayake |
75,980,187 | 418,413 | How can I determine if I need to install psycopg2? | <p>I am trying to build a generic tool to bootstrap an EMR cluster. Some of the jobs we run in PySpark on EMR require psycopg2. Others don't. For the ones that require psycopg2, we need to <code>yum install postgresql-devel</code>. Otherwise, we don't. So I'm trying to detect if psycopg2 is a dependency.</p>
<p>However... | <python><psycopg2><python-c-api> | 2023-04-10 19:42:13 | 0 | 77,713 | kojiro |
75,980,084 | 10,658,339 | How to overcome memory issue when plotting raster in Python | <p>I have an i7 with 32GB and NVIDIA RTX 30 GPU.
I'm trying to plot some raster in Python and getting memory issues.
I have compressed my raster with rasterio lzw, but still getting memory issues.
My raster is boolean and already clipped the interested area.
I have transformed the raster into a dictionary with arrays.<... | <python><memory><gis><raster><rasterio> | 2023-04-10 19:27:25 | 0 | 527 | JCV |
75,979,891 | 979,242 | Trying to remove a a role assigned to a GCP user | <p>Use Case: I am trying to delete all the roles assigned to a principal inside a GCP project.</p>
<p>As I understand you can't perform that operation directly.
I am referring here: <a href="https://cloud.google.com/iam/docs/samples/iam-modify-policy-remove-member" rel="nofollow noreferrer">https://cloud.google.com/iam... | <python><google-cloud-platform><gcp-iam> | 2023-04-10 19:00:41 | 1 | 505 | PiaklA |
75,979,882 | 20,947,319 | How to fetch the id of an item in Django when using JSON to fetch from the database | <p>I have a Django template whereby I am looping through several items in the homepage. When an item is clicked, a modal which I have included by importing it should be shown and data related to the clicked item displayed. I am using JSONResponse to prepopulate the modal. Once the modal is shown, I want to create a che... | <javascript><python><json><django> | 2023-04-10 18:58:40 | 1 | 446 | victor |
75,979,824 | 10,181,236 | telethon error after inserting phone number | <p>I'm using telethon to read messages from a specific telegram channel. I use this code to get the messages</p>
<pre><code>import configparser
from telethon import TelegramClient
SESSION_NAME = "test_session_1"
# Reading Configs
config = configparser.ConfigParser()
config.read("config.ini")
# Se... | <python><telegram><telethon> | 2023-04-10 18:47:22 | 0 | 512 | JayJona |
75,979,811 | 129,899 | Manipulating a list of strings using the Unreal Python API | <p>Using the Unreal Python API.
<a href="https://docs.unrealengine.com/5.0/en-US/PythonAPI/" rel="nofollow noreferrer">https://docs.unrealengine.com/5.0/en-US/PythonAPI/</a></p>
<p>In the following method I am creating a list called assetPaths.</p>
<pre><code> import unreal
def listAssetPaths() :
EAL = u... | <python><string><unreal-engine5> | 2023-04-10 18:44:38 | 1 | 7,279 | Bachalo |
75,979,713 | 3,541,631 | Process elements in chunks using multiprocessing queues | <p>I have a multiprocessing queue; The end of the queue is signaled by using a SENTINEL value, a string.</p>
<pre><code>aq = Queue()
</code></pre>
<p>........................</p>
<p>The instance in the queue are of class A:</p>
<pre><code>class A:
id: str
desc: str
</code></pre>
<p>In a function I'm getting element... | <python><python-3.x><queue><python-3.8> | 2023-04-10 18:32:01 | 2 | 4,028 | user3541631 |
75,979,676 | 674,039 | Why does this code work on Python 3.6 but not on Python 3.7? | <p>In <code>script.py</code>:</p>
<pre><code>def f(n, memo={0:0, 1:1}):
if n not in memo:
memo[n] = sum(f(n - i) for i in [1, 2])
return memo[n]
print(f(400))
</code></pre>
<p><code>python3.6 script.py</code> correctly prints <code>f(400)</code>, but with <code>python3.7 script.py</code> it stack overf... | <python><recursion><stack-overflow> | 2023-04-10 18:26:17 | 1 | 367,866 | wim |
75,979,563 | 5,561,058 | Pexpect throwing incorrect EOF error for expect method | <p>Here is my function:</p>
<pre><code>def ExecuteList(self, myChild, intf):
for cmd, rsp, timeout in zip(self.myCommandList, self.myResponseList, self.myTimeout): # zip allows you to iterate through multiple list in parallel.
try:
myChild.sendline(cmd)
time.sleep(2)
myChild.expect(rsp, ... | <python><pexpect> | 2023-04-10 18:07:56 | 0 | 471 | Yash Jain |
75,979,562 | 11,564,487 | Axial inconsistency of pandas.diff | <p>Consider the dataframe:</p>
<pre><code>df = pd.DataFrame({'col': [True, False]})
</code></pre>
<p>The following code works:</p>
<pre><code>df['col'].diff()
</code></pre>
<p>The result is:</p>
<pre><code>0 NaN
1 True
Name: col, dtype: object
</code></pre>
<p>However, the code:</p>
<pre><code>df.T.diff(axis=1)
... | <python><pandas> | 2023-04-10 18:07:46 | 2 | 27,045 | PaulS |
75,979,480 | 18,758,062 | Python Relative Import Error appears only on server | <p>I'm trying to start a Flask server on both my local Ubuntu machine and a remote Ubuntu server, using the same commands in the terminal for both.</p>
<pre><code>virtual venv
source venv/bin/activate
pip install flask flask_cors gunicorn #... and more
FLASK_DEBUG=1 FLASK_APP=server flask run --host=0.0.0.0
</code></pr... | <python><flask><python-import> | 2023-04-10 17:55:18 | 0 | 1,623 | gameveloster |
75,979,420 | 1,492,337 | using llama_index with mac m1 | <p><strong>Question #1:</strong></p>
<p>Is there a way of using Mac with M1 CPU and <code>llama_index</code> together?</p>
<p>I cannot pass the bellow assertion:</p>
<pre><code>AssertionError Traceback (most recent call last)
<ipython-input-1-f2d62b66882b> in <module>
6 from... | <python><machine-learning><pytorch><huggingface-transformers><langchain> | 2023-04-10 17:46:58 | 2 | 433 | Ben |
75,979,419 | 559,426 | How can you specify tab order in python flet? | <p>I have a working flet input page, but the tab order seems to have no logic to it. I would like to specify exactly what I want, but don't know how. Can anyone help?</p>
| <python><user-interface><tabs><flet> | 2023-04-10 17:46:57 | 1 | 1,010 | Highland Mark |
75,979,362 | 4,876,058 | Remove white spaces line breaks from the extracted text Python scraping | <p>I am facing an issue regarding extracting text from the website page. I am using the <code>XPath</code> selector and <code>Scrapy</code> for this.</p>
<p>The page contains the markup like this:</p>
<pre><code><div class="snippet-content">
<h2>First Child</h2>
<p>Hello</p&... | <python><xpath><scrapy> | 2023-04-10 17:38:49 | 1 | 1,019 | Ven Nilson |
75,979,268 | 4,913,254 | How to check if a value in one column is in other column when the queried column have many values? | <p><strong>Question</strong></p>
<p>How to check if a value in one column is in other column when the queried column have many values?</p>
<p><strong>The minimal reproducible example</strong></p>
<pre><code>df1 = pd.DataFrame({'patient': ['patient1', 'patient1', 'patient1','patient2', 'patient2', 'patient3','patient3',... | <python><pandas> | 2023-04-10 17:29:23 | 3 | 1,393 | Manolo Dominguez Becerra |
75,979,236 | 6,077,239 | What is the difference between polars.collect_all and polars.LazyFrame.collect | <p>Starting with the example below:</p>
<pre><code>import time
import numpy as np
import polars as pl
n_index = 1000
n_a = 10
n_b = 500
n_obs = 5000000
df = pl.DataFrame(
{
"id": np.random.randint(0, n_index, size=n_obs),
"a": np.random.randint(0, n_a, size=n_obs),
&quo... | <python><python-polars> | 2023-04-10 17:23:49 | 1 | 1,153 | lebesgue |
75,979,218 | 929,732 | How do you unpack a python object with a list of tuples as the return value? | <p>So I'm getting a repsonse back from an application.</p>
<p>When I write the below to a file I get</p>
<pre><code>f.write(str(request.packet))
</code></pre>
<pre><code>AuthPacket([(1, [username']), (2,
[b'\11?']), (5,
[b'23']), (30, [b'8.8.8.8']), (31,
[b'4.4.4.4']), (61, [b'4.4.4.4']), (66,
[b'4.4.4.4']), ((9, 1), [... | <python> | 2023-04-10 17:21:30 | 0 | 1,489 | BostonAreaHuman |
75,978,962 | 14,220,087 | how to set class attribute only if it is created during init | <pre class="lang-py prettyprint-override"><code>class Foo:
def __init__(self):
self.A = 100
class Boo(Foo):
def __init__(self):
super(Boo, self).__init__()
self.B = None
x = Boo()
print(x.A, x.B)
# 100 None
</code></pre>
<p>As shown above, I've created an instance of <code>Boo</code>... | <python><python-3.x> | 2023-04-10 16:47:08 | 2 | 829 | Sam-gege |
75,978,880 | 1,641,112 | spacy python package no longer runs | <p>Running python 3.11.3 on macos, Intel.</p>
<p>I had spacy working fine. I then decided to try adding gpu support with: <code>pip install -U 'spacy[cuda113]'</code> but started getting errors.</p>
<p>I uninstalled with <code>pip uninstall 'spacy[cuda113]'</code> and then reinstalled spacy with just <code>pip install ... | <python><spacy> | 2023-04-10 16:33:27 | 2 | 7,553 | StevieD |
75,978,865 | 10,755,032 | How to insert a list into a cell in pandas dataframe | <p>I have referred <a href="https://stackoverflow.com/questions/26483254/python-pandas-insert-list-into-a-cell">this</a>
but it did not help. <strong>Don't duplicate this please</strong>. I am trying to count the <code>syllable per word</code> for each text file in my <code>output</code> directory. I wanted to insert a... | <python><pandas> | 2023-04-10 16:31:43 | 2 | 1,753 | Karthik Bhandary |
75,978,754 | 13,294,769 | Error importing Parquet to Redshift: optional int | <p>I'm creating a table in Redshift as follows:</p>
<pre class="lang-py prettyprint-override"><code>from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
from sqlalchemy_redshift.dialect import INTEGER, VARCHAR
Base = declarative_base()
class SomeTable(Base):
__tablename__ = "... | <python><python-3.x><pandas><amazon-redshift><parquet> | 2023-04-10 16:15:04 | 0 | 1,063 | doublethink13 |
75,978,731 | 248,959 | Python paho MQTT loop_forever(): how to redirect output to a file while the script is running? | <p>I'm running a script to subscribe to topics of an MQTT broker and fetch the data associated to them. I run the script like this:</p>
<p><code>$ python3 test_mqtt_client.py</code></p>
<pre><code>import paho.mqtt.client as paho
import ssl
import random
from config import BROKER_ADDRESS, PORT, CLIENT_CERT, CLIENT_KEY,... | <python><python-3.x><mqtt><paho><python-paho> | 2023-04-10 16:12:18 | 1 | 31,891 | tirenweb |
75,978,533 | 871,495 | Tensorflow2 Warning: "INVALID_ARGUMENT: You must feed a value for placeholder ..." | <p>I get the following warning when running the following minimal code (that will train a very simple tensorflow 2 model). Actually it is telling me that I can ignore this message, but I still got the feeling that something might be wrong and I don't like ignoring messages like this. The message still persists even if ... | <python><tensorflow><tensorflow2.0> | 2023-04-10 15:43:12 | 2 | 415 | Gustav-Gans |
75,978,476 | 21,363,224 | Replace every symbol of the word after delimiter using python re | <p>I would like to replace every symbol of a word after <code>-</code> with <code>*</code>.</p>
<p>For example:</p>
<pre><code>asd-wqe ffvrf => asd-*** ffvrf
</code></pre>
<p>In TS regex it could be done with <code>(?<=-\w*)\w</code> and replacement <code>*</code>. But default python regex engine requires l... | <python><regex><regex-lookarounds><positive-lookbehind> | 2023-04-10 15:35:24 | 2 | 13,906 | markalex |
75,978,464 | 3,398,324 | How to interpret predictions from a specific PyTorch Model | <p>I have obtained the prediction values from this <a href="https://github.com/allegro/allRank/issues/55" rel="nofollow noreferrer">PyTorch model</a>, at least I think so(<a href="https://github.com/allegro/allRank" rel="nofollow noreferrer">https://github.com/allegro/allRank</a>) by running:</p>
<p><code>slates_X, sla... | <python><pytorch><prediction> | 2023-04-10 15:34:10 | 0 | 1,051 | Tartaglia |
75,978,448 | 19,299,757 | AWS lambda image not showing the latest code | <p>I have a docker image for an AWS lambda function which just prints a "Welcome" message. I've set this up to run the lambda code whenever a file is uploaded to an S3 bucket(via CFN script).
The lambda image is successfully created.
When I uploaded a test file to S3 via CLI (using aws s3 cp command), I could... | <python><amazon-web-services><docker><aws-lambda> | 2023-04-10 15:32:33 | 0 | 433 | Ram |
75,978,420 | 19,130,803 | how to edit /etc/hosts/ file on nginx docker image | <p>I am using docker-compose for my python web app. I am using nginx as one of service. Currently I am running on localhost and it is working fine. Now, instead of localhost I am trying to use domain name as <code>server_name www.mywebapp.com</code> and I also need to edit <code>/etc/hosts</code> file to add <code>127.... | <python><docker><nginx> | 2023-04-10 15:29:00 | 0 | 962 | winter |
75,978,344 | 8,398,116 | SQLALCHEMY not utilising the entire connection pool | <p>I am new to flask and sqlalchemy and trying to wrtie an API that can support throughputs of 400 requests/sec.</p>
<p>I am using sqlalchemy to connect to a clickhouse database.</p>
<p>my sqlalchemy settings are:</p>
<pre><code> SQLALCHEMY_BINDS_OPTIONS = {
'db': {
'pool_size': 150,
'ec... | <python><flask><sqlalchemy><gunicorn><clickhouse> | 2023-04-10 15:18:00 | 0 | 990 | Abhilash Gopalakrishna |
75,978,167 | 4,539,956 | SQLmodel: "UniqueViolation, duplicate key value violates unique constraint" on update | <p>I have a fastapi edpoint for updating records in the database, but it doesn't seem to work as intended and I get the following error when I call the endpoint to update a record:</p>
<pre><code> File "/usr/src/app/app/api/controllers/records.py", line 137, in update_record_endpoint
updated_record = upd... | <python><postgresql><sqlalchemy><fastapi><sqlmodel> | 2023-04-10 14:55:22 | 1 | 903 | Saeed Esmaili |
75,978,141 | 11,962,592 | ansible install issue using python3 pip | <p>Seeing issue locating installed Ansible package.</p>
<p>Following along</p>
<p><a href="https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html</a></p>
<p>Tried running commands as... | <python><python-3.x><pip><ansible> | 2023-04-10 14:52:19 | 2 | 643 | vinWin |
75,978,062 | 11,235,680 | how to set the background color of a RichTextCtrl in wxPython | <p>I have a chatbox and I'm trying to colour every message with a different colour</p>
<pre><code>class ChatDisplayer(RichTextCtrl):
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
def addMessage(self, message, red, green, blue):
font = Font(12, DEFAULT, NORMAL, NORMAL, False)
... | <python><wxpython> | 2023-04-10 14:42:23 | 1 | 316 | Bouji |
75,977,887 | 12,624,118 | How to create Python requirements.text file without sub-dependencies? | <p>Im quit new to python coming from the JS world .</p>
<p>When installing a package in javascript all the subdependencies of that packge are not part of the package.json. dependencies section.
For example:</p>
<pre><code>npm init -y
npm install express
</code></pre>
<p>would produce</p>
<pre><code> "scripts"... | <python><pip><requirements.txt> | 2023-04-10 14:16:54 | 1 | 766 | yoty66 |
75,977,591 | 1,231,940 | Mark rows of one dataframe based on values from another dataframe | <p>I have following problem. Let's say I have two dataframes</p>
<pre class="lang-py prettyprint-override"><code>df1 = pl.DataFrame({'a': range(10)})
df2 = pl.DataFrame({'b': [[1, 3], [5,6], [8, 9]], 'tags': ['aa', 'bb', 'cc']})
print(df1)
print(df2)
</code></pre>
<pre><code>shape: (10, 1)
┌─────┐
│ a │
│ --- │
│ i64... | <python><dataframe><python-polars> | 2023-04-10 13:34:18 | 1 | 437 | Kaster |
75,977,475 | 5,519,012 | Modifying cython instance read-only properties in runtime | <p>I am using python aio grpc implementation, which is using <code>cython</code>. One of <code>grpc</code> features is <code>interceptor</code>, this is a class which get the request before the grpc's Server instance, and can modify the requests as it wants.</p>
<p>The proper way to use <code>interceptors</code> is to ... | <python><runtime><grpc><cython> | 2023-04-10 13:15:44 | 1 | 365 | Meir Tolpin |
75,977,435 | 13,126,794 | Python: json_normalize gives AttributeError for list of dict values | <p>I have a pandas dataframe where 2 columns are nested column having decimal value: <code>df.tail(1).to_dict('list')</code> gives this kind of data</p>
<pre><code> {'nested_col1': [array([{'key1': 'CO', 'key2': Decimal('8.940000000')}],
dtype=object)], 'nested_col2': [array([{'key3': 'CO', 'key4': 'P14', 'key5': Dec... | <python><json><pandas> | 2023-04-10 13:10:38 | 2 | 961 | Dcook |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.