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 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,037,288 | 4,994,337 | How does numpy.array choose default data type? | <p>The <code>numpy.array()</code> function seems to behave rather strangely when some numbers in the order of <code>2**64</code> are involved and no data type is specified. Can anyone explain this behavior? Is it a bug or is it expected?</p>
<pre><code>$ python3
Python 3.10.8 (main, Nov 30 2022, 10:05:23) [GCC 4.8.5 ... | <python><arrays><numpy><types> | 2023-09-04 11:19:47 | 1 | 579 | PieterNuyts |
77,037,112 | 12,415,855 | Text from dt-tag is not outputted? | <p>i try to get a text from a website using the following code:</p>
<pre><code>import time
import os
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
if __name__ == '__main__':
os.environ['WDM_LOG'... | <python><selenium-webdriver><beautifulsoup> | 2023-09-04 10:49:25 | 1 | 1,515 | Rapid1898 |
77,036,990 | 13,100,938 | How do you ensure Dataflow Pipeline synchronicity in Apache Beam? | <p>The Dataflow pipeline I've written ingests data that has been published synchronously. The order of this data does not matter, but it is published every second.</p>
<p>I need to output the result of the pipeline synchronously too, but at the moment I'm seeing inconsistent delays between the outputs of the pipeline.<... | <python><google-cloud-platform><google-cloud-firestore><google-cloud-dataflow><apache-beam> | 2023-09-04 10:32:37 | 0 | 2,023 | Joe Moore |
77,036,960 | 710,955 | How do I get the page URL of a wiki page with mwclient? | <p>I'm using <a href="https://github.com/mwclient/mwclient" rel="nofollow noreferrer">mwclient</a> and I want to get the URL of the page loaded.</p>
<pre><code>import mwclient
site = mwclient.Site('fr.wikipedia.org')
page = site.Pages['Curling aux Jeux olympiques de 2022']
</code></pre>
<p>Is it possible to get the url... | <python><wikipedia><wikipedia-api><mwclient> | 2023-09-04 10:27:52 | 0 | 5,809 | LeMoussel |
77,036,837 | 9,516,820 | How to select only certain div elements in a list of div elements with selenium | <p>I have a list of divs as follows</p>
<p><a href="https://i.sstatic.net/xIsGx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xIsGx.png" alt="enter image description here" /></a></p>
<p>From the list of divs given below, I only want to extract certain data from divs between <code>data-index=3</code> an... | <python><html><selenium-webdriver><xpath> | 2023-09-04 10:08:41 | 2 | 972 | Sashaank |
77,036,672 | 6,458,245 | Post-trained TransformerEncoder model is nondeterministic? | <p>I don't understand why running my model which is a single transformer encoder layer is deterministic but after I train it, it becomes non deterministic?</p>
<pre><code>import torch
from torch import nn
import torch.optim as optim
class MyModel(nn.Module):
def __init__(self):
super().__init__()
se... | <python><pytorch> | 2023-09-04 09:45:15 | 1 | 2,356 | JobHunter69 |
77,036,669 | 17,561,414 | Databricks Autoloader writing stream | <p>I have multiple tables (csv files per table) loaded in azure datalake and would like to use autoloader to load everytable in Databricks Delta table.</p>
<p>I have a python code where I use the <code>for loop</code> to create the schema per table, create the <code>df</code> and then <code>writeStream</code> the <code... | <python><for-loop><spark-streaming><azure-databricks><databricks-autoloader> | 2023-09-04 09:44:27 | 1 | 735 | Greencolor |
77,036,640 | 4,268,976 | Django Celery Beat Periodic Tasks Running Twice | <p>I trying to send scheduled emails to users but my Django celery periodic tasks running 2 times within a half-hour span. Every day I scheduled my email task at 7.00 AM but it is running 1st task at 7.00 AM and the same task is running at 7.30 AM also.</p>
<p>Here is my celery app</p>
<pre><code># coding=utf-8
from __... | <python><django><celery><django-celery><django-celery-beat> | 2023-09-04 09:40:16 | 0 | 4,122 | NIKHIL RANE |
77,036,411 | 22,496,572 | PyTorch matrix multiplication does not respect slicing | <p>I got to this by having to batch long inputs for transfomer models, noticing difference between batched and non-batched results. I finally isolated the first discrepancy I noticed, resulting in the following:</p>
<pre><code>import torch
n = 20
vec = torch.rand(n, 20)
a = torch.rand(30, 20)
for i in range(1, n+1):... | <python><pytorch><precision><huggingface-transformers><torch> | 2023-09-04 09:03:40 | 1 | 371 | Sasha |
77,036,406 | 1,652,219 | Pandas queries to SQL queries (Python equivalent to R's dplyr) | <h2>Question</h2>
<p>At my company people would like to build dataframe/table queries in Python as the Python syntax is often much more clear and easier to work with than SQL queries as you can chain together your operations.</p>
<p>In <strong>R</strong> it easy to translate between R dataframe operations and SQL becau... | <python><sql><pandas><dplyr><translate> | 2023-09-04 09:02:57 | 0 | 3,944 | Esben Eickhardt |
77,036,375 | 9,261,322 | When to call subprocess.communicate()? | <p>I run a process and read the first line from <code>stderr</code> and check exit code:</p>
<pre><code>import subprocess
p = subprocess.Popen(['time', '-p', 'ls'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(p.stderr.readline().decode('utf-8'))
streamdata = p.communicate()[0]
print(f'exitcode: {p.returncode}... | <python> | 2023-09-04 08:58:19 | 0 | 4,405 | Alexey Starinsky |
77,036,354 | 11,329,736 | Run command when creating Conda environment with Snakemake | <p>I am using <code>snakemake</code> to run a workflow. One of my rules uses the following <code>yaml</code> file to create the <code>Conda</code> env:</p>
<pre><code>name: macs2
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- macs2=2.2.9.1
- homer=4.11
</code></pre>
<p>For the <code>homer</cod... | <python><conda><snakemake><virtual-environment> | 2023-09-04 08:55:08 | 1 | 1,095 | justinian482 |
77,036,229 | 20,830,264 | trying to install label-studio with Python | <p>I'm trying to install label-studio library following the web-site information:
<a href="https://labelstud.io/guide/install" rel="nofollow noreferrer">enter link description here</a></p>
<p>In particular I'm using the following commands:</p>
<pre><code>pip install label-studio --user
</code></pre>
<p>The module is co... | <python><pip><python-venv><label-studio> | 2023-09-04 08:32:57 | 1 | 315 | Gregory |
77,036,214 | 535,009 | Running python Flask app with maven-like folder structure on Google Cloud Run | <p>How to configure Google Cloud Run to be able to run (via <code>gcloud run deploy</code>) a python Flask app with the following source code structure?</p>
<pre><code>root
│
├── src
│ └── app
│ └── main.py
│
├── Dockerfile
└── requirements.txt
</code></pre>
| <python><flask><google-cloud-run> | 2023-09-04 08:30:44 | 1 | 533 | St. |
77,036,213 | 8,278,075 | Make only one value to be a unique shape in Altair point graph? | <p>I'm using Altair to make a point graph where all the shapes are the same (circle) for each stock value except for one (let's say diamond).</p>
<p>In this dataset I want the stock symbol for "V" to be a unique shape.</p>
<pre class="lang-py prettyprint-override"><code>ratio_df = pd.DataFrame(data={
"... | <python><dataframe><altair> | 2023-09-04 08:30:33 | 1 | 3,365 | engineer-x |
77,036,059 | 12,415,855 | os.isdir not working on Mac after create executeable with pyinstaller? | <p>i try to check the existing files and folders using the following code:</p>
<pre><code>import os, sys
path = os.path.abspath(os.path.dirname(sys.argv[0]))
listFiles = [x for x in os.listdir(path)]
existDirs = [x for x in os.listdir(path) if os.path.isdir(x)]
print(path)
print(listFiles)
print(existDirs)
</code></... | <python><macos><pyinstaller> | 2023-09-04 08:04:37 | 1 | 1,515 | Rapid1898 |
77,035,987 | 5,953,720 | Why do I need to convert to_numpy() otherwise loc assignment does not work? | <p>I am using <a href="https://github.com/subashgandyer/datasets/blob/main/Real%20estate.csv" rel="nofollow noreferrer">this csv</a>.</p>
<pre><code>import pandas as pd
import numpy as np
real_estate = pd.read_csv('real_estate.csv',index_col=0)
buckets = pd.cut(real_estate['X2 house age'],4,labels=False)
for i in ra... | <python><pandas><numpy><categorization><discretization> | 2023-09-04 07:54:09 | 2 | 1,517 | Allexj |
77,035,955 | 8,930,751 | Find the first occurrence of the specific attribute in list of dictionaries - python | <p>I have a similar dataset</p>
<pre><code>dataset = [
{
'Country': 'GB',
'Pollutant': 'SO2',
'Pollution': 10
},
{
'Country': 'AL',
'Pollutant': 'O3',
'Pollution': 10,
'Year': 2015
},
{
'Country': 'BE',
'Pollutant': 'SO2',
... | <python><python-3.x><dictionary><iterator> | 2023-09-04 07:48:35 | 6 | 2,416 | CrazyCoder |
77,035,950 | 2,066,215 | Segmentation fault opening Calc spreadsheet | <p>I need to crunch a Calc spreadsheet composed of many individual sheets. The Wiki has a detailed <a href="https://wiki.documentfoundation.org/Macros/Python_Guide/Documents#Open" rel="nofollow noreferrer">Python guide</a> that I am following. I installed the <code>libreoffice-script-provider-python</code> package and ... | <python><libreoffice><libreoffice-calc><uno><pyuno> | 2023-09-04 07:46:50 | 1 | 7,000 | Luís de Sousa |
77,035,931 | 9,261,322 | Strange garbage in subprocess.stderr | <p>Why does the following Python script</p>
<pre><code>import subprocess
p = subprocess.Popen(['time', 'ls'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(p.stderr.readline().decode('utf-8'))
</code></pre>
<p>outputs the following:</p>
<pre><code>0.00user 0.00system 0:00.00elapsed 91%CPU (0avgtext+0avgdata 226... | <python><python-3.x><ubuntu> | 2023-09-04 07:43:13 | 1 | 4,405 | Alexey Starinsky |
77,035,785 | 12,000,021 | Problem with the initial value in optimization problem | <p>I have formulated the following problem that tries to minimize the cost of imported energy by controlling a battery:</p>
<pre><code>import pyomo.environ as pyo
def self_consumption(pv, demand, prices):
pv.index = np.arange(1, len(pv) + 1)
demand.index = np.arange(1, len(demand) + 1)
prices.index = np.a... | <python><optimization><pyomo> | 2023-09-04 07:21:13 | 1 | 428 | Kosmylo |
77,035,775 | 8,353,711 | How to set default value of nested pydantic schema field | <p>I was trying to set the default value to the nested field of Pydantic model(generated by <a href="https://koxudaxi.github.io/datamodel-code-generator/" rel="nofollow noreferrer"><code>datamodel-codegen</code></a> from below JSON data)</p>
<p>Using Pydantic V2</p>
<p>JSON data:</p>
<pre><code>{
"name": ... | <python><pydantic> | 2023-09-04 07:18:46 | 2 | 5,588 | shaik moeed |
77,035,555 | 1,722,380 | pytest does not honor pytest.ini | <pre><code> tree
.
├── app
│ ├── __init__.py
│ ├── app.py
│ └── inner
│ └── __init__.py
├── pytest.ini
└── tests
├── __init__.py
└── test_app.py
</code></pre>
<p>pytest.init contents</p>
<pre><code>[pytest]
markers =
exception
</code></pre>
<p>test case</p>
<pre><code>@pytest.mark.exception(sock... | <python><pytest><fixtures> | 2023-09-04 06:39:49 | 0 | 2,192 | Łukasz |
77,035,238 | 10,431,629 | Reading Data in Pandas from Excel File separated with different segments | <p>I have an excel file which looks like this :</p>
<p><a href="https://i.sstatic.net/IZElr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IZElr.png" alt="enter image description here" /></a></p>
<p>I want to read the file into multiple data frames based on the flags like here :</p>
<p>DataEx1, DataEx2 ... | <python><pandas><excel><dataframe><split> | 2023-09-04 05:23:46 | 1 | 884 | Stan |
77,035,204 | 13,916,049 | AttributeError: 'str' object has no attribute 'cat' | <p>For each <code>GENE_SYMBOLS</code> column of a dataframe, merge the rows and retain only unique comma-separated or dash-separated values. After merging the values of each row into a list, obtain only the unique values.</p>
<pre><code>geneset = pd.read_csv("genesets.v2023.1.Hs.tsv", sep="\t", inde... | <python><pandas> | 2023-09-04 05:12:39 | 3 | 1,545 | Anon |
77,034,930 | 12,595,487 | zsh: command not found: psql in mac terminal | <p>I've got this error when I type 'psql' in my terminal : "<code>zsh: command not found: psql</code>".</p>
<p>i only got this when I open <code>~/.zshrc</code> :</p>
<ul>
<li><code>export PATH=$PATH:/Applications/Postgres.app/Contents/Versions</code></li>
</ul>
<p>I've installed postgresql version 11-15 on m... | <python><postgresql><zsh><psql> | 2023-09-04 03:28:27 | 1 | 657 | Asyraf |
77,034,768 | 6,017,248 | Web scraping multiple paragraphs in an Arabic website that has <p> and <font> HTML elements | <h1>Context</h1>
<p>I have been doing this small web scraping project to practice and polish my coding skills. I had an idea that I could preserve some of my grandpa's work and save it somewhere and keep up his legacy in the future when it doesn't exist anymore on the site. So I'm doing my part where I can do what I ca... | <python><html><web-scraping><urllib> | 2023-09-04 02:14:11 | 2 | 398 | Zeid Tisnes |
77,034,675 | 21,575,627 | Finding the minimum cost for 'm' compatible elements for group 1 and group 2 (algorithm) | <p>Here is a problem statement. I recently had an interview question regarding this:</p>
<blockquote>
<p>given arrays compatible1, compatible2, and cost of length n >= 1. cost[i] represents the cost of element i. the respective compatible[i] == 1 if compatible with that group and 0 otherwise. also given min_compatib... | <python><algorithm><set><heap><disjoint-sets> | 2023-09-04 01:17:12 | 1 | 1,279 | user129393192 |
77,034,664 | 3,654,852 | Call a defined function in lambda in Python | <p>I am trying to understand the mechanics of user defined functions (UDF) and the difference that using a lambda function makes when creating a new column in a dataframes, based on multiple conditions across all rows in two more more columns.</p>
<p>I tried a few different ways, but only some of it works. I'd like to ... | <python><dataframe><lambda> | 2023-09-04 01:11:22 | 0 | 803 | user3654852 |
77,034,517 | 5,953,720 | Why does loc adds a NaN row in my Pandas Dataframe? | <p>I am using <a href="https://github.com/subashgandyer/datasets/blob/main/Real%20estate.csv" rel="nofollow noreferrer">this csv</a>.</p>
<pre><code>import pandas as pd
import numpy as np
real_estate = pd.read_csv('real_estate.csv',index_col=0)
buckets = pd.cut(real_estate['X2 house age'],4,labels=False).to_numpy()
... | <python><pandas><numpy><categorization><discretization> | 2023-09-03 23:56:30 | 1 | 1,517 | Allexj |
77,034,494 | 219,153 | Small value artifacts from applying scipy.signal.convolve | <p>This Python 3.11.5 script:</p>
<pre><code>import numpy as np
from skimage.io import imread
from scipy.signal import convolve
image = np.flipud(imread('conv-test.bmp').astype(np.float32))
con = convolve(image, np.ones((3, 3))/9, mode='valid')
print(image.min())
print(np.logical_and(image > 0, image < 1).any())... | <python><numpy><scipy><convolution> | 2023-09-03 23:40:53 | 1 | 8,585 | Paul Jurczak |
77,034,404 | 21,183,551 | jsonbin API problems with Swift | <p>I'm building a little app that talks to the <a href="https://jsonbin.io" rel="nofollow noreferrer">jsonbin</a> API with Alamofire. Their API docs cover using Python to "put" or "update" the JSON file data extensively in Python. I'm working on doing that in Swift 5.</p>
<p>My problem is when I at... | <python><json><swift><alamofire><alamofire5> | 2023-09-03 22:48:10 | 1 | 641 | Ars_Codicis |
77,034,126 | 2,743,931 | Python setup.py with src directory | <p>I have a simple project folder which looks like this:</p>
<pre><code>.
├── setup.py
├── src
├── __init__.py
└── pricing_functions.py
</code></pre>
<p>and I want to make it an installable package.</p>
<p>What I <em>want</em> is to have the package named <code>pricer</code> and have the actual code taken from ... | <python><python-import><setuptools><setup.py><python-packaging> | 2023-09-03 20:49:16 | 0 | 312 | user2743931 |
77,034,027 | 6,653,602 | How to update where the files are stored in Django app | <p>I have a Django app that contains multiple models with FileField. I am saving by default every file directly in the Media folder. But as the app grew larger also Media folder became bigger. Now my idea is to move the files into separate folders split by models. So I am wondering what is the best practice when it com... | <python><django> | 2023-09-03 20:13:41 | 1 | 3,918 | Alex T |
77,033,994 | 11,686,518 | Column-wise sum of nested list | <p>Is there a more pythonic or more simple way to accomplish this?</p>
<p>I am taking the column-wise sum of items in a nested list. I have a working example but I'm sure nested loops are not the way to do. There has to be something, maybe in NumPy or something, that already does this?</p>
<p>So it's the sum of the fir... | <python><python-3.x><numpy><nested-lists> | 2023-09-03 20:04:30 | 1 | 1,633 | Jesse Sealand |
77,033,934 | 12,300,981 | How to convert a 3D plot into a 2D filled contour | <p>I have a 3D plot that looks quite nice, and I'd like to convert this to a 2D filled contour plot, but I'm not quite sure how to do that. Here is my setup</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
... | <python><arrays><numpy><matplotlib><contourf> | 2023-09-03 19:45:21 | 0 | 623 | samman |
77,033,858 | 12,461,032 | Cannot install stellargraph | <p>I am trying to install <a href="https://stellargraph.readthedocs.io/en/stable/README.html#installation" rel="nofollow noreferrer">stellargraph</a> package. I created a new conda environment with python 3.6 and tried to install it with <code>pip install stellargraph</code> but when I try to write <code>import stellar... | <python><conda><stellargraph> | 2023-09-03 19:24:21 | 1 | 472 | m0ss |
77,033,850 | 913,098 | setting a multi index does not allow access using .loc? | <pre><code>import pandas as pd
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
empty_row_index = ("zero_scan")
empty_row_df = pd.DataFrame({c: [None] for c in df.columns})
empty_row_df.index = [empty_row_index]
df2 = pd.concat([empty_row_df, df])result = df2.loc[df2.index[0], :]
</code... | <python><pandas><dataframe><multi-index> | 2023-09-03 19:22:50 | 1 | 28,697 | Gulzar |
77,033,740 | 425,895 | What's the difference between astype("category), categorical() and factorize()? | <p>Python offers many ways to convert a variable to categorical.</p>
<pre><code>import numpy as np
import pandas as pd
mydata = pd.Series(['A', 'B', 'B', 'C'])
mydata
0 A
1 B
2 B
3 C
dtype: object
pd.factorize(mydata) # Outputs a tuple with an array and an index
(array([0, 1, 1, 2], dtype=int64), Index([... | <python><pandas><categorical-data> | 2023-09-03 18:44:45 | 2 | 7,790 | skan |
77,033,675 | 1,020,139 | Why does `pip3 install lxml` on public.ecr.aws/lambda/python:3.11 install a source distribution rather than a (manylinux) wheel? | <p>I'm curious to understand why <code>pip3</code> @ <code>public.ecr.aws/lambda/python:3.11</code> (Python v3.11.4) downloads and install the source distribution of <code>lxml</code> instead of downloading the seemingly compatible manylinux wheel <code>lxml-4.9.3-cp311-cp311-manylinux_2_28_aarch64.whl</code>?</p>
<p><... | <python><linux><pip><python-poetry><python-wheel> | 2023-09-03 18:26:27 | 1 | 14,560 | Shuzheng |
77,033,643 | 6,440,589 | Converting from local time to UTC in pandas | <p>I am working with pandas dataframes containing local (Chilean) dates and times, <em>e.g.</em>:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>local_time</th>
</tr>
</thead>
<tbody>
<tr>
<td>2/9/2023 23:33</td>
</tr>
<tr>
<td>2/9/2023 23:39</td>
</tr>
<tr>
<td>3/9/2023 1:00</td>
</tr>
<t... | <python><pandas><datetime><dst> | 2023-09-03 18:18:11 | 1 | 4,770 | Sheldon |
77,033,528 | 22,466,650 | Why can't we use a fill_value when reshaping a dataframe (array)? | <p>I have this dataframe :</p>
<pre><code>df = pd.DataFrame([list("ABCDEFGHIJ")])
0 1 2 3 4 5 6 7 8 9
0 A B C D E F G H I J
</code></pre>
<p>I got an error when trying to reshape the dataframe/array :</p>
<pre><code>np.reshape(df, (-1, 3))
</code></pre>
<p><strong>ValueError: cannot re... | <python><pandas><numpy> | 2023-09-03 17:46:29 | 2 | 1,085 | VERBOSE |
77,033,496 | 4,681,060 | Model returns multiple values during inference, but expected is exactly one output value | <p>I have a tf model of given summary:</p>
<pre><code>Model: "model"
Layer (type) Output Shape Param #
input_1 (InputLayer) [(None, 1024, 9)] 0
conv1d (Conv1D) (None, 1024, 1024) 28672
re_lu (ReLU) (None, 1024, 10... | <python><tensorflow><conv-neural-network> | 2023-09-03 17:35:40 | 0 | 6,442 | Krzysztof Cichocki |
77,033,384 | 6,929,467 | Pytest MonkeyPatch | <p>I am trying to patch <code>PyMongoClient</code> that has multiple nested commands that need to be patched.</p>
<p>One example would be instantiating the <code>PyMongoClient</code> (i.e. <code>client = PyMongoClient().db</code> then doing a command like <code>client.command('ping)</code></p>
<p>Here is an example of ... | <python><mongodb><pytest> | 2023-09-03 17:10:49 | 1 | 2,720 | innicoder |
77,033,348 | 2,678,074 | How to find directory in realtion to Pycharm project root? | <p>I simply created a new project in Pycharm, and added directory <em>cfg</em> to it. I simply want to check in my <em>main.py</em> if in fact, my <em>cfg</em> directory is where it supposed to be, just want to check if hierarhy of my projest from within python (i wrote in pycharm, but it may be my code will be exporte... | <python><path><pycharm> | 2023-09-03 17:03:02 | 2 | 845 | user2678074 |
77,033,163 | 15,673,147 | What's the difference about using Langchain's Retrieval with .from_llm or defining LLMChain? | <p>In the documentation, I've seen two patterns of construction and I'm a bit confused about the difference between both. I don't know if there's any actual difference or if just the same thing in different approach.</p>
<p>Example 1 (using .from_llm):</p>
<pre><code>model = ChatOpenAI(model_name="gpt-3.5-turbo&qu... | <python><openai-api><information-retrieval><langchain><large-language-model> | 2023-09-03 16:11:50 | 2 | 343 | Guilherme Giuliano Nicolau |
77,032,964 | 7,169,895 | Coroutine does not run on button click in Pyside6 | <p>I am trying to run a coroutine which gets data on a button click. It uses <code>aiohttp</code> to get the data. The button is decorated with <code>@asyncSlot()</code> from <code>qasync</code> However, when I click the button, nothing happens, not even a print statement. I do not think the asyncio examples <a href="h... | <python><python-asyncio><pyside6> | 2023-09-03 15:24:00 | 1 | 786 | David Frick |
77,032,789 | 1,856,357 | Is it safe to set `out=a` in `np.compress`? | <p>Let's say I want to compress some subset of a large numpy array along the first dimension, here's an arbitrary example:</p>
<pre class="lang-py prettyprint-override"><code>a = np.random.normal(size=(100_000, 5))
subset = (np.sum(a, axis=1) > 0)
a_compressed = a.compress(subset, axis=0)
</code></pre>
<p>Sadly this... | <python><numpy> | 2023-09-03 14:37:12 | 0 | 304 | Timon Knigge |
77,032,773 | 310,370 | !source venv/bin/activate not working in a Kaggle notebook any ideas? | <p>I generated venv with below command</p>
<pre><code>!python3 -m venv venv
</code></pre>
<p>Activated it with below command</p>
<pre><code>!source venv/bin/activate
</code></pre>
<p>But it is not working. How do I know?</p>
<p>When I do <code>!pip freeze</code> it shows the entire notebook not the activated <code>venv... | <python><conda><kaggle> | 2023-09-03 14:33:47 | 1 | 23,982 | Furkan Gözükara |
77,032,768 | 1,334,761 | PIL saving as a PNG loses ICC profile | <p>I have a JPEG image (which unfortunately I cannot share here) which I'm trying to re-save as PNG, while maintaining its color profile:</p>
<pre><code>from PIL import Image
import numpy as np
pil_img = Image.open(path_to_jpeg)
# Some processing on the image...
np_img = np.array(pil_img)
Image.fromarray(np_img).save(... | <python><image-processing><python-imaging-library><png><color-profile> | 2023-09-03 14:31:39 | 1 | 11,484 | Jjang |
77,032,661 | 18,020,941 | Django keeps running migrations without changes made | <p>I am creating a custom model field. It basically a one-level dictionary field which allows you to store model-subfields in a JSON manner in the database so fields which wont be queried upon will not take up an extra column.</p>
<p>The issue is, whenever I predefine the default value for the field, the migrations kee... | <python><django><django-models> | 2023-09-03 14:09:56 | 1 | 1,925 | nigel239 |
77,032,559 | 10,788,239 | Why is the kivy window automatically 25% bigger than specified? | <p>I'm creating a game in kivy and noticed that the window size is always 25% bigger than I specify it to be:</p>
<pre><code>from kivy.app import App
from kivy.uix.widget import Widget
from kivy.core.window import Window
# screen dimensions, px
screen_width = 400
screen_height = 600
Window.size = (screen_width, screen... | <python><kivy><window> | 2023-09-03 13:44:20 | 1 | 438 | Arkleseisure |
77,032,448 | 913,098 | Pytorch Lightning: How to save a checkpoint for every validation epoch? | <p>It is not clear from <a href="https://pytorch-lightning.readthedocs.io/en/1.2.10/api/pytorch_lightning.callbacks.model_checkpoint.html" rel="noreferrer">the docs</a> how to save a checkpoint for every epoch, and have it actually saved and not instantly deleted, with no followed metric.</p>
<p>How to do it?</p>
| <python><pytorch><pytorch-lightning> | 2023-09-03 13:17:44 | 1 | 28,697 | Gulzar |
77,032,436 | 1,991,502 | Using pydantic to catch an invalid attribute setting | <p>The script below runs without error. I would like to catch the invalid attribute setting on the last line, where the value is not set to a positive integer.</p>
<pre><code>from pydantic.dataclasses import dataclass
from pydantic import PositiveInt
@dataclass
class MyDataClass:
value: PositiveInt
my_class = M... | <python><validation><pydantic> | 2023-09-03 13:15:01 | 1 | 749 | DJames |
77,032,427 | 10,666,587 | r_ slicing mistakenly includes last argument | <p>I have strange float inaccuracies; the results of <a href="https://numpy.org/doc/stable/reference/generated/numpy.r_.html" rel="nofollow noreferrer"><code>r_</code></a> are not consistent:</p>
<pre><code>import numpy as np
np.r_[-665.6:-650.24:2.56] == array([-665.6 , -663.04, -660.48, -657.92, -655.36, -652.8 , -6... | <python><numpy> | 2023-09-03 13:12:34 | 1 | 328 | Shaq |
77,032,221 | 20,266,647 | MLRun ingestion, ConnectionResetError 10054 | <p>I got this error during ingest data to Parquet in MLRun CE:</p>
<pre><code>2023-09-03 14:01:47,327 [error] Unhandled exception while sending request: {'e': <class 'ConnectionResetError'>, 'e_msg': ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None), '... | <python><data-ingestion><mlops><mlrun><feature-store> | 2023-09-03 12:13:23 | 1 | 1,390 | JIST |
77,031,967 | 3,990,451 | How to make python3 import examine .so and ...-g.so as well? | <p>We expose C++ code to python via boost.python. We produce release and debug builds.</p>
<p>release builds produce lib.so files</p>
<p>debug builds produce lib-g.so files.</p>
<p>Our python code then</p>
<pre><code>import lib<mymodule>
</code></pre>
<p>Is there a way to place a hook such that those import state... | <python><boost-python> | 2023-09-03 10:55:57 | 1 | 982 | MMM |
77,031,949 | 7,625,386 | problem with changing the frames in an video with opencv | <p>I have a code that runs in the last few months without any problem. The code shows an image from a video with extra data from the relevant db. using the keyboard you can jump around some frames and get better insights. However, in the last week changing the frame of the video stopped working.</p>
<p>I built a small ... | <python><docker><opencv><ffmpeg> | 2023-09-03 10:48:27 | 1 | 501 | Avizipi |
77,031,155 | 13,834,948 | discrepancy with Python datetime with timezone | <p>Can anyone please help explain about the following. why don't I get even numbers for the hours?</p>
<p>I'm running Python 3.10. The following is from ptpython session:</p>
<pre><code>>>> import pytz
... from datetime import datetime
...
... # Define time zones for Eastern Time and Pacific Time
... eastern_t... | <python><python-3.x> | 2023-09-03 06:29:39 | 1 | 1,634 | LXJ |
77,031,060 | 1,385,107 | Query bot on multiple JSON files on Langchain | <p>I have around 30 GB of JSON data with multiple files, wanted build query bot on this.
I have built same with text file but i am not sure how it will work for JSON data.</p>
<p>I have explored JSONLoader but dont know how to use this to convert JSON data into vector and store it into ChromaDB so that i can query them... | <python><langchain><large-language-model><chromadb><jsonloader> | 2023-09-03 05:46:58 | 1 | 5,313 | Juned Ansari |
77,030,917 | 5,763,590 | Unable to pass wandb API Key in PyCharm terminal | <pre><code>wandb: (1) Create a W&B account
wandb: (2) Use an existing W&B account
wandb: (3) Don't visualize my results
wandb: Enter your choice: 2
wandb: You chose 'Use an existing W&B account'
wandb: Logging into wandb.ai. (Learn how to deploy a W&B server locally: https://wandb.me/wandb-server)
wandb... | <python><terminal><pycharm><wandb> | 2023-09-03 04:37:47 | 1 | 10,287 | mrk |
77,030,534 | 3,654,852 | Python : assign a column using lambda with if else | <p>I have a date column in a dataframe, and I'd like to create another column that I call peak_day. If the day name of the day in the date column is a weekend (Sat or Sun), it will return false, else True.
I got the code to work....but not sure what I'm doing wrong in the "bad" code. I could just move on....b... | <python><pandas><dataframe><lambda> | 2023-09-03 00:45:17 | 3 | 803 | user3654852 |
77,030,437 | 1,536,050 | Pyinstaller Builds seemingly successfully, running the executable does nothing | <p>I have an application I'm trying to build an executable for written in python. For the records, my dependencies are reflected in the following import statements:</p>
<pre><code>import asyncio
import os
import time
from dotenv import load_dotenv
from winsdk.windows.media.control import (
GlobalSystemMediaTranspor... | <python><pyinstaller> | 2023-09-02 23:52:48 | 1 | 1,550 | KinsDotNet |
77,030,386 | 16,886,597 | How can I see if at least N times in a list of times fall within a 24-hour time span? | <p>I have a handful of different dates and times, represented as a handful of <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime" rel="nofollow noreferrer">datetime objects</a> in a list.</p>
<pre class="lang-py prettyprint-override"><code>from datetime import datetime
arr = [datetime(2023, 9, ... | <python><python-3.x><python-datetime> | 2023-09-02 23:29:25 | 1 | 674 | cocomac |
77,030,241 | 14,509,604 | pandas.convert_dtype(dtype_backend="pyarrow") raises error | <p>I'm starting to use pandas with Pyarrow and realized there's no easy way to declare a df directly as with Pyarrow engine, so I ended up in <a href="https://stackoverflow.com/questions/75939770/how-can-i-construct-a-dataframe-that-uses-the-pyarrow-backend-directly-i-e-wi">this post</a>. The thing is that I'm having t... | <python><pandas><pyarrow> | 2023-09-02 22:21:13 | 1 | 329 | juanmac |
77,030,165 | 5,019,169 | How to send message as slash command in discord.py? | <p>I have a bot (Let's name it <code>A</code>) already connected to the channel, and it has a slash command '/greet' that takes a <code>prompt</code> and acts upon it. Now I am trying to write a bot <code>B</code> here, that sends a command <code>/greet prompt hello!</code> for example, which will trigger the bot <code... | <python><python-3.x><discord><discord.py><bots> | 2023-09-02 21:49:27 | 2 | 11,224 | Ahasanul Haque |
77,030,009 | 10,883,088 | JSONDecodeError error when trying to pull playlists from spotify using spotipy | <p>I'm using the default instructions provided by docs in spotipy, I setup my app in the spotify dev dashboard, and checked my credentials, but am still getting this error code:</p>
<p><code>JSONDecodeError: Expecting value: line 1 column 1 (char 0)</code></p>
<pre><code>import spotipy
from spotipy.oauth2 import Spotif... | <python><python-3.x><spotify><spotipy> | 2023-09-02 20:50:48 | 0 | 471 | dko512 |
77,029,973 | 3,651,478 | Hello World Neural Network to understand basics | <p>I am trying to build a noob neural net using tensorflow that learns to solve the equation <code>y = 2x - 1</code>
Training data -</p>
<pre><code>xs = [0,1,2,3,4,5]
ys = [-1,1,3,5,7,9]
xs = np.array(xs, dtype=float)
ys = np.array(ys, dtype=float)
</code></pre>
<p>I am using 3 different models which changes only in ... | <python><keras><neural-network><tensorflow2.0><tf.keras> | 2023-09-02 20:41:00 | 1 | 375 | Ujjwal Vaish |
77,029,938 | 1,392,104 | Change django.forms.models.ModelChoiceIterator | <p>The choices variable of one of my fields (django.forms.models.ModelChoiceIterator) in ModelForm contains 3 items.
In some cases, I want to use only one of them (the first one in the "list") for the actual HTML.</p>
<p>Here's a part of the Django Python code:</p>
<p>class MyForm(ModelForm):</p>
<pre><code>d... | <python><django><modelform> | 2023-09-02 20:29:50 | 1 | 529 | tamirko |
77,029,834 | 16,284,229 | How to use try catch for multiple sections of code raising the same Exception? | <p>I have the code below, the until function raises a <code>TimeoutException</code> if the lambda function does not return an element. The problem is, that there are multiple sections of code that raise the same error, both when closing the cookies footer and finding the product title. I imagine it would be incredibly ... | <python><python-3.x><selenium-webdriver> | 2023-09-02 19:55:17 | 2 | 305 | Tech Visionary |
77,029,779 | 1,492,229 | why merging dataframes is not working the way is intended in python | <p>I have a dataframe df</p>
<p>it looks like this</p>
<pre><code> Weight Height Depth RepID Code
0 18 3 14 257428 0
1 6 0 6 214932 0
2 21 6 16 17675 0
3 45 6 20 6081... | <python><arrays><pandas><dataframe> | 2023-09-02 19:36:07 | 2 | 8,150 | asmgx |
77,029,732 | 4,645,982 | Getting Error cors "Request header field responsetype is not allowed by Access-Control-Allow-Headers in preflight response" in django | <p>Error in the browser console</p>
<blockquote>
<p>Access to XMLHttpRequest at<br />
'https:///some_site/resource1/downloadCSV' from origin 'https://some_site' has been blocked by CORS policy: Request header field responsetype is not allowed by Access-Control-Allow-Headers in preflight response.</p>
</blockquote>
<p>c... | <python><django><django-models><django-rest-framework><cors> | 2023-09-02 19:20:20 | 1 | 2,676 | Neelabh Singh |
77,029,695 | 2,497,309 | Installing NodeJS on AWS Lambda Python Container Image | <p>I'm trying to build a custom docker image starting from</p>
<pre><code>FROM public.ecr.aws/lambda/python:3.11
</code></pre>
<p>This docker image only has Python installed but I also want to install NodeJS and use NPM to install aws-cdk on it and deploy a stack to CloudFormation via the python lambda. I've tried a b... | <python><node.js><amazon-web-services><docker><aws-lambda> | 2023-09-02 19:08:39 | 1 | 947 | asm |
77,029,693 | 13,584,963 | Python do np.logical_and in parallel like np.max(array, axis=1) | <p>I have a 2D bool array of shape row*col, is there any efficient way to horizontally perform the <code>AND</code> operation to the array?
For example,</p>
<pre><code>k = np.array([[True, True, False],
[True, False, False],
[True, True, True]])
</code></pre>
<p>The result is expected to be<... | <python><arrays><numpy> | 2023-09-02 19:07:08 | 2 | 311 | Crear |
77,029,596 | 1,951,176 | CPU time > wall time in Python multihreading | <p>A wrote a short piece of code in Python that uses multiple threads (but a single process) and ran it with a timer:</p>
<pre class="lang-py prettyprint-override"><code>import random
a = "".join([chr(ord('a') + random.randint(1, 20)) for _ in range(50_000_000)])
def sum_part(i):
part = a[i * 20_000_000: (... | <python><multithreading> | 2023-09-02 18:41:25 | 2 | 4,687 | sygi |
77,029,549 | 1,008,596 | using vertex ai in custom python script outside AI workbench and collab fails with permission denied | <p>I'm trying to use GCP Vertex AI outside of a GCP managed AI Workbench notebook environment or Google Collab notebook environment. Specifically I am trying to run in an self hosted jupyter notebook environment. Here is my setup and problem:</p>
<h1>Setup</h1>
<h2>Setup GCP and shell running python</h2>
<p>We used i... | <python><google-cloud-platform><jupyter-notebook><google-cloud-vertex-ai> | 2023-09-02 18:29:30 | 1 | 4,629 | netskink |
77,029,486 | 1,020,139 | Why does pip on Amazon Linux 2 download lxml-4.9.3.tar.gz, while it downloads lxml-4.9.3-cp311-cp311-manylinux_2_28_aarch64.whl on Amazon Linux 2023? | <blockquote>
<p>Why does pip on Amazon Linux 2 download lxml-4.9.3.tar.gz, while it downloads lxml-4.9.3-cp311-cp311-manylinux_2_28_aarch64.whl on Amazon Linux 2023?</p>
</blockquote>
<p>I need to download and install the <code>manylinux</code> variant, as the former doesn't work on AWS Lambda, yielding the following e... | <python><amazon-web-services><pip><python-poetry> | 2023-09-02 18:11:27 | 1 | 14,560 | Shuzheng |
77,029,483 | 74,497 | Why do I run out of memory when training with a large dataset, but have no problems with a small dataset? | <p>I'm trying to build a keypoint detection system using Keras. I've got a UNet like model, with a series of convolutions, batch normalization, and max pooling, followed by a symmetric series of up sampling, convolution, and batch normalization layers (and skip connections). When given 100 instances, I'm able to call <... | <python><tensorflow><machine-learning><keras> | 2023-09-02 18:10:13 | 3 | 6,088 | ocharles |
77,029,478 | 39,381 | Parsing several multi-line blocks with pyparsing | <p>I'm a complete pyparsing newbie, and am trying to parse a large file with multi-line blocks describing archive files and their contents.</p>
<p>I'm currently at the stage where I'm able to parse a single item (no starting newline, this hardcoded test data approximates reading in a real file):</p>
<pre class="lang-py... | <python><parsing><pyparsing> | 2023-09-02 18:08:45 | 1 | 3,926 | JK Laiho |
77,029,411 | 8,948,544 | Returning a json response when using flask_sqlalchemy and autoload_with | <p>I am creating a python program to connect to an existing SQLITE database and provide a JSON endpoint to access the contents of a table. But I can't seem to figure out how to convert the Rows returned from a query into a JSON serializable format.</p>
<p>Here is my code:</p>
<pre><code>from flask import Flask
from fla... | <python><flask-sqlalchemy> | 2023-09-02 17:51:49 | 0 | 331 | Karthik Sankaran |
77,029,403 | 2,555,515 | Querying large dataset from Snowflake with Python/psycopg2 | <p>We have large simple dataset with two columns: tension. and time and a foreign key device_id stored in Snowflake. We query like</p>
<pre><code>def get_waveform(self, device_id):
sql = """
select tension, time from waveform
where device_id = %s;
"""
with ... | <python><snowflake-cloud-data-platform><psycopg2> | 2023-09-02 17:49:55 | 1 | 1,089 | user2555515 |
77,028,948 | 10,441,038 | Equivalent of C++ union in Python? | <p>I need to precisely save a lot of floating numbers to a file in C++ program, and then read them in Python.</p>
<p>You known that the precision of floating numbers may be lost when we convert them into/out from string.</p>
<p>I'm wondering that "Is there an equivalent of union in Python?" If so, I can do it... | <python><c++><python-3.x><type-conversion><unions> | 2023-09-02 15:47:47 | 0 | 2,165 | Leon |
77,028,925 | 12,396,154 | Docker Compose Fails: error: externally-managed-environment | <p>I am using a windows machine and have installed wsl to be able to use Docker desktop. Of course the build failed and then I observed python3 and pip3 in the dockerfile. So I installed ubuntu and debian via wsl and then tried to run the app (docker-compose up). It still fails and throws the following error:</p>
<pre>... | <python><docker><docker-compose><windows-subsystem-for-linux> | 2023-09-02 15:41:15 | 1 | 353 | Nili |
77,028,828 | 6,615,512 | Why are numpy operations with float32 significantly faster than float64? | <p>Doing some optimizing I noticed that switching from float64 to float32 improves run time a <em>lot</em> with some numpy ops. 5x in the example below. I know that data types are just handled differently and have hardware dependencies and such (see questions <a href="https://stackoverflow.com/q/15340781">here</a> and ... | <python><numpy> | 2023-09-02 15:11:56 | 1 | 391 | Shawn |
77,028,770 | 1,469,954 | ThreadPoolExecutor task for downloading files in bulk downloads only last file in list | <p>I have a file called <code>images.txt</code>, which is just a list of image URLs, one per line:</p>
<pre><code>https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Glenn_Jacobs_%2853122237030%29_-_Cropped.jpg/440px-Glenn_Jacobs_%2853122237030%29_-_Cropped.jpg
https://upload.wikimedia.org/wikipedia/commons/thumb... | <python><multithreading><python-requests><urllib><threadpoolexecutor> | 2023-09-02 14:57:57 | 1 | 5,353 | NedStarkOfWinterfell |
77,028,576 | 2,182,542 | patch() from unittest.mock doesn't work in a subprocess | <p>It seems that <code>patch()</code> from <code>unittest.mock</code> does not work as expected in subprocesses spawned with <code>multiprocessing</code> module for me.</p>
<p>Here is my code:</p>
<p>a.py</p>
<pre><code>import multiprocessing
from unittest.mock import patch
from b import run_new_process, call_mocked_... | <python><python-multiprocessing><python-unittest> | 2023-09-02 13:58:00 | 1 | 1,114 | Danio |
77,028,331 | 4,575,197 | How to get Fama-Macbeth Regression Cross-sectionally in python | <p>I am very new to this topic and I'm confused with understanding the regression and Quantitative aspects of it, although i have found amazing posts like <a href="https://quant.stackexchange.com/questions/46746/rationale-of-fama-macbeth-procedure?rq=1">rationale-of-fama-macbeth-procedure</a>,
<a href="https://quant.st... | <python><pandas><regression><quantitative-finance> | 2023-09-02 12:43:18 | 0 | 10,490 | Mostafa Bouzari |
77,028,323 | 202,385 | mypy complains about duplicate module even though its a different module with the same name but a different folder/namespace | <p>Mypy keeps complaining about duplicate module even though there is no duplicate module but modules with the same name in different folders.</p>
<p>Example tree:</p>
<pre><code>.
├── catalog
│ ├── __init__.py
│ └── k8s_pvc
│ ├── implementation.py
│ └── integration.py
├── executor
│ ├── __init__.py
│... | <python><mypy> | 2023-09-02 12:40:23 | 2 | 396 | vijayvammi |
77,028,268 | 7,119,501 | How to fix UserPrincipalNotFoundException when calling an API in pyspark application? | <p>I am trying to submit API calls from a Spark application as below:</p>
<pre><code>def api_json(spark, api_param):
try:
token = generate_a_token()
token_headers = {'Authorization': f"Bearer {token}"}
response = requests.get(f'https://api_url/?api_end_point={api_param}', headers=token_h... | <python><rest><apache-spark><pyspark><apache-spark-sql> | 2023-09-02 12:25:32 | 0 | 2,153 | Metadata |
77,028,209 | 8,771,082 | How can I repeatedly list code around the current line with pdb? | <p>The <code>l</code> command for <code>pdb</code> is documented like so:</p>
<blockquote>
<p><code>l</code>: List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing.</p>
</blockquote>
<p>I often use this command (in <code>ipdb</code> as well) to ... | <python><debugging><pdb><ipdb> | 2023-09-02 12:05:32 | 0 | 449 | Anton |
77,028,034 | 6,467,567 | setup.py error when going from python=3.6 to python=3.9 | <p>I am trying to install this <a href="https://github.com/BarisYazici/deep-rl-grasping/tree/master" rel="nofollow noreferrer">https://github.com/BarisYazici/deep-rl-grasping/tree/master</a>. The instructions create a conda environment with <code>python=3.6</code> but installing the library with <code>python=3.6</code>... | <python><python-3.x> | 2023-09-02 11:10:16 | 1 | 2,438 | Kong |
77,027,486 | 16,383,578 | How find logical contradictions and redundancies in a list of symbolic expressions in Python? | <p>Sometimes I have a small number of variables, and I need to compute some result according to the relationships between the variables. So I need to account for all possible relationships between the variables and calculate the result accordingly.</p>
<p>For instance, [a, b] and [c, d] are integer ranges, a <= b an... | <python><python-3.x><symbolic-math> | 2023-09-02 08:15:15 | 0 | 3,930 | Ξένη Γήινος |
77,027,214 | 22,070,773 | How to expose an opaque pointer in nanobind? | <p>I have a function in C++ that I am trying to expose in Python:</p>
<pre><code>void f(T* t) {
...
}
</code></pre>
<p>and I am wrapping it like so:</p>
<pre><code>m.def("f", f);
</code></pre>
<p>Nanobind doesn't like the pointer and complains with:</p>
<blockquote>
<p>error: invalid use of incomplete type ... | <python><c++><nanobind> | 2023-09-02 06:33:46 | 1 | 451 | got here |
77,027,198 | 1,166,391 | How to install Wagtail 5.1 or above | <p>I am using MacOS. I tried to install <strong>Wagtail 5.1</strong> in a venv and I installed <code>pip install wagtail</code>. and <code>wagtail start mysite mysite</code>. Without using cd mysite
<code>pip install -r requirements.txt</code>, I directly typed cd mysite and <code>python manage.py migrate</code>. Th... | <python><django><wagtail> | 2023-09-02 06:27:14 | 0 | 1,170 | catmantiger |
77,027,157 | 7,243,558 | Trying to use a DATE column with pyignite | <p>When I query my date column I get an error:</p>
<blockquote>
<p>Traceback (most recent call last):
File "...\Python\Python38\site-packages\pyignite\datatypes\internal.py", line 390, in __data_class_parse
return tc_map(type_code)
File "...\Python\Python38\site-packages\pyignite\datatypes\internal.py&qu... | <python><sql><ignite> | 2023-09-02 06:08:40 | 1 | 387 | James |
77,027,058 | 539,023 | Kafka error - 'Disconnected while requesting ApiVersion | <p>I have a Kafka docker set up that I was able to run properly with the following docker-compose.yml.</p>
<pre><code>> version: '2'
>
> services:
> zookeeper:
> image: bitnami/zookeeper:3.8
> ports:
> - 2181:2181
> environment:
> - ALLOW_A... | <python><docker><apache-kafka><confluent-kafka-python> | 2023-09-02 05:17:12 | 0 | 20,230 | kta |
77,026,971 | 22,070,773 | How to wrap a vector<T> in nanobind? | <p>In <code>boost::python</code>, to wrap a <code>vector<T></code> you would do something like this:</p>
<pre><code>boost::python::class_< std::vector < T > >("T")
.def(boost::python::vector_indexing_suite<std::vector< T > >());
</code></pre>
<p>How do I accomplish the same t... | <python><c++><nanobind> | 2023-09-02 04:30:36 | 1 | 451 | got here |
77,026,950 | 17,835,656 | How can i give a widget initial size in pyqt5? | <p>i want give a widget an initial size >>>>>> not fixed , not minimum , and not maximum size</p>
<p>because i want the user be able to control the size of the widget, when i am using splitter.</p>
<p>how ?</p>
<p>look at this image :</p>
<p><a href="https://i.sstatic.net/nb82U.png" rel="nofollow nore... | <python><python-3.x><pyqt><pyqt5> | 2023-09-02 04:19:57 | 1 | 721 | Mohammed almalki |
77,026,844 | 21,575,627 | How can I find the time complexity of this algorithm (backtracking)? | <p>This is a function I wrote in Python for Leetcode 216. The problem statement is:</p>
<blockquote>
<p>Find all combinations of k distinct digits from [1-9] s.t they sum to n. Return a list of all valid combinations, knowing that 2 <= k <= 9, 1 <= n <= 60</p>
</blockquote>
<p>This is my algorithm:</p>
<pre... | <python><algorithm><time-complexity><big-o> | 2023-09-02 03:23:08 | 1 | 1,279 | user129393192 |
77,026,714 | 3,158,876 | How to iterate through dictionary and set values from a class | <p>I have an empty dictionary (tried both completely empty and with keys from list - same results).</p>
<p>I am then trying to iterate through that same list (in this case rooms in a building), pull some data from another source into a class instance, and then set the value in the dictionary designated for that room to... | <python><dictionary><class><reference> | 2023-09-02 02:05:13 | 1 | 315 | Benjamin Brannon |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.