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,626,023 | 2,299,245 | Working with large rasters using rioxarray | <p>I am trying to re-write some of my R code in Python for doing raster reclassification on large rasters in a memory-safe way.</p>
<p>In R I would write the below. Because I have provided a filename argument to the classify line, this will work for large rasters and write the results to a file. No memory worries.</p>
... | <python><raster><python-xarray><rasterio> | 2023-03-03 10:41:13 | 0 | 949 | TheRealJimShady |
75,625,986 | 914,693 | Invoke an HFArgumentParser based script from within a Click command | <p>I have a script <code>trainmodel.py</code> coming from an existing codebase (based on Hugginface ArgumentParsers) with almost 100 different arguments that is based on argparse. The script comes as a <code>main()</code> function that parses individually each argument, and when run with no arguments produces the entir... | <python><command-line-interface><argparse><huggingface-transformers><python-click> | 2023-03-03 10:37:29 | 0 | 8,721 | linello |
75,625,978 | 14,269,252 | Change the position of text in double slider | <p>I defined a double slider in stream lit app, I want to write the start point text on top and the end point text on bottom, or even slightly higher than start point in case texts don't overlap if the start and end point are too close, how should I modify it?</p>
<pre><code>slider = cols1.slider('Select date', min_val... | <python><streamlit> | 2023-03-03 10:36:43 | 1 | 450 | user14269252 |
75,625,951 | 13,066,054 | how to use column values in window function range between | <p>I have a pyspark dataframe which looks like this (formatted for better view, data partitioned by <code>company_id</code> and <code>as_on_date</code> ordering by <code>t_tax_period</code>)</p>
<pre><code>+-----------------+----------+------------+----------+--------------+---------------+---------------+
|company_mas... | <python><sql><apache-spark><pyspark><window-functions> | 2023-03-03 10:33:52 | 0 | 351 | naga satish |
75,625,753 | 19,504,610 | Embedded a #[pyclass] in another #[pyclass] | <p>I am trying to implement a cache for the private variable of any python class.</p>
<p>Let's suppose I have this:</p>
<pre><code>#[pyclass]
struct ClassA {
pv: Py<PyAny>, // GIL independent type, storable in another #[pyclass]
field_a: Py<PyAny>,
}
#[pyclass]
struct ClassB {
class_a: Py<Cl... | <python><rust><pyo3><python-bindings> | 2023-03-03 10:14:49 | 1 | 831 | Jim |
75,625,726 | 2,613,271 | Plot from list of lists in Python | <p>I have a series of csv files that is the output of a solver in space and time, so the population is given for each point in time (rows) and space (columns) for different models.</p>
<p>I want to read them into python to plot individual rows or individual columns from the solutions. I cannot figure out how to do thi... | <python><matplotlib> | 2023-03-03 10:11:52 | 1 | 1,530 | Esme_ |
75,625,687 | 14,958,374 | How to turn off request body logging in elastic-apm | <p>I am using <strong>elastic-apm</strong> middleware with <strong>FastApi</strong>. During serving each request my application is making several data-heavy request to external resources. My current setup is the following:</p>
<pre><code>app = FastAPI(
title="My API", description="Hello from my API!&... | <python><fastapi><elastic-apm> | 2023-03-03 10:08:48 | 1 | 331 | Nick Zorander |
75,625,628 | 14,269,252 | Change the size of chart dynamic regarding the size of data frame and modify the format of X axis in plotly | <p>I wrote the code below and it works fine for a scatter plot.</p>
<p>I want to modify the code as I want to show year in the format <strong>July 2010</strong>, currently it is 10-01, also I want to show all the date (yesr and month) and not part of it.</p>
<p>The size of chart has to be dynamic, because sometimes reg... | <python><pandas><plotly><streamlit> | 2023-03-03 10:02:44 | 0 | 450 | user14269252 |
75,625,466 | 10,077,354 | Not able to redirect container logs to file using subprocess.run | <p>I have a python script to start some containers, wait for them to finish execution and then start a few others. I wanted to get the container logs and this bash command worked for me:</p>
<pre><code>docker logs -f container-name &> tmp.log &
</code></pre>
<p>However when I try to add it to my python scrip... | <python><docker> | 2023-03-03 09:45:34 | 1 | 2,487 | Suraj |
75,625,319 | 1,020,139 | How to mock requests.Session.get using unittest module? | <p>I want to mock <code>app.requests.Session.get</code> from <code>test_app.py</code> to return a mocked <code>requests.Response</code> object with a 404 <code>status_code</code> to generate an <code>InvalidPlayerIdException</code>.</p>
<p>However, no exception is raised as seen from the below output. Is it because I'm... | <python><unit-testing><testing><python-requests><python-unittest> | 2023-03-03 09:29:42 | 1 | 14,560 | Shuzheng |
75,625,212 | 14,744,714 | How add lottie animation on background streamlit app? | <p>I have streamlit app and i need add lottie amination on this background. Animation - it is json file on my page.</p>
<p>Some code for open json file as lottie images:</p>
<pre><code>import streamlit as st
from streamlit_lottie import st_lottie
@st.cache
def load_image_json(path):
""" Load animat... | <python><css><streamlit><lottie> | 2023-03-03 09:20:20 | 1 | 717 | kostya ivanov |
75,625,056 | 14,711,735 | How should the AnyStr be used? | <p>I am pretty new to annotations in Python and trying to apply them to a project I am working. I can't really figure out the <code>AnyStr</code> type from the <code>typing</code> package.</p>
<p>The <a href="https://docs.python.org/3/library/typing.html#typing.AnyStr" rel="nofollow noreferrer">docs</a> say:</p>
<block... | <python><mypy><python-typing> | 2023-03-03 09:01:44 | 1 | 833 | Erik Asplund |
75,624,961 | 13,518,426 | What does config inside ``super().__init__(config)`` actually do? | <p>I have the following code to create a custom model for Named-entity-recognition. Using ChatGPT and Copilot, I've commented it to understand its functionality.</p>
<p>However, the point with <code>config</code> inside <code>super().__init__(config)</code> is not clear for me. Which role does it play since we have alr... | <python><oop><nlp><huggingface-transformers> | 2023-03-03 08:50:38 | 1 | 433 | Ahmad |
75,624,860 | 12,967,353 | Retrieve arguments passed to mocked function with Mockito | <p>I am using mockito to patch an instance of some class and check the calls on the method of this class.</p>
<p>With this class:</p>
<pre><code>class A:
def __init__(self, a):
self.a = a
def foo(self, a):
self.a = 2 * a
return 2 * a
</code></pre>
<p>I can use mockito to patch <code>foo... | <python><mocking><mockito> | 2023-03-03 08:40:43 | 1 | 809 | Kins |
75,624,797 | 4,469,265 | How to yield items from multiple h5 files simultaneously | <p>I have a list of h5 files
my single generator is like this</p>
<pre><code>class H5Dataset_all(Dataset):
def __init__(self, h5_path):
# super(dataset_h5, self).__init__()
self.h5_path = h5_path
self._h5_gen = None
def __getitem__(self, index):
if self._h5_gen is None:
... | <python><iterator><generator><yield><h5py> | 2023-03-03 08:34:06 | 1 | 1,124 | Tommy Yu |
75,624,592 | 3,529,352 | Extract word by regex in python | <p>I'm new to Python and would like to know how to use regex.</p>
<p>Suppose I have a patter like</p>
<pre><code>alice(ben)charlie(dent)elise(fiona)
</code></pre>
<p>or</p>
<pre><code>grace
</code></pre>
<p>For the first case, I want to get <code><alice,charlie,elise></code>.</p>
<p>For the second case, I want ge... | <python><regex> | 2023-03-03 08:10:12 | 4 | 854 | nathan |
75,624,347 | 5,530,553 | PyTorch model not releasing peak memory after computation | <p>I am using <a href="https://www.sbert.net/" rel="nofollow noreferrer">SentenceTransformers</a> library to get a text embedding of a given text. I do inference on one of the pre-trained models from the library, and use the embedding vector for further computations.
When the model is doing inference, there is a spike ... | <python><machine-learning><memory><pytorch><sentence-transformers> | 2023-03-03 07:38:54 | 0 | 3,300 | Ananda |
75,624,272 | 1,039,860 | Trying to create a grid of widgets with scrollbars in python and tkinter | <p>I am so confused (as you can see from my code which is currently a hodge-podge from various sources). I am trying to have a scrollable grid of widgets (currently tk.Entry's) that fill the frame when it is enlarged. Currently I only am trying to add a vertical scrollbar, but I intend to add a horizontal once I unde... | <python><tkinter><grid><scrollbar> | 2023-03-03 07:30:20 | 1 | 1,116 | jordanthompson |
75,624,190 | 7,505,256 | How to iterate over vector of pyclass objects in rust? | <p>I am using maturin and I am trying to implement the method <code>get_car()</code> for my class.</p>
<p>But using the following code</p>
<pre class="lang-rust prettyprint-override"><code>use pyo3::prelude::*;
#[pyclass]
struct Car {
name: String,
}
#[pyclass]
struct Garage {
cars: Vec<Car>,
}
#[pymet... | <python><rust><pyo3><maturin> | 2023-03-03 07:20:52 | 1 | 316 | Prokie |
75,624,180 | 7,713,811 | Issue with Exporting Cycle into CSV filetype in Zephyr Squad REST API | <p>Followed Official Doc:
<a href="https://zephyrsquad.docs.apiary.io/#reference/cycle/export-cycle/export-cycle" rel="nofollow noreferrer"> Zephyr Squad Cloud REST API (formerly Zephyr for Jira) </a></p>
<p>Getting <em><strong><code>Missing parameter: projectId</code></strong></em> as a response from Zephyr Squad. I a... | <python><jira-rest-api><jira-zephyr> | 2023-03-03 07:19:05 | 0 | 2,964 | Nɪsʜᴀɴᴛʜ ॐ |
75,624,165 | 10,500,957 | Gtk Group Check Button | <p>I discovered Gtk grouped CheckButtons in the documentation at:</p>
<p><a href="https://developer.gnome.org/documentation/tutorials/beginners/components/radio_button.html" rel="nofollow noreferrer">https://developer.gnome.org/documentation/tutorials/beginners/components/radio_button.html</a></p>
<p>But when I run the... | <python><button><gtk><group> | 2023-03-03 07:17:35 | 0 | 322 | John |
75,624,099 | 15,239,717 | Django Query two Models and Display Records in One HTML Table | <p>I am working on a Django Daily Saving Project where I have Statement view and I want to display a Customer's Deposits and Withdrawals (all his deposits and withdrawals) in one HTML Table. I am looking at the Best Performance (Constant Complexity for Big O Notation if possible in this case). I don't know whether ther... | <python><django> | 2023-03-03 07:08:32 | 2 | 323 | apollos |
75,624,066 | 3,560,215 | Python Loop over Key Value Pair | <p>I have an input file list called INPUTLIST.txt that currently looks like this:</p>
<pre><code>KV:123
LDAP:456
AWS:789
PKI:222
</code></pre>
<p>In all honesty though, I'm not entirely fussed about its presentation, but there's plenty of flexibility for the above list to be saved in any suitable format, including thes... | <python><dictionary><for-loop><arraylist><key-value> | 2023-03-03 07:04:17 | 1 | 971 | hitman126 |
75,623,977 | 10,200,497 | change the value of column to the maximum value above it in the same column | <p>This is my dataframe:</p>
<pre><code>df = pd.DataFrame({'a': [100, 103, 101, np.nan, 105, 107, 100]})
</code></pre>
<p>And this is the output that I want:</p>
<pre><code> a b
0 100.0 100
1 103.0 103
2 101.0 103
3 NaN 103
4 105.0 105
5 107.0 107
6 100.0 107
</code></pre>
<p>I wa... | <python><pandas> | 2023-03-03 06:52:07 | 1 | 2,679 | AmirX |
75,623,812 | 18,086,775 | Creating a pivot table with multiple columns | <p>I'm trying to create a pivot table with multiple columns; I'm unsure how to explain this better. But the following is the desired output, dataframe setup, and code I have tried so far.</p>
<p><strong>Desired Output:</strong><a href="https://i.sstatic.net/AIo15.png" rel="nofollow noreferrer"><img src="https://i.sstat... | <python><pandas><pivot-table> | 2023-03-03 06:27:18 | 1 | 379 | M J |
75,623,549 | 9,008,162 | How can I use np.array to speed up calculation instead of looping (with some preconditions)? | <p>I need to use the following code; is it possible to use np.array to do the exact calculation and get the same result faster?</p>
<pre class="lang-py prettyprint-override"><code>data['daily_change'] = data.groupby('title',group_keys=False)['return'].pct_change()
for title in data['title'].unique(): # Iterate through ... | <python><pandas><dataframe><numpy><performance> | 2023-03-03 05:42:33 | 1 | 775 | saga |
75,623,506 | 4,733,871 | Python, get the index of maximum value in a list of lists | <p>I've got the following list of lists:</p>
<pre><code>[[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0],
[1.0, 4],
[0, 0],
[0.75, 3],
[0.75, 3],
[0, 0],
[1.0, 4],
[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 1],
[0, 2]]
</code></pre>
<p>I'm trying to get the index corresponding to the maximum value for... | <python><list><indexing><max> | 2023-03-03 05:37:20 | 2 | 1,258 | Dario Federici |
75,623,470 | 19,238,204 | 5D Scatter Plot is too big, how to modify the size attribute? | <p>I have followed this tutorial:
<a href="https://towardsdev.com/multi-dimension-visualization-in-python-part-i-85c13e9b7495" rel="nofollow noreferrer">https://towardsdev.com/multi-dimension-visualization-in-python-part-i-85c13e9b7495</a></p>
<p><a href="https://towardsdev.com/multi-dimension-visualization-in-python-p... | <python><pandas><matplotlib> | 2023-03-03 05:30:25 | 1 | 435 | Freya the Goddess |
75,623,422 | 18,758,062 | Reset pruned trials in Optuna study? | <p>If I have a study where all the pruned trials needs to be reset for some reason, is there a way to do this?</p>
<p>Maybe something that might work: Creating a copy of the current study where pruned trials have their state reset.</p>
<p>Thank you for any suggestions to reset all pruned trials</p>
| <python><optuna> | 2023-03-03 05:20:46 | 1 | 1,623 | gameveloster |
75,623,408 | 6,397,155 | Python KafkaTimeoutError: Timeout waiting for future | <p>I'm using Kafka to send logs to a topic. While sending the messages, I always get this error</p>
<pre><code>Message: 'test log'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
File "/home/ubuntu/applications/pythonapp/kafka_handler.py", line 53, in emit
self.flush(timeout=1.0)
... | <python><apache-kafka><kafka-python> | 2023-03-03 05:18:04 | 2 | 1,469 | node_man |
75,623,232 | 10,159,065 | Dask explode function similar to pandas | <p>I have a dataframe that looks like this</p>
<pre><code>import numpy as np
import pandas as pd
df = pd.DataFrame({"ph_number" : ['1234','2345','1234','1234','2345','1234','2345'],
"year": [2022,2022,2023,2022,2022,2022,2022],
"month": [9,10,1,10,8... | <python><pandas><numpy><dask><dask-dataframe> | 2023-03-03 04:42:40 | 0 | 448 | Aayush Gupta |
75,623,112 | 139,150 | Run a script quickly from second time onward | <p>I have a python script that takes a lot of time to complete.
The line that takes most of the time is:</p>
<pre><code>ndf['embeddings'] = ndf['embeddings'].apply(ast.literal_eval)
</code></pre>
<p>Is there any way to pickle the results so that I will have to wait only for the first time?</p>
| <python><pandas> | 2023-03-03 04:16:01 | 1 | 32,554 | shantanuo |
75,622,901 | 512,251 | Return the value in case of pickle serialization exception instead of failing the whole call | <pre class="lang-py prettyprint-override"><code>from dogpile.cache import make_region
TIMEOUT_SECONDS = 10 * 60
def my_key_generator(namespace, fn):
fname = fn.__name__
def generate_key(*arg):
key_template = fname + "_" + "_".join(str(s) for s in arg)
return key_template
... | <python><pickle><dogpile.cache> | 2023-03-03 03:26:26 | 0 | 5,441 | user |
75,622,700 | 5,203,117 | How to work with a boolean conditional in a pandas dataframe | <p>I have a pandas data frame (df) with an index of dates and 1,000 rows. A row looks like this:</p>
<pre><code>SPY 262.408051
shrtAvg 262.861718
signal True
Name: 2019-03-22 00:00:00, dtype: object
</code></pre>
<p>I would like to do a calculation to create a new column based on df.signal ... | <python><pandas> | 2023-03-03 02:38:28 | 1 | 597 | John |
75,622,650 | 5,855,996 | dbt Python Incremental Models | <p>I’m really excited to be able to use Python models in dbt, but I’ve been running into issues with incremental ones.</p>
<p>If I have a working model with <code>materialized = "table"</code> and I change it to <code>materialized = "incremental"</code>, shouldn’t that work fine even before adding i... | <python><google-bigquery><dbt> | 2023-03-03 02:27:22 | 1 | 1,193 | Ricky |
75,622,588 | 18,086,775 | Rename columns based on certain pattern | <p>I have the following columns in a dataframe: <code>Id, category2, Brandyqdy1, Brandyqwdwdy2, Brandyqdw3</code></p>
<p>If the column's name starts with <code>Brand</code> and ends with <code>1</code>, I need it renamed as <code>Vans</code>. Similarly, for other Brand columns, use the following:
<code>rename_brands = ... | <python><pandas><dataframe> | 2023-03-03 02:10:33 | 2 | 379 | M J |
75,622,347 | 6,622,544 | lxml - ValueError: Namespace ... of name ... is not declared in scope | <p>When calling <code>lxml.etree.canonicalize(node)</code> a ValueError exception is raised: Namespace "{<uri>}" of name "<name>" is not declared in scope.</p>
<p>In this particular case the message is <code>ValueError: Namespace "http://schemas.xmlsoap.org/soap/envelope/" of n... | <python><xml><lxml><canonicalization> | 2023-03-03 01:14:00 | 0 | 1,068 | Adan Cortes |
75,622,270 | 4,508,962 | Can't get rid of mypy error about wrong type numpy.bool_ and bool | <p>I have a classe containing several <code>np.array</code> :</p>
<pre><code>class VECMParams(ModelParams):
def __init__(
self,
ecm_gamma: np.ndarray,
ecm_mu: Optional[np.ndarray],
ecm_lambda: np.ndarray,
ecm_beta: np.ndarray,
intercept_coint: bool,
):
sel... | <python><numpy><mypy> | 2023-03-03 00:57:08 | 1 | 1,207 | Jerem Lachkar |
75,622,228 | 9,087,739 | Mark a task as a success on callback on intentional failure | <p>In Airflow 2.3.4, I have a task I am intentionally failing and when it fails I want to mark it as a success
in the callback but the below does not work.,</p>
<pre><code>def intentional_failure():
raise AirflowException("this is a dummy failure")
def handle_failure(context):
context['task_instanc... | <python><airflow> | 2023-03-03 00:46:59 | 1 | 1,481 | Paul |
75,622,174 | 18,086,775 | Select dataframe columns that starts with certain string and additional columns | <p>I have a dataframe with columns: <code>'Id', 'Category', 'Shop', ....., 'Brandtxsu1', 'Brandxyw2', ...</code></p>
<p>I want to select columns: <code>ID</code>, <code>Category</code>, and start with <code>Brand</code>. I can select the columns that start with <code>Brand</code> using the following code, but how do I ... | <python><pandas><dataframe> | 2023-03-03 00:39:18 | 4 | 379 | M J |
75,622,123 | 13,067,104 | How to delete specific print statments in Jupyter Interactive Terminal | <p>I am trying to run parallel processes where at the start of each process, it would print start, and then print done when that process finishes. For example</p>
<pre><code>def process(i):
print('starting process number %s' %i)
... do something ...
print('finished process number %s' %i)
return
</... | <python><python-3.x><parallel-processing><jupyter> | 2023-03-03 00:28:40 | 0 | 403 | patrick7 |
75,622,107 | 14,005,384 | CSV with double quotes and separated by comma and space | <p>I have a .csv file with all values in double quotes, all values separated by a comma and space, and column headers are in the first row:</p>
<pre><code>"Exam date", "Last name", "First name", "DOB", "MRN"
"01/15/2019", "JOHN", "DOE", &qu... | <python><pandas><dataframe><csv> | 2023-03-03 00:25:09 | 2 | 455 | hoomant |
75,622,028 | 3,561 | Using numpy, what is a good way to index into a matrix using another matrix whose entry values are column numbers? | <p>Suppose I want to indepedently re-order each row of a matrix. Here is an example of that using <code>np.argsort()</code>:</p>
<pre><code>>>> A
array([[88, 44, 77, 33, 77],
[33, 55, 66, 88, 0],
[88, 0, 0, 55, 88],
[ 0, 22, 44, 88, 33],
[33, 33, 77, 66, 66]])
>>> ind =... | <python><numpy><numpy-slicing><matrix-indexing> | 2023-03-03 00:10:18 | 1 | 28,924 | Tyler |
75,621,922 | 6,403,044 | Didnt get the expected results when calculate Cosine similarity between strings | <p>I want to calculate the pairwise cosine similarity between two strings that are in the same row of a pandas data frame.</p>
<p>I used the following lines of codes:</p>
<pre><code>import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectoriz... | <python><pandas><scikit-learn><nlp><cosine-similarity> | 2023-03-02 23:46:28 | 1 | 1,012 | student_R123 |
75,621,882 | 5,431,734 | making a cross-platform environment.yml | <p>I have written a python application in Linux and I want to export the <code>environment.yml</code> file so that users can recreate the environment in either Linux or Windows. The command I run is:</p>
<pre><code>conda env export --from-history > environment.yml
</code></pre>
<p>However a couple of the dependenci... | <python><conda> | 2023-03-02 23:39:58 | 0 | 3,725 | Aenaon |
75,621,711 | 14,729,820 | How to update Data frame based on specific condition? by dropping not exist directory with Pandas | <p>I have dataframe with <em>missing images</em> in <code>images dir</code> that contians <code>labels </code>data with 2 columns (<code>file_name,text</code>) after reading <code>labels.txt</code> file , My working directory look like :</p>
<pre><code>$ tree
.
├── sample
│ ├------- labels.txt
│ │------- imgs
│ ... | <python><pandas><dataframe><text><pytorch> | 2023-03-02 23:12:10 | 1 | 366 | Mohammed |
75,621,693 | 6,672,422 | Python - How to extract values from different list of dictionaries in the rows of the dataframe | <p>I have data frame as like <code>df</code>:</p>
<pre><code> id features
100 [{'city': 'Rio'}, {'destination': '2'}]
110 [{'city': 'Sao Paulo'}]
135 [{'city': 'Recife'}, {'destination': '45'}]
145 [{'city': 'Munich'}, {'destination': ... | <python><pandas><group-by><pandas-explode> | 2023-03-02 23:09:21 | 3 | 568 | Cindy |
75,621,689 | 1,039,860 | How to select single item (not row) from a tkinter treeview and grid | <p>I have this code (which I unabashedly stole from here:<a href="https://www.pythontutorial.net/tkinter/tkinter-treeview/" rel="nofollow noreferrer">https://www.pythontutorial.net/tkinter/tkinter-treeview/</a>):</p>
<pre><code>import tkinter as tk
from tkinter import ttk
from tkinter.messagebox import showinfo
root =... | <python><tkinter><grid><treeview> | 2023-03-02 23:08:19 | 1 | 1,116 | jordanthompson |
75,621,404 | 1,711,271 | how can I select all columns of a dataframe, which partially match strings in a list? | <p>Suppose I have a Dataframe like:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
df = pd.DataFrame({'foo': [1, 2, 3], 'bar': [4, 5, 6], 'ber': [7, 8, 9]})
</code></pre>
<p>Given a list of "filter" strings like <code>mylist = ['oo', 'ba']</code>, how can I select all columns in <cod... | <python><pandas><string-matching> | 2023-03-02 22:26:12 | 1 | 5,726 | DeltaIV |
75,621,164 | 2,088,027 | Merge a large dictionary into a single dataframe | <p>I have a dictionary.</p>
<pre><code>import pandas as pd
d = {
'A':pd.DataFrame(
{'Age' : [5,5,5],
'Weight' : [5,5,5]}),
'B':pd.DataFrame(
{'Age' : [10,10,10],
'Weight' : [10,10,10]}),
'C':pd.DataFrame(
{'Age' : [7,7,7],
'Weight' : [10,10,100]}),
}... | <python><pandas> | 2023-03-02 21:51:42 | 4 | 2,014 | kevin |
75,621,157 | 500,343 | Mutable NamedTuple in python | <p>I'm looking for a good struct pattern in python. The <code>NamedTuple</code> class constructor is <em>almost</em> what I want. Consider the following:</p>
<pre class="lang-py prettyprint-override"><code>class MyStruct(NamedTuple):
prop1: str
prop2: str
prop3: Optional[str] = "prop3" # should allow de... | <python><python-3.x><types> | 2023-03-02 21:50:31 | 2 | 1,907 | CaptainStiggz |
75,621,102 | 9,352,430 | Pyspark dot product of a DF and a dictionary | <p>I'd like to have a dot product of a DF (multiple columns) and a dictionary with keys matching some of the column names and values that should be used as weights. Here is an example:</p>
<pre><code>dic = {'SG_actions': 1, 'SO_actions': 2, 'GS_actions': 3}
</code></pre>
<p>df =</p>
<pre><code>_________________________... | <python><pyspark> | 2023-03-02 21:43:42 | 1 | 339 | Sad Vaseb |
75,620,990 | 8,194,364 | Running into selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: when trying to click a button | <p>I am trying to webscrape Balance Sheet data from Yahoo finance (<a href="https://finance.yahoo.com/quote/MSFT/balance-sheet?p=MSFT" rel="nofollow noreferrer">https://finance.yahoo.com/quote/MSFT/balance-sheet?p=MSFT</a>). Specifically, the Current Assets, Total Non Current Assets, Total Non Current Liabilities Net M... | <python><selenium-webdriver><selenium-chromedriver> | 2023-03-02 21:28:15 | 1 | 359 | AJ Goudel |
75,620,896 | 2,908,017 | How do I get a list of all components on a Form in a Python FMX GUI App | <p>I have a <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI App</a> with a couple of components created on a <code>Form</code>:</p>
<pre><code>self.imgDirt = Image(self)
self.btnLoad = Button(self)
self.btnSave = Button(self)
self.memDirt = Memo(self)
self.lblTitle = La... | <python><user-interface><firemonkey> | 2023-03-02 21:14:35 | 1 | 4,263 | Shaun Roselt |
75,620,822 | 16,363,897 | Replace values based on column names and other dataframe | <p>Let's say we have the following "cities" dataframe with cities as column names:</p>
<pre><code> NY LA Rome London Milan
date
2023-01-01 1 81 26 55 95
2023-01-02 92 42 96 98 7
2023-01-03 14 4 60 88 73
</code></pre... | <python><pandas><dataframe> | 2023-03-02 21:05:28 | 2 | 842 | younggotti |
75,620,575 | 18,086,775 | Check if a substring is present in a string variable that may be set to None | <p>I have a string named brand that can be <code>None</code> or contain a value. How can I search for a substring within it when it is <code>None</code>?</p>
<p>By putting an additional if-statement to check if the brand is for <code>None</code> before searching the substring works, but is there a better way?</p>
<pre>... | <python><string> | 2023-03-02 20:37:00 | 3 | 379 | M J |
75,620,559 | 3,878,398 | passing a csv through an API | <p>I'm trying to pass a csv through an api like this:</p>
<p>The csv is as follow:</p>
<pre><code>field_1, field_2, field_3
1, 3, 7
</code></pre>
<p>the push code is this:</p>
<pre><code>with open("sample_csv.csv") as f:
data = {"file": f}
print(data)
headers = {
"Content-Ty... | <python><csv><aws-lambda> | 2023-03-02 20:35:26 | 1 | 351 | OctaveParango |
75,620,520 | 14,790,056 | How to do some complicated row operations | <p>I have the following swap transaction data. You can see that one transaction hash includes many transfers. Here, the contract initiator is <code>from_address</code> when <code>data = trace</code>. So whoever sends 0 to <code>0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7</code> this pool. I want to basically filter out ... | <python><pandas><dataframe> | 2023-03-02 20:30:47 | 0 | 654 | Olive |
75,620,512 | 7,586,785 | How can I update the contents of a list, dictionary, or dataframe while making several asyncronous calls? | <p>I am building a DataFrame (pandas) that contains some information inside of it. At some point, once the DataFrame is completed, I need to perform some calculations on each DataFrame.</p>
<p>Currently, you can say that is looks something like this:</p>
<pre class="lang-py prettyprint-override"><code>def perform_calcu... | <python><dataframe><asynchronous><python-asyncio><aiohttp> | 2023-03-02 20:30:16 | 1 | 3,806 | John Lexus |
75,620,398 | 14,649,706 | Live OpenCV window capture (screenshot) on macOS (Darwin) using Python | <p>I am following a tutorial on Open CV and trying to rewrite the following code:
<a href="https://github.com/learncodebygaming/opencv_tutorials/tree/master/005_real_time" rel="nofollow noreferrer">https://github.com/learncodebygaming/opencv_tutorials/tree/master/005_real_time</a></p>
<p>(specifically, the <a href="htt... | <python><opencv><core-graphics><apple-m1><darwin> | 2023-03-02 20:15:28 | 1 | 1,942 | nopassport1 |
75,620,269 | 15,569,921 | Fitted regression line parameters in python | <p>How can I get the intercept and the slope of the fitted regression line in <code>qqplot</code>? Here's a small working example, where I want the parameters of the red regression line:</p>
<pre><code>import statsmodels.api as sm
import scipy.stats as stats
import numpy as np
np.random.seed(100)
a = np.random.normal(... | <python><plot><linear-regression><statsmodels> | 2023-03-02 19:58:42 | 2 | 390 | statwoman |
75,619,993 | 8,084,131 | How can i convert from 03MAR23 format to yyyy-mm-dd in python | <p>I wanted to convert from 03FEB23 format to yyyy-mm-dd in python
how can I do it?</p>
<p>Use the below code:</p>
<pre><code>from pyspark.sql.functions import *
df=spark.createDataFrame([["1"]],["id"])
df.select(current_date().alias("current_date"), \
date_format("03MAR23"... | <python><dataframe><pyspark> | 2023-03-02 19:25:55 | 2 | 585 | Data_Insight |
75,619,953 | 5,108,517 | Group Pandas DataFrame by multiple columns with connected IDs | <p>I have a dataframe which contains several ids in various columns. Some of those IDs are missing or could be duplicated. The goal is to group the DataFrame by those ids and keep properties in a list.</p>
<p>To show an example that I would like to get:</p>
<pre><code>import pandas as pd
# initialize data of lists.
... | <python><pandas><dataframe><grouping> | 2023-03-02 19:19:11 | 1 | 3,639 | 0ndre_ |
75,619,925 | 19,381,612 | How to Randomly generate a new list of items but not select previous item that has been selected? | <p>I'm creating some new algorithms for my project (Food App Generator) and I run into this problem of generating random new list from a pre-set dictionary of amount of same item I want to appear through out a week while not allowing the previous item to be the same.</p>
<p>Down below dictionary specifies food and amou... | <python><python-3.x><list><dictionary> | 2023-03-02 19:16:19 | 1 | 1,124 | ThisQRequiresASpecialist |
75,619,881 | 9,536,233 | Why is my while loop not getting broken when condition is met within try-except statement? | <p>I have some code which I would like to run into infinity unless a specific condition has been met. Within a try-except statement this condition is actually met and therefore I assumed the while loop would be broken, but apparently this is not the case. I am not sure why this does not break the while loop. Is try exc... | <python><while-loop><conditional-statements><try-except> | 2023-03-02 19:10:22 | 1 | 799 | Rivered |
75,619,875 | 5,235,665 | Dynamically renaming Pandas DataFrame columns based on configurable mapping | <p>Python/Pandas here. I have 2 Excel files. In CSV form they look like:</p>
<h4>mappings.xlsx (as a csv)</h4>
<pre><code>Id,Standard,FieldName
1,'Animal','Pet'
2,'Color','Clr'
3,'Food','Snack'
</code></pre>
<h4>info.xslx (as a csv)</h4>
<pre><code>Pet,Clr,Snack
Dog,Blue,Pizza
Cat,Purple,French Fries
</code></pre>
<p>I... | <python><excel><pandas> | 2023-03-02 19:09:37 | 1 | 845 | hotmeatballsoup |
75,619,857 | 12,484,740 | Storing Eigen::Ref from numpy through pybind inside c++ fails | <p>I have a maybe stupid question concering storing a reference of a numpy object in a c++ class. I have the following MVE code:</p>
<pre class="lang-cpp prettyprint-override"><code>template<typename VecType= Eigen::Ref<Eigen::VectorXd>>
struct A
{
void insert(VecType& val)
{
std::cout<<&q... | <python><c++><eigen3><pybind11> | 2023-03-02 19:08:01 | 0 | 327 | rath3t |
75,619,843 | 2,908,017 | How to add a right-click context menu to your controls in a Python FMX GUI App? | <p>I've made a <code>Form</code> with an <code>Image</code> using the <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI Library for Python</a>, but what I want now is a right-click context menu on the image. When I right-click on the image, then it should bring up a conte... | <python><user-interface><contextmenu><firemonkey><popupmenu> | 2023-03-02 19:06:40 | 1 | 4,263 | Shaun Roselt |
75,619,739 | 4,149,611 | Quicker Iteration in python through a big list | <p>I am trying to scan a list of 100,000,000 (list1) strings and match it with another list(list2).
List 1 can have upto 10 million rows.
If the contents of list2 are in list1 I am flagging those values in a counter and storing the result in a third list. So my lists are somewhat like this :</p>
<p>list1</p>
<pre><code... | <python><pandas><numpy> | 2023-03-02 18:55:00 | 1 | 780 | Aritra Bhattacharya |
75,619,729 | 5,235,665 | Validating Pandas DataFrame columns and cell values | <p>I have the following table <code>cmf_data</code> (here's the DDL I used to create it):</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TABLE mydb.cmf_data (
cmf_data_id int IDENTITY(1,1) NOT NULL,
cmf_data_field_name varchar(MAX) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
cmf_data_field_d... | <python><pandas><dataframe><validation><types> | 2023-03-02 18:53:51 | 3 | 845 | hotmeatballsoup |
75,619,513 | 7,168,098 | changing and setting one level of a multiindex dataframe with a function | <p>Assuming a multiindex dataframe as follows</p>
<p><strong>THE (DUMMY) DATA</strong></p>
<pre><code>import pandas as pd
df={('AB30566', 'ACTIVE1', 'A1'): {('2021-01-01', 'PHOTO'): 2,
('2021-01-01', 'QUE'): 8,
('2021-01-01', 'TXR'): 4,
('2022-02-01', 'PHOTO'): 4,
('2022-02-01', 'QUE'): 0,
('2022-02-01', 'TXR'): ... | <python><pandas><multi-index> | 2023-03-02 18:30:12 | 3 | 3,553 | JFerro |
75,619,360 | 8,519,380 | Change scrapy settings via api | <p>I use scrapy and scrapyd and send some custom settings via api (with Postman software).
<br>Photo of the request:
<a href="https://i.sstatic.net/lj31M.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lj31M.png" alt="enter image description here" /></a></p>
<p>For example, I send the value of <code>star... | <python><scrapy><web-crawler><scrapyd> | 2023-03-02 18:13:45 | 2 | 778 | Sardar |
75,619,335 | 6,534,818 | Pandas -- reset a group by counter | <p>This solution does not work for me <a href="https://stackoverflow.com/questions/69982638/count-cumulative-true-value;">Count cumulative true Value</a> I explicitly need to group by <code>id</code> <strong>and</strong> <code>consecBool</code>; the above assumes a homogenous data set with no distinct groups</p>
<p>How... | <python><pandas> | 2023-03-02 18:09:55 | 1 | 1,859 | John Stud |
75,619,328 | 14,159,985 | How to apply a function to multiple PySpark dataframes in parallel | <p>I'm kinda new to pyspark and I'm trying to construct a datawarehouse with it. So baiscally I've a lot o dataframes where I need to apply the same function to all of them. I made a simple version of my code to you to undestand what I mean. My simple code looks like this:</p>
<pre><code>df_list = [spark.createDataFram... | <python><pyspark><parallel-processing> | 2023-03-02 18:09:44 | 1 | 338 | fernando fincatti |
75,619,222 | 7,200,745 | How to specify path to a local reposiory in .pre-commit-config.yaml? | <p>I have a local package <code>B</code> which depends on another local package <code>A</code>. They both are stored in a company repository: <code>https://mycompany.com/api/pypi/pypi-bld/simple</code>. Therefore, tests of <code>B</code> requires <code>A</code>.</p>
<p>I need to use pre-commit which uses both the comp... | <python><pip><virtualenv><pre-commit><pre-commit.com> | 2023-03-02 17:58:58 | 0 | 444 | Eugene W. |
75,619,153 | 21,313,539 | Bulk Indexing Error in Elastic search Python | <p>I am trying to ingest a simple Hello World example into a Data Stream using the Bulk call as shown in documemtation <a href="https://elasticsearch-py.readthedocs.io/en/v8.6.2/helpers.html#bulk-helpers" rel="nofollow noreferrer">https://elasticsearch-py.readthedocs.io/en/v8.6.2/helpers.html#bulk-helpers</a></p>
<pre>... | <python><elasticsearch><indexing><kibana><bulkinsert> | 2023-03-02 17:53:03 | 1 | 471 | lat |
75,619,137 | 7,516,523 | Get subset of DataFrame where certain columns meet certain criteria | <p>How can I cleanly make a subset of my DataFrame, where my desired columns meet certain criteria?</p>
<p>Take the following <strong><code>DataFrame</code></strong> as an example:</p>
<pre><code>df = pd.DataFrame(data=[[0, 1, 2],
[2, 3, 4],
[4, 5, 6],
... | <python><pandas><dataframe><filter><mask> | 2023-03-02 17:51:51 | 1 | 345 | Florent H |
75,619,103 | 5,235,665 | Filtering S3 shared key (subfolder) for specific file type in boto3 | <p>Python/boto3 here. I have an S3 bucket with several "subfolders", and in one of these "subfolders" (yes I know there's no such thing in S3, but when you look at the layout below you'll understand) I have several dozen files, 0+ of which will be Excel (XLSX) files. Here's what my bucket looks like... | <python><amazon-s3><boto3> | 2023-03-02 17:49:06 | 1 | 845 | hotmeatballsoup |
75,619,035 | 3,973,269 | Three docker containers with python image get mixed up in docker compose | <p>I have a docker-compose.yml file in which I have three services, each being a python script that needs to be executed.</p>
<p>Each service has a dockerfile</p>
<ul>
<li>Dockerfile.scriptA</li>
<li>Dockerfile.scriptB</li>
<li>Dockerfile.scriptC</li>
</ul>
<p>In a folder called "python_tools" I have three su... | <python><docker><docker-compose> | 2023-03-02 17:42:00 | 1 | 569 | Mart |
75,618,991 | 9,681,081 | Azure WebsiteManagementClient for Python: how to get web app by ID? | <p>I'm using version 7.0.0 of <code>azure-mgmt-web</code> for Python. I know we can fetch a site with:</p>
<pre class="lang-py prettyprint-override"><code>from azure.mgmt.web import WebSiteManagementClient
web_client = WebSiteManagementClient(...credentials here...)
site = web_client.web_apps.get(RESOURCE_GROUP_NAME, ... | <python><azure><azure-management-api> | 2023-03-02 17:37:39 | 1 | 2,273 | Roméo Després |
75,618,983 | 5,924,264 | How to extract only non-empty deques in dict where key-value pair is int - collections.deque pairs | <p>I have a <code>dict</code> of <code>collection.deque</code> objects, <code>dqs</code>, where the key is some integer <code>id</code>. I would like to create another <code>dict</code> that only has the entries in <code>dqs</code> where the deque is non-empty.</p>
<p>Is there a quick way to do this without iterating t... | <python><dictionary><vectorization><deque> | 2023-03-02 17:36:47 | 1 | 2,502 | roulette01 |
75,618,919 | 2,341,285 | Build SymPy matrix by alternating rows of two square matrices | <p>I have two square NxN matrices in SymPy. Lets say</p>
<pre class="lang-py prettyprint-override"><code>from sympy import Matrix
x = Matrix([[1,2],
[3,4]])
y = Matrix([[5,6],
[7,8]])
</code></pre>
<p>What is the best way of creating a new 2NxN matrix which alternates rows to generate the fol... | <python><matrix><sympy> | 2023-03-02 17:29:53 | 3 | 609 | Darko |
75,618,890 | 2,908,017 | How to close a Python FMX GUI App with a button click? | <p>Is there a built-in function for closing the app via code?</p>
<p>How would I close the app via code instead of clicking on the closing button in the title bar?</p>
<p>I'm using <a href="https://github.com/Embarcadero/DelphiFMX4Python" rel="nofollow noreferrer">DelphiFMX GUI Library for Python</a></p>
| <python><firemonkey> | 2023-03-02 17:26:26 | 1 | 4,263 | Shaun Roselt |
75,618,743 | 1,169,091 | Why do the title and x label not print in the graph? | <p>This code generates a plot but the title and the x label do not appear.</p>
<pre><code>normalDistribution = np.random.normal(loc = 0.0, scale = 1.0, size = totalPoints)
rows = 4
columns = 5
fig = plt.figure(figsize =(24, 24))
plt.subplots_adjust(wspace=0.3, hspace=0.4) # to adjust the spacing between subplots
plt.su... | <python><matplotlib> | 2023-03-02 17:13:11 | 3 | 4,741 | nicomp |
75,618,498 | 8,953,248 | How to test linear independence of boolean array in a pythonic way? | <p>The rows of this matrix are <em>not</em> linearly independent, as the first two rows can be added (or XORed) to produce the third:</p>
<pre><code>matrix = [
[ 1, 0, 0, 1 ],
[ 0, 0, 1, 0 ],
[ 1, 0, 1, 1 ],
[ 1, 1, 0, 1 ]
]
</code></pre>
<p>One could do brute-force reduction of the rows, with deeply ne... | <python><algorithm><matrix><independent-set> | 2023-03-02 16:50:25 | 2 | 618 | Ray Butterworth |
75,618,380 | 19,130,803 | Type hint redis function python | <p>I tried different ways to type annotate the redis object and its method as below</p>
<pre><code>foo.py
redis_instance: Any = redis.StrictRedis.from_url(url=REDIS_DB_URL, decode_responses=False)
</code></pre>
<pre><code>config.py
REDIS_DB_URL: str | None = os.environ.get("REDIS_DB_URL")
</code></pre>
<pre><... | <python><redis> | 2023-03-02 16:39:47 | 0 | 962 | winter |
75,618,364 | 1,302,551 | Why does ~True = -2 in python? | <p>I am completely perplexed. We came across a bug, which we easily fixed, but we are perplexed as to why the value the bug was generating created the output it did. Specifically:</p>
<p>Why does <code>~True</code> equal <code>-2</code> in python?</p>
<pre><code>~True
>> -2
</code></pre>
<p>Shouldn't the bitwis... | <python><python-3.x> | 2023-03-02 16:38:02 | 2 | 1,356 | WolVes |
75,618,005 | 13,696,853 | wandb — ImportError | <p>I've successfully installed wandb on a Linux system, however, I run into an error when I try importing it.</p>
<pre><code>>>> import wandb
[...]
ImportError: [PATH]/.local/lib/python3.8/site-packages/google/protobuf/pyext/_message.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN4absl12lts_2023012512log... | <python><importerror> | 2023-03-02 16:07:38 | 0 | 321 | Raiyan Chowdhury |
75,617,995 | 2,005,869 | dask client.scatter command hanging | <p>I have a 4-band raster image (NAIP imagery) and another raster obtained by the scipy SLIC algorithm containing integers that indicates the segmentation on that image.</p>
<p>The next step in the workflow is calculate statistics for all the pixels in a segment, and there are 300,000+ segments, so I'm trying to parall... | <python><dask> | 2023-03-02 16:06:58 | 1 | 16,655 | Rich Signell |
75,617,926 | 9,754,418 | Failed to launch app from custom SageMaker image: ResourceNotFoundError with UID/GID in AppImageConfig | <p>I'm trying to create a <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/studio-byoi-create.html" rel="nofollow noreferrer">custom SageMaker image</a> and launch a kernel from it, because I want to see if I can use black, the python code formatter, in <a href="https://github.com/psf/black" rel="nofollow noref... | <python><docker><jupyter><amazon-sagemaker-studio> | 2023-03-02 16:00:57 | 2 | 1,238 | Yann Stoneman |
75,617,865 | 17,034,564 | OpenAI Chat Completions API error: "InvalidRequestError: Unrecognized request argument supplied: messages" | <p>I am currently trying to use OpenAI's most recent model: <code>gpt-3.5-turbo</code>. I am following a very <a href="https://www.youtube.com/watch?v=0l4UDn1p7gM&ab_channel=TinkeringwithDeepLearning%26AI" rel="noreferrer">basic tutorial</a>.</p>
<p>I am working from a Google Collab notebook. I have to make a reque... | <python><openai-api><chatgpt-api> | 2023-03-02 15:55:35 | 4 | 678 | corvusMidnight |
75,617,852 | 7,700,300 | Weird behaviour in Pyspark dataframe | <p>I have the following pyspark dataframe that contains two fields, ID and QUARTER:</p>
<pre class="lang-py prettyprint-override"><code>pandas_df = pd.DataFrame({"ID":[1, 2, 3,4, 5, 3,5,6,3,7,2,6,8,9,1,7,5,1,10],"QUARTER":[1, 1, 1, 1, 1,2,2,2,3,3,3,3,3,4,4,5,5,5,5]})
spark_df = spark.createDataFrame... | <python><apache-spark><pyspark><union><pyspark-schema> | 2023-03-02 15:54:44 | 1 | 325 | Abdessamad139 |
75,617,816 | 1,443,702 | Add decorator for python requests get function | <p>I was looking for a way to add some sort of decorator that applies to all instances of <code>requests.get</code> being used in any function.</p>
<p>For example,</p>
<pre><code>@my_custom_decorator
def hello():
...
r = requests.get('https://my-api-url')
...
</code></pre>
<p>The <code>my_custom_decorator<... | <python><http><python-requests> | 2023-03-02 15:51:22 | 8 | 4,726 | xan |
75,617,776 | 1,208,142 | Best practice with Pandas to calculate differences between dates according to categories | <p>I'm trying to sort differences between values grouped by dates and categories in a Pandas DataFrame. At the end, what matters is the name of the categories with the lowest and highest increases between the two dates, and the corresponding increases.</p>
<p>I think my code works, but it looks over complicated. I woul... | <python><pandas><dataframe> | 2023-03-02 15:47:58 | 1 | 5,347 | Lucien S. |
75,617,688 | 13,460,543 | How to select rows in a dataframe based on a string customers list? | <p>I have a <strong>first</strong> dataframe containing bills and in this dataframe a column named <code>contents</code> contains customers names inside a no formatted / standardized string, like this :</p>
<pre><code> NUMBIL DATE CONTENTS AMOUNT
0 858 01/01/23 B... | <python><pandas><dataframe><csv> | 2023-03-02 15:40:39 | 3 | 2,303 | Laurent B. |
75,617,532 | 14,735,451 | How to replace all string patterns except for one? | <p>I have a string and a pattern that I'm trying to replace:</p>
<pre><code>my_string = "this is my string, it has [012] numbers and [1123] other things, like [2] cookies"
# pattern = all numbers between the brackets, and the brackets
</code></pre>
<p>I want to replace all of those patterns except for one wi... | <python><string><replace> | 2023-03-02 15:27:16 | 2 | 2,641 | Penguin |
75,617,527 | 6,439,229 | Why do similar signal/slot connections behave differently after Pyqt5 to PySide6 port | <p>I'm porting a pyqt5 GUI to pyside6 and I'm running into an issue I don't understand.</p>
<p>I have two QSpinboxes that control two GUI parameters:
One spinbox controls the weight of a splitter,
the other controls the row height in a QtableView.</p>
<p>This is the code in pyqt5:</p>
<pre><code>spinbox1.valueChanged.c... | <python><qt><pyqt5><pyside6> | 2023-03-02 15:27:01 | 2 | 1,016 | mahkitah |
75,617,516 | 2,947,469 | Numba how to use dict in a class | <p>as specified below, the dict should have keys 2-tuples of int and values ints.</p>
<pre><code>from numba.experimental import jitclass
import numba
@jitclass({'shape': numba.types.Tuple((numba.int32, numba.int32)), 'dict': numba.types.DictType(numba.types.UniTuple(numba.types.int32, 2), numba.int32)})
class BigramCo... | <python><numba> | 2023-03-02 15:25:55 | 1 | 1,827 | Adam |
75,617,502 | 13,174,189 | How to turn list into nested in a specific way? | <p>I have a list: <code>["a", "b", "c", "d", "e", "f", "g"]</code>. I want to make it nested and put in sublists of two consecutive values from the given list. if there are no two values left, then one value should go to the sublist. so desired r... | <python><python-3.x><list><function> | 2023-03-02 15:24:46 | 4 | 1,199 | french_fries |
75,617,394 | 19,003,861 | How to customise Folium html popups in a for loop in python using .format()? | <p>I am trying to change the standard <code>popups</code> provided with Folium and make these work with a <code>for loop</code>. I am using Django.</p>
<p>I succeeded on change the html, following a few tutorials.</p>
<p>However I am struggling to understand how to call the variables in the html.</p>
<p>Quite simply I ... | <python><django><django-views><django-templates><django-queryset> | 2023-03-02 15:14:33 | 1 | 415 | PhilM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.