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,435,329 | 12,243,638 | fillna multiple columns of a dataframe with corresponding columns of another dataframe pandas | <p>There is a dataframe <code>df_1</code> which has some nan values. These nan values should be filled by values from another dataframe df_2 with correspond to same column and row.</p>
<pre><code>df_1 = pd.DataFrame([
[0.1, 2, 55, 0,np.nan],
[0.2, 4, np.nan, 1,99],
... | <python><pandas><dataframe> | 2023-02-13 11:34:26 | 2 | 500 | EMT |
75,435,290 | 9,173,710 | opencv single edge detection and contour extraction without closed contour | <p>I'm having trouble extracting a contour from this and other similar streak images.<br />
<a href="https://i.sstatic.net/1NC9m.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1NC9m.png" alt="enter image description here" /></a></p>
<p>First I tried this:</p>
<pre class="lang-py prettyprint-override"><c... | <python><opencv><edge-detection> | 2023-02-13 11:31:30 | 1 | 1,215 | Raphael |
75,435,280 | 4,662,490 | python/regex: match letter only or letter followed by number | <p>I want to split this string 'AB4F2D' in ['A', 'B4', 'F2', 'D'].
Essentially, if character is a letter, return the letter, if character is a number return previous character plus present character (luckily there is no number >9 so there is never a X12).</p>
<p>I have tried several combinations but I am not able to... | <python><regex> | 2023-02-13 11:30:20 | 2 | 423 | Marco Di Gennaro |
75,434,950 | 2,876,079 | How to correctly consider multi index column names for pandas concat? | <p>I have two DataFrames that are indexed by the columns <code>id_a</code>, <code>id_b</code> but in different order:</p>
<pre><code>foo = pd.DataFrame([{'id_a': 1, 'id_b': 1, 'value': 1}])
foo.set_index(['id_a','id_b'], inplace=True)
baa = pd.DataFrame([{'id_b': 2, 'id_a': 1, 'value': 10}])
baa.set_index(['id_b', 'id... | <python><pandas><concatenation><multi-index> | 2023-02-13 10:58:11 | 1 | 12,756 | Stefan |
75,434,907 | 2,463,112 | how to find and export each cell datatype into a csv using python | <p>What is the best way to loop through each line in CSV file and find and export the datatype of each cell into csv file?</p>
<p>Here is the python script I am using with pandas library,</p>
<pre><code>import pandas as pd
out = pd.read_csv("C:\\Users\\Sridhar\\Downloads\\Leads.csv")
dict(out)
</code></pre>
| <python><pandas><dask> | 2023-02-13 10:52:36 | 1 | 2,248 | sridharnetha |
75,434,883 | 6,468,436 | I can not figure out why I can not start this simlple python script | <p>My directory looks like this</p>
<p><a href="https://i.sstatic.net/gRklB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gRklB.png" alt="enter image description here" /></a></p>
<p>When I start directly with PyCharm it works.
But when I try to start the script with a commandline I get this error messs... | <python><pycharm> | 2023-02-13 10:49:55 | 1 | 325 | User1751 |
75,434,833 | 344,162 | Create private composite Github action that runs a python script and is called from another private repo | <p>I have a Python script that I want to run as a final deployment step from several of my repos. Since this script uses the Github API I wanted to abstract all of this logic into its own github action (thus its own separate repo). <a href="https://github.blog/changelog/2022-12-14-github-actions-sharing-actions-and-reu... | <python><github><continuous-integration><github-actions> | 2023-02-13 10:44:55 | 0 | 1,065 | Gustavo Puma |
75,434,737 | 707,145 | shiny for Python using add_layer for Popus from ipyleaflet | <p>I want to use <code>m.add_layer</code> for <code>Popus</code> from <a href="/questions/tagged/ipyleaflet" class="post-tag" title="show questions tagged 'ipyleaflet'" aria-label="show questions tagged 'ipyleaflet'" rel="tag" aria-labelledby="ipyleaflet-container">ipyleaflet</a> in <a href="/questions/... | <python><html><ipyleaflet><py-shiny> | 2023-02-13 10:35:11 | 2 | 24,136 | MYaseen208 |
75,434,681 | 4,151,075 | Type hint decorator for sync & async functions | <p>How can I type hint decorator that is meant to be used for both sync & async functions?<br />
I've tried something like below, but <code>mypy</code> raises errors:</p>
<pre class="lang-py prettyprint-override"><code>x/decorator.py:130: error: Incompatible types in "await" (actual type "Union[Await... | <python><python-typing><python-decorators> | 2023-02-13 10:30:02 | 1 | 1,269 | Marek |
75,434,668 | 1,422,096 | Update a chart in realtime with matplotlib | <p>I'd like to update a plot by redrawing a new curve (with 100 points) in real-time.</p>
<p>This works:</p>
<pre><code>import time, matplotlib.pyplot as plt, numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
t0 = time.time()
for i in range(10000000):
x = np.random.random(100)
ax.clear()
ax.plot(x, c... | <python><matplotlib> | 2023-02-13 10:28:52 | 1 | 47,388 | Basj |
75,434,493 | 20,615,590 | Using terminal on Jupyter Lab not working | <p>I am working on Jupyter Lab, and I opened the terminal. I tried to install the module <code>spacy</code>, but when I came to the part where it said <code>$ python ...</code>, it said <code>/bin/bash: python: command not found</code>.</p>
<p>My code:</p>
<pre><code>$ pip install -U pip setuptools wheel
$ pip install... | <python><powershell><terminal><spacy><jupyter-lab> | 2023-02-13 10:12:03 | 0 | 423 | Pythoneer |
75,434,485 | 11,668,258 | Neo4j python driver | AttributeError: 'Session' object has no attribute 'execute_read' | <p>In the Neo4j Python code, I have an issue while query from Neo4j DB, with getting below error:</p>
<blockquote>
<p>AttributeError: 'Session' object has no attribute 'execute_read'</p>
</blockquote>
<p>I want to convert the results of cypher queries into a JSON format.I am using the neo4j python library to connect th... | <python><python-3.x><neo4j><neo4j-python-driver> | 2023-02-13 10:11:38 | 1 | 916 | Tono Kuriakose |
75,434,453 | 13,568,193 | If dublicate key exists then update in postgres from python pandas | <p>I have a table name stock with (item,date) as index in Postgres database which record monthly record. Then I have pandas dataframe name stock_df which calculate monthly stock.
Now I need to append that stock_df in table stock in postgres in such way that.</p>
<pre><code>If stock_df has same item and same date like i... | <python><pandas><postgresql> | 2023-02-13 10:08:02 | 0 | 383 | Arpan Ghimire |
75,434,294 | 12,931,358 | Cannot copy/move file from remote SFTP server to local machine by Paramiko code running on remote SSH server | <p>I want to copy a file from my SFTP server to local computer. However, when I run my code, it didn't show any error while I still cannot find my file on local computer. My code like that:</p>
<pre><code>import paramiko
host_name ='10.110.100.8'
user_name = 'abc'
password ='xyz'
port = 22
remote_dir_name ='/data/.../P... | <python><ssh><sftp><paramiko> | 2023-02-13 09:51:55 | 1 | 2,077 | 4daJKong |
75,434,262 | 9,475,509 | nbviewer can not display vpython result | <p>If a Jupyter Notebook file is rendering too long in GitHub, it is recommended <a href="https://towardsdatascience.com/jupyter-notebook-not-rendering-on-github-heres-a-simple-solution-e51aa6ca29b6" rel="nofollow noreferrer">here</a> to show it in <a href="https://nbviewer.org/" rel="nofollow noreferrer">nbviewer</a>,... | <python><github><jupyter-notebook><vpython> | 2023-02-13 09:47:56 | 1 | 789 | dudung |
75,434,180 | 5,703,081 | Saving a dictionary with string keys and bytes values to file in Python | <p>I am writing a python program which should be able to run on Windows, iOS and Android.</p>
<p>To handle logins in I have a <code>dict</code> <code>{key_string: hashed_password_bytes}</code> Currently I manually convert any strings to binary and concatenate them all into a binary string I parse when loading credentia... | <python><python-3.x><io><credentials> | 2023-02-13 09:40:19 | 0 | 628 | Flash_Steel |
75,434,178 | 854,585 | Convolve a grid of delta functions, with random positional offsets at the pixel level, with a kernel, in Python | <p>The convolution of a regular grid of Dirac delta functions with a kernel is pretty standard:</p>
<pre><code>import numpy as np
deltas = np.zeros((2048, 2048))
deltas[8::16,8::16] = 1
# Construct a Gaussian kernel
x, y = np.meshgrid(np.linspace(-2, 2, 15), np.linspace(-2, 2, 15))
gauss = np.exp(-(x*x + y*y)/2)
from ... | <python><random><scipy><statistics><convolution> | 2023-02-13 09:40:04 | 1 | 409 | Alex van Houten |
75,434,165 | 653,770 | How do I extend/pad a CDF plot (using seaborn.ecdfplot) to the x-axis limits? | <p>This code:</p>
<pre><code>N = 1000
df = pd.DataFrame({
'distribution_1': np.random.randn(N),
'distribution_2': np.random.randn(N)
})
df['distribution_2'] = df['distribution_2'] / 2
df = df.melt(value_vars=['distribution_1', 'distribution_2'], value_name='value', var_na... | <python><pandas><ggplot2><seaborn> | 2023-02-13 09:38:53 | 1 | 1,292 | packoman |
75,434,074 | 4,495,790 | How to interpret cost in case of K-Prototypes in kmodes, Python? | <p>I'm doing a clustering on mixed (numerical and categorical) type data with <a href="https://github.com/nicodv/kmodes" rel="nofollow noreferrer">kmodes.kprototypes</a> in Python:</p>
<pre><code>from kmodes.kprototypes import KPrototypes
kp = KPrototypes(n_clusters=5, init='Cao')
kp.fit(df, categorical=categorical_co... | <python><cluster-analysis><evaluation> | 2023-02-13 09:30:19 | 1 | 459 | Fredrik |
75,433,926 | 242,944 | Python construct a URL with username and password credentials | <p>I'm trying to port some basic code from JavaScript to Python. In JavaScript the URL class makes this trivial:</p>
<pre><code>const url = new URL('https://python.org');
url.username = 'foo';
url.password = 'bar';
console.log(url.href)
</code></pre>
<blockquote>
<p>https://foo:bar@python.org/</p>
</blockquote>
<p... | <python><python-3.x><url> | 2023-02-13 09:15:20 | 1 | 1,812 | Casey |
75,433,811 | 990,639 | Unable to create URI with whitespace in MarkLogic | <p>I have created a Marklogic transform which tries to convert some URL encoded characters: [ ] and whitespace when ingesting data into database. This is the xquery code:</p>
<pre><code>xquery version "1.0-ml";
module namespace space = "http://marklogic.com/rest-api/transform/space-to-space";
decl... | <python><rest><marklogic> | 2023-02-13 09:03:04 | 2 | 1,147 | Eugene |
75,433,717 | 18,949,720 | module 'keras.utils.generic_utils' has no attribute 'get_custom_objects' when importing segmentation_models | <p>I am working on google colab with the segmentation_models library. It worked perfectly the first week using it, but now it seems that I can't import the library anymore. Here is the error message, when I execute import segmentation_models as sm :</p>
<pre><code>-------------------------------------------------------... | <python><tensorflow><keras><google-colaboratory><image-segmentation> | 2023-02-13 08:54:42 | 6 | 358 | Droidux |
75,433,358 | 6,930,340 | How to handle Unsupported operand types in mypy when type should be clear? | <p>Consider the following toy example.</p>
<pre><code>class MyClass:
def __init__(self, optional_arg: float | None = None) -> None:
self.optional_arg = optional_arg
self._parse_args()
def _parse_args(self) -> None:
if self.optional_arg is None:
self.optional_arg = 0.5... | <python><mypy> | 2023-02-13 08:17:35 | 2 | 5,167 | Andi |
75,433,252 | 2,531,161 | Python annotation for list of specific types | <p>I would like to annotate a <code>list</code> of a <code>str</code> and an <code>int</code>, e.g.:</p>
<pre><code> state = ['mystring', 4]
</code></pre>
<p>I can't use tuple, becuase I have to change the integer without changing the reference of the state (it is passed to functions, which also have to modify it). ... | <python><list><python-typing> | 2023-02-13 08:06:30 | 1 | 500 | FERcsI |
75,433,241 | 19,238,204 | Python Pandas Error: 'DataFrame' object has no attribute 'Date' | <p>I am trying this (<a href="https://towardsdatascience.com/analyzing-world-stock-indices-performance-in-python-610df6a578f" rel="nofollow noreferrer">https://towardsdatascience.com/analyzing-world-stock-indices-performance-in-python-610df6a578f</a>) on Jupyter Notebook with Python 3.9.13</p>
<p>The full code:</p>
<pr... | <python><pandas> | 2023-02-13 08:05:11 | 2 | 435 | Freya the Goddess |
75,433,217 | 9,092,563 | How do you add environment variables to a python scrapy project? dotenv didn't work | <p>I'm having trouble incorporating an IP address into a format string in my Python Scrapy project. I was trying to use python-dotenv to store sensitive information, such as server IPs, in a .env file and load it into my project, instead of hardcoding it.</p>
<p>I added python-dotenv to the settings.py file of my Scrap... | <python><scrapy><environment-variables><python-dotenv> | 2023-02-13 08:02:23 | 1 | 692 | rom |
75,433,179 | 2,604,247 | How to form an OPCUA connection in python from server IP address, port, security policy and credentials? | <p>I have never used OPC-UA before, but now faced with a task where I have to pull data from a OPC-UA machine to push to a SQL database using python. I can handle the database part, but how to basically connect to the OPCUA server when I have only the following fields available?</p>
<ul>
<li>IP address 192.168.38.94</l... | <python><opc-ua><connectivity><opc> | 2023-02-13 07:58:38 | 1 | 1,720 | Della |
75,433,136 | 14,673,832 | How to convert s-expression which is in string into a tuple in Python | <p>I have an S-expression in Python which I need to convert it into tuple with operators (add,multiply) inside the semi-colon ie as a string.</p>
<p>I have the following code snippet:</p>
<p>This code works fine, but the requirement of the work is that the user doesnot input tuple like <code>('add', ('multiply', 3, 4),... | <python><command-line><tuples><s-expression> | 2023-02-13 07:53:37 | 1 | 1,074 | Reactoo |
75,433,096 | 6,113,142 | Combine two dataframes cell-wise by a third func mapping dataframe | <p>Consider <code>df_a</code> and <code>df_b</code> where</p>
<ol>
<li><code>df_a.index == df_b.index</code></li>
<li><code>df_a.columns == df_b.columns</code></li>
<li><code>df_a.dtypes == df_b.dtypes == float</code></li>
</ol>
<p>Now I have <s>another dataframe</s>, <code>op</code>, a <code>pd.Series</code> where</p>... | <python><pandas> | 2023-02-13 07:47:57 | 1 | 350 | Pratik K. |
75,433,011 | 9,648,374 | Convert column containing '.' in dataframe to dictonary | <p>I want to convert df to df1</p>
<pre><code>df = pd.DataFrame({'A': [1], 'in.1': [8977], 'in.2': [8977], 'B': [
{
"C.i": 87387460,
"C.j":233
}]})
df1 = pd.DataFrame({'A': [1], 'in':{'1': [8977], '2': [8977]}, 'B': [
{"C":{
"i": 87387460,
... | <python><pandas><dataframe> | 2023-02-13 07:35:49 | 2 | 489 | Isha Nema |
75,432,454 | 17,696,880 | Split this string into substrings that are in middle of certain patterns, and within them a pattern and 3 different words, or more, from it? | <p>I was trying several ways to divide these strings according to the separators that are in the <code>separator_symbols</code> variable, but only if the content in the middle meets the fact that there is a substring that meets the sequence of the pattern <code>"\(\(VERB\)\s*\ w+(?:\s+\w+)*\)"</code> and that... | <python><python-3.x><regex><split><regex-group> | 2023-02-13 06:21:02 | 0 | 875 | Matt095 |
75,432,168 | 188,331 | Juypter Lab is running with GPU (claimed to be), but nvidia-smi said otherwise | <p>Here is the output of <code>nvidia-smi</code> when the GPU-intensive codes are running:</p>
<pre><code>$ nvidia-smi
Mon Feb 13 10:20:42 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.11 Driver Version: 525.60.11 CUDA Version: 12.0 |
|---------------... | <python><pytorch><gpu><jupyter-lab> | 2023-02-13 05:29:26 | 1 | 54,395 | Raptor |
75,432,155 | 10,620,003 | Put the values in the middle of the bars in histogram plot | <p>I have a histogram plot and I want to add the values of the VAL in the middle of the bar plot with a color which are fitted with the color of the bar. Thank you. Like the following image I only use the black color to show the number <a href="https://i.sstatic.net/OToRB.png" rel="nofollow noreferrer"><img src="https:... | <python><matplotlib><histogram> | 2023-02-13 05:26:29 | 2 | 730 | Sadcow |
75,432,101 | 19,950,360 | how to create plotly histogram with two columns | <p>I have dataframe like this</p>
<pre><code>df = pd.DataFrame({'_3321131460': ['col1', 'col1', 'col2'], '_3952604542': ['col1', 'col2', 'col2']})
df
</code></pre>
<p>So want to create graph like this
<a href="https://i.sstatic.net/egOcD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/egOcD.png" alt="ent... | <python><graph><plotly> | 2023-02-13 05:15:43 | 1 | 315 | lima |
75,432,098 | 4,420,797 | OSError: [Errno 28] No space left on device: Unzip file on HPC Cloud Server | <p>I am unzip file of 35.8 GB and have a <code>1.7 TB</code> space in my Virtual machine to extract zip file. Also, I already give all security permission to execute it but still stuck on <code>no space left</code></p>
<p>Directory is<code> /home2/coremax</code> and you can see <code>10.100.201.21:/cloudhome/coremax 20... | <python><zip><extract><torch><unzip> | 2023-02-13 05:15:17 | 1 | 2,984 | Khawar Islam |
75,431,947 | 10,964,685 | Display interactive metrics within dbc.Card - Dash | <p>I'm aiming to include interactive counts as metrics. Specifically, insert total sums within cards that will changed depending on the variable selected from a nav bar.</p>
<p>Using below, the Navbar is used to display the proportion of successes and failures as a pie chart. I want to use the corresponding sums of <em... | <python><plotly-dash><dash-bootstrap-components> | 2023-02-13 04:40:13 | 1 | 392 | jonboy |
75,431,791 | 2,782,382 | Finding (unique) set of values across columns | <p>I have a Polars Dataframe that looks like the below</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
'id': [1, 2, 3],
'attribute': [True, True, False],
'val1': ['A', 'A', 'A'],
'val2': ['A', 'A', 'B'],
'val3': ['A', 'B', 'C'],
})
</code></pre>
<p>I woul... | <python><dataframe><python-polars> | 2023-02-13 03:58:22 | 1 | 1,353 | Chris |
75,431,639 | 18,022,759 | Python list converting oddly to NumPy array | <p>I have a python <code>list</code>:</p>
<pre><code>[[([1, 20230112060000], [10000, 20230112060000]),
([1, 20230108060000], [7000, 20230109060000]),
([3, 20221229060000], [6929, 20221229060000]),
([1, 20221227060000], [3900, 20221227060000]),
([1, 20221226060000], [6500, 20221226060000]),
([1, 20221221060000... | <python><arrays><python-3.x><numpy> | 2023-02-13 03:16:27 | 1 | 976 | catasaurus |
75,431,636 | 9,773,920 | Reorder sheets of an existing excel file in S3 - Python Lambda | <p>I am generating an excel file with multiple sheets in the below order:</p>
<pre><code>["COMP1_hires","COMP2_hires","COMP1_det","COMP2_det"]
</code></pre>
<p>I want to re-order the sheets in the below order:</p>
<pre><code>["COMP1_hires","COMP1_det","CO... | <python><pandas><amazon-s3><aws-lambda><openpyxl> | 2023-02-13 03:14:07 | 0 | 1,619 | Rick |
75,431,596 | 847,200 | Parallel fitting of single tf.keras.Model on single GPU | <p>I'm trying to train a single model with a huge dataset on a single GPU. I don't mind setting smaller batch size, since I'll be running this for a while anyway, but what bothers me is that the GPU is utilized only by 25% when training the model. I have plenty of spare CPU and GPU capacity that could be used to fit th... | <python><tensorflow><keras><gpu> | 2023-02-13 03:04:56 | 0 | 25,467 | Arsen Zahray |
75,431,587 | 10,380,766 | type hinting with Unions and collectables 3.9 or greater | <p>I've been on Python 3.8 for quite some time. I usually type hint with the convention:</p>
<pre class="lang-py prettyprint-override"><code>from typing import List, Union
some_stuff: List[Union[int, str, float, List[str]]] = [98, "Fido", -34.925, ["Phantom", "Tollbooth"]]
</code></pre>
<... | <python><python-typing> | 2023-02-13 03:03:02 | 2 | 1,020 | Hofbr |
75,431,355 | 2,005,559 | generating synthetic data using scikit-learn for ML | <p>I have data at some given temperature [30, 40,45...].</p>
<p>Is it possible to generate synthetic data for other temperatures using scikit-learn or any other library?</p>
<p>I am using the existing data and the python code to get the mean plot.</p>
<pre><code>#!/usr/bin/env python
import matplotlib.pyplot as plt
imp... | <python><machine-learning> | 2023-02-13 01:58:43 | 1 | 3,260 | BaRud |
75,431,224 | 3,261,292 | Getting "Method Not Allowed" when using fastapi | <p>I am trying to run the following code but I am getting a <code>{"detail":"Method Not Allowed"}</code> error when I open <code>http://localhost:8000/predict</code>.</p>
<p>The code:</p>
<pre><code>from fastapi import FastAPI
app = FastAPI()
@app.post("/predict")
def predict_(request: s... | <python><http-post><fastapi> | 2023-02-13 01:22:41 | 1 | 5,527 | Minions |
75,431,149 | 7,376,511 | subclass inheriting annotations from parent class for a function | <pre><code>class A:
def test(self, value: int, *args: str, **kwargs: int) -> str:
pass
class B(A)
def test(self, value, *args, **kwargs):
# do some stuff
super().test(value)
</code></pre>
<p>Is there a way to tell mypy that the subclass's <code>test</code> has identical typing as t... | <python><mypy> | 2023-02-13 01:02:22 | 2 | 797 | Some Guy |
75,430,987 | 3,343,783 | Cannot add a column (pandas `Series`) to a Dask `DataFrame` without introducing `NaN` | <p>I am constructing a Dask <code>DataFrame</code> from a <code>numpy</code> array and after this I would like to add a column from a <code>pandas</code> <code>Series</code>.</p>
<p>Unfortunately the resulting dataframe contains <code>NaN</code> values, and I am not able to understand where the error lies.</p>
<pre><co... | <python><pandas><dask-dataframe> | 2023-02-13 00:14:06 | 1 | 3,486 | Nisba |
75,430,842 | 9,365,845 | Is it possible to prevent circular imports in SQLAlchemy and still have models in different files? | <p>I'm new to SQLAlchemy and I'm trying to build models in different files. My model looks like this :</p>
<pre class="lang-py prettyprint-override"><code>from typing import List, Optional
from uuid import UUID, uuid4
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy.orm import relationship
from database... | <python><sqlalchemy> | 2023-02-12 23:32:39 | 2 | 329 | RomainM |
75,430,780 | 8,513,648 | Emulating python msvcrt module's kbhit() on Unix | <p>I am trying to write python code for Unix/Posix systems that emulates the <code>kbhit()</code> and <code>getch()</code> functions in the Windows <code>msvcrt</code> module. There's actually a few solutions online on how to do this; my problem is that none of the <code>kbhit</code> solutions I've found (even on stac... | <python><unix><tty> | 2023-02-12 23:14:53 | 1 | 1,941 | J-L |
75,430,663 | 8,010,921 | streaming real time audio over UDP | <p>I have been willing to develop an application which transmits real-time audio over a local network with the lowest latency possible in python.</p>
<p>So I ran into <a href="https://pyshine.com/How-to-send-audio-from-PyAudio-over-socket/" rel="nofollow noreferrer">this program</a> (the last UDP version) and I have be... | <python><sockets> | 2023-02-12 22:51:15 | 1 | 327 | ddgg |
75,430,562 | 21,046,803 | problem with itertools permutations in combination with english_words_set in a for loop | <p>I want to get all possible words with 5,6,7 characters from a random string: <code>word="ualargd"</code></p>
<p>I do the following:</p>
<ul>
<li>A for loop to change the length of my permutations.</li>
</ul>
<pre><code>for i in range(5,len(word)+1):
mywords=permutations(word, i)
</code></pre>
<ul>
<li>... | <python><for-loop><set><python-itertools> | 2023-02-12 22:19:18 | 1 | 1,539 | tetris programming |
75,430,498 | 107,083 | Options for Bundling a Python web server in Electron? | <p>What are some options for packaging a python web server (i.e. flask, tornado, quart, sanic, etc.) that uses numpy inside an electron application?</p>
<p>I took a look at PyOxidizer, but could not find any examples in the documentation to suggest that this is possible with it.</p>
| <python><numpy><electron><electron-packager><pyoxidizer> | 2023-02-12 22:06:35 | 0 | 18,077 | chaimp |
75,430,433 | 3,533,030 | StableBaselines3 / PPO / model rollsout but does not learn? | <p>When a model <em>learns</em> there is:</p>
<ol>
<li>A rollout phase</li>
<li>A learning phase</li>
</ol>
<p>My models are <em>rolling out</em> but they never show a <em>learning phase</em>. This is apparent both in the text output in a <code>jupyter Notebook</code> in <code>vscode</code> as well as in <code>tensorb... | <python><tensorboard><stable-baselines> | 2023-02-12 21:55:18 | 1 | 449 | user3533030 |
75,430,313 | 1,102,514 | Is it possible to enqueue an instance method, as opposed to a function, using Python-RQ? | <p>The examples provided in the <a href="https://python-rq.org/docs" rel="nofollow noreferrer">Python-RQ</a> documentation consistently show functions being enqueued, using <code>queue.enqueue()</code>. For example:</p>
<p><code>job = q.enqueue(count_words_at_url, 'http://nvie.com')</code></p>
<p>Is it possible to enqu... | <python><redis><task-queue><python-rq><django-rq> | 2023-02-12 21:31:58 | 1 | 1,401 | Scratcha |
75,430,291 | 11,731,185 | Django static files not found in production 1.2 | <p>My code is working fine in the testing environment (DEBUG=TRUE) but when I switch to DEBUG=FALSE, static files are not being loaded.</p>
<p><strong>To run the application I follow</strong>:</p>
<pre><code>python3 manage.py collectstatic --no-input --clear
python3 manage.py runserver
</code></pre>
<p><strong>settings... | <python><django><django-static> | 2023-02-12 21:27:54 | 1 | 1,706 | Ali Solanki YouTuber |
75,430,286 | 8,587,334 | HTML Email content overwrite preview text in email Python | <p>I'm working on a Django app that sends emails, here's my code:</p>
<pre><code> message = MIMEMultipart('alternative')
message["From"] = formataddr(("CustomName", ""))
message["Subject"] = subject
message["Text"] = "My tagline"
template_p... | <python><email><smtp> | 2023-02-12 21:25:48 | 0 | 582 | PietroPutelli |
75,430,161 | 11,236,470 | Cursor.count() gives AttributeError in pymongo 4.3.3 | <p>As the title suggests, I am trying to use <code>count()</code> with a <code>find()</code> on a collection but it keeps throwing the error <code>AttributeError: 'Cursor' object has no attribute 'count'</code>.</p>
<p>For reference, I went through <a href="https://stackoverflow.com/questions/4415514/in-mongodbs-pymong... | <python><pymongo><database-cursor> | 2023-02-12 21:02:47 | 2 | 388 | Eagle |
75,430,107 | 15,900,832 | Python regex non-capturing not working within capturing groups | <p>I was working a regex expression in Python to extract groups. I am correctly extracting the 3 groups I want (symbol, num, atom). However, the 'symbol' group should <strong>not</strong> have the '[' or ']' as I am using 'non-capturing' notation <code>(?:..)</code> per python's docs (<a href="https://docs.python.org/3... | <python><regex> | 2023-02-12 20:52:18 | 1 | 633 | basil_man |
75,430,008 | 148,668 | Can pip install editable avoid recompiling from scratch? | <p>I'm developing a <a href="https://github.com/libigl/libigl-python-bindings/" rel="noreferrer">python module</a> with a long pybind11 C++ extension compilation step invoked via cmake in <code>setup.py</code>.</p>
<p>When making changes to a C++ file, cmake invoked via <code>python setup.py develop</code> will avoid r... | <python><cmake><pip><setup.py><pybind11> | 2023-02-12 20:33:49 | 0 | 6,336 | Alec Jacobson |
75,429,774 | 4,404,805 | Django: Return values based on condition using SerializerMethodField | <p>I have the tables: <code>User</code>, <code>Event</code> and <code>EventTicket</code>. I have to return total transactions and total tickets sold of each event. I am trying to achieve this using Django serializers. Using only serializers, I need to find the following:</p>
<pre><code> 1. total tickets sold: count of ... | <python><django><django-models><django-serializer> | 2023-02-12 19:52:28 | 2 | 1,207 | Animeartist |
75,429,759 | 4,570,472 | W&B - How to construct custom string in sweep based on sweep parameters | <p>I want to use W&B sweep parameters to dynamically construct a command line argument. How can I do this?</p>
<p>Modifying <a href="https://docs.wandb.ai/guides/sweeps/faq" rel="nofollow noreferrer">the W&B's example</a>, suppose I have the following sweep:</p>
<pre><code>program:
train.py
method: grid
param... | <python><wandb> | 2023-02-12 19:49:59 | 1 | 2,835 | Rylan Schaeffer |
75,429,684 | 14,715,170 | How to get value from the different django model in DTL? | <p>I am having 3 different models - <code>User</code>, <code>Thread</code> and <code>UserProfile</code>.</p>
<p><code>User</code> model contains information like <code>ID, First_name and Last_name</code>.</p>
<p><code>Thread</code> model contains information like</p>
<pre><code>class Thread(models.Model):
first_per... | <python><python-3.x><django><django-models><jinja2> | 2023-02-12 19:38:29 | 1 | 334 | sodmzs1 |
75,429,596 | 2,947,435 | OpenAI GPT-3 API: How to parse the response into an ordered list or dictionary? | <p>GPT-3 is amazing, but parsing its results is a bit of a headache, or I'm missing something here?
For example, I'm asking GPT-3 to write something about "digital marketing" and it's returning back some interesting stuff:</p>
<pre><code>\n\n1. Topic: The Benefits of Digital Marketing \nHeadlines: \na. Unlock... | <python><openai-api><gpt-3> | 2023-02-12 19:24:01 | 2 | 870 | Dany M |
75,429,566 | 11,815,307 | Stray Python processes in memory on MacOS 11.6 | <p>I have a Macbook Air M1 from 2020 with MacOS Big Sur (11.6). I regularly use Python with Jupyter notebooks, or from the terminal. To install Python, I use Anaconda3 for MacOS Apple Silicon. I often use Python from different <code>conda</code> environments.</p>
<p>After I close all windows and running python processe... | <python><macos><anaconda><conda> | 2023-02-12 19:20:04 | 1 | 699 | nicholaswogan |
75,429,559 | 661,720 | Ren'Py : ModuleNotFoundError: No module named 'netrc' | <p>Trying to plug openai's API to Ren'Py (to make characters answer to the player)</p>
<p>I installed the openai python module in Ren'Py using this pip command :</p>
<blockquote>
<p>pip install --target /Users/...../GameName/game/python-packages netrc</p>
</blockquote>
<p>And then inside the game I use this to import t... | <python><openai-api><renpy> | 2023-02-12 19:19:34 | 3 | 1,349 | Taiko |
75,429,473 | 4,015,156 | Memory overwriting other memory issue in Numba? | <p>Take the following script:</p>
<pre><code>import numba
@numba.njit
def foo():
lst1 = [[1,2,3,4,5], [6,7,8,9,10]]
for i in range(300):
lst2 = []
lst2.append(1)
del lst1[1]
del lst1[0]
lst1.append([1,2,3,4,5])
lst1.append([6,7,8,9,10])
if len(lst2) > 1:
print("This sh... | <python><list><memory><numba> | 2023-02-12 19:06:05 | 0 | 517 | TheMAAAN |
75,429,196 | 4,446,853 | VS Code Jupyter notebook dark theme for interactive elements | <p>I'm using a dark theme for entire VS Code and I set <code>"jupyter.themeMatplotlibPlots": true</code> to also make the matplotlib plots dark. This setup works great as long as I don't use any <strong>interactive</strong> elements.</p>
<h2>Examples of bad behaviour</h2>
<p>For example if I run <code>%matplo... | <python><matplotlib><jupyter-notebook><ipython><ipympl> | 2023-02-12 18:19:02 | 1 | 759 | Nejc Jezersek |
75,429,095 | 10,197,418 | Inconsistency when parsing year-weeknum string to date | <p>When parsing year-weeknum strings, I came across an inconsistency when comparing the results from <code>%W</code> and <code>%U</code> (<a href="https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes" rel="nofollow noreferrer">docs</a>):</p>
<p><strong>What works:</strong></p>
<pre class="... | <python><date><datetime> | 2023-02-12 18:04:12 | 2 | 26,076 | FObersteiner |
75,429,055 | 3,136,710 | How do I indicate a user's input has ended when writing to a file in Python? | <p>I believe in C we could do ctrl+z for EOF (ctrl+z worked for this), but how do I do this in Python? I'm using <code>'0'</code> temporarily. I'm using Windows 10 with Python 3.11.</p>
<pre><code>#create a text file and write some lines to it
f = open("newfile.txt",'w')
line = ""
while line != '0'... | <python> | 2023-02-12 17:58:16 | 1 | 652 | Spellbinder2050 |
75,429,049 | 2,710,983 | Python Selenium: Getting StaleElementReferenceException on click for SPA website | <p>I'm trying to extract 1000 usernames and the team rosters for each username in a list from this SPA (single page application) sports website (requires free login): <a href="https://rumble.otmnft.com/contest/live?contest=Rumble" rel="nofollow noreferrer">https://rumble.otmnft.com/contest/live?contest=Rumble</a></p>
... | <python><selenium-webdriver><xpath> | 2023-02-12 17:57:14 | 1 | 476 | neo5_50 |
75,428,748 | 258,572 | Building Pybind11 with setuptools for NEON intrinsics | <p>I am trying to compile/bind a python extension written in C++ that uses NEON intrinsics using
setuptools build of PyBind11. But it keep giving me errors.</p>
<p>(arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
#error "N... | <python><setuptools><pybind11><neon> | 2023-02-12 17:13:48 | 1 | 351 | Ooki |
75,428,729 | 3,520,363 | No files found - print folders and file list using a service google account | <p>I enabled the google drive api, created a service account, added the service account email to the folder and successfully generated the .json credentials
But when I try to print the contents of the temp2 folder I get "no files found"
I'm attempting to do it this way</p>
<pre><code>import logging
from googl... | <python><google-cloud-platform> | 2023-02-12 17:10:56 | 1 | 380 | user3520363 |
75,428,689 | 3,120,501 | Flickering windows for Matplotlib animation | <p>I'm trying to create a simulator in Python with Matplotlib as the GUI. I'd like to have a number of different figures, all individually animated - i.e. one showing the main simulation window, another showing graphs, etc. I'm using the Matplotlib set_data() function to animate the plots, rather than clearing and re-d... | <python><matplotlib><animation><simulation><blit> | 2023-02-12 17:03:54 | 1 | 528 | LordCat |
75,428,616 | 4,404,805 | Django - Find sum and count of values in child table using serializers | <p>I have two tables: <code>Event</code> and <code>EventTicket</code>. I have to return total transactions and total tickets sold of each event. I am trying to achieve this using Django serializers. Using only serializers, I need to find the following:</p>
<pre><code> 1. total tickets sold: count of items in EventTicke... | <python><django><django-serializer> | 2023-02-12 16:52:41 | 2 | 1,207 | Animeartist |
75,428,512 | 1,519,304 | matplotlib.plt adds an unwanted line when using fill_between | <p>Question about using <code>fill_between</code>:</p>
<p>Using <code>fill_between</code> in the following snippet adds an unwanted vertical and horizontal line. Is it because of the parametric equation? How can I fix it?</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 2 * np.pi, 10... | <python><matplotlib> | 2023-02-12 16:34:09 | 1 | 1,073 | NNsr |
75,428,484 | 726,730 | QTreeWidget clear empty space at the bottom of widget | <p>Is this example i have a QTreeWidget with 4 columns. The last column is filled by QFrames.</p>
<p><strong>File ui.py</strong></p>
<pre class="lang-py prettyprint-override"><code>from PyQt5 import QtCore, QtGui, QtWidgets
import sys
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
... | <python><pyqt5><qtreewidget> | 2023-02-12 16:30:57 | 1 | 2,427 | Chris P |
75,428,181 | 8,953,248 | Is there official documentation for python's len() function warning that it can sometimes return apparently wrong values for some strings? | <pre><code>$ python
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> for name in ["Blue Oyster Cult", "Blue Öyster Cult", "Spinal Tap", "Spın... | <python> | 2023-02-12 15:42:08 | 3 | 618 | Ray Butterworth |
75,428,125 | 3,045,351 | Package geobuf returning NoneType when trying to convert .pbf to json | <p>I am downloading a .pbf file from the following location:</p>
<pre><code>https://api.mapbox.com/v4/tableau-enterprise.ctcaz7rr/4/7/5.vector.pbf?sku=101NmEGuqERal&access_token=pk.eyJ1IjoidGFibGVhdS1lbnRlcnByaXNlIiwiYSI6ImNrY29iZjN6MzA4ZzgycHF6MHd0cXhyaXoifQ.rtfFAKyzk-qMYue5C-8RVA
</code></pre>
<p>This returns a J... | <python><python-3.x><geojson><osm.pbf> | 2023-02-12 15:31:22 | 0 | 4,190 | gdogg371 |
75,428,029 | 1,883,795 | *minimal, fast* least-squares function for python | <p>Is there a pre-existing library that does the equivalent of</p>
<pre><code>B = np.linalg.inv(X.T @ X) @ X.T @ y
return B
</code></pre>
<p>and nothing else?? I want something fast and minimal (i.e.: no pvalues, no standard errors). Obviously I've already done it above, but I don't want to write my own unit tests or... | <python><least-squares> | 2023-02-12 15:17:57 | 1 | 3,582 | generic_user |
75,427,978 | 2,131,659 | How to survive revert_mainfile() in memory? | <p>I'm trying to reload the blend file inside the loop in my script. Modal operator doesn't work, because after scene reload the operator's instance dies.</p>
<p>So, I create my own class, which has my loop in generator, which yields after calling
revert_mainfile(), and returning control to it from blender's callbacks ... | <python><blender><reload> | 2023-02-12 15:10:14 | 1 | 319 | Mechanic |
75,427,829 | 127,508 | Why does the same hash function of Python and Rust produce different result for the same string? | <p>TL;DR:</p>
<p>With the same parameters both hash functions produce the same results. There are few pre-conditions have to be met to achieve that.</p>
<p>I am building a system that has parts in Rust and Python. I need a hashing library that produces the same values for the same input on both ends. I thought that Pyt... | <python><rust><hash> | 2023-02-12 14:47:37 | 1 | 8,822 | Istvan |
75,427,671 | 4,865,723 | Test for instantiation of a mocked class in Python? | <p>I want to make my tests "real" unittests in a strict meaning. There shouldn't be any dependencies. All dependencies should be mocked.</p>
<p>The class <code>Bar</code> in module <code>bar</code> need to be tested. But in some situations it will have a member of type <code>Foo</code> from module <code>foo</... | <python><unit-testing><mocking> | 2023-02-12 14:23:03 | 1 | 12,450 | buhtz |
75,427,538 | 1,574,054 | RegularGridInterpolator excruciatingly slow compared to interp2d | <p>Consider the following code example:</p>
<pre><code># %%
import numpy
from scipy.interpolate import interp2d, RegularGridInterpolator
x = numpy.arange(9000)
y = numpy.arange(9000)
z = numpy.random.randint(-1000, high=1000, size=(9000, 9000))
f = interp2d(x, y, z, kind='linear', copy=False)
f2 = RegularGridInterpol... | <python><scipy><interpolation><deprecation-warning><linear-interpolation> | 2023-02-12 14:04:28 | 3 | 4,589 | HerpDerpington |
75,427,436 | 3,360,096 | Mocker.patch a function when unit testing a Flask blueprint | <p>I've got a blueprint file <code>/views/index.py</code>:</p>
<pre><code>from flask import Blueprint, render_template
index = Blueprint('index', __name__)
def auth():
return "dog"
@index.route('/')
def index_view():
return render_template(
'index.html', user=auth())
</code></pre>
<p>This is... | <python><python-mock> | 2023-02-12 13:48:33 | 1 | 762 | penitent_tangent |
75,426,952 | 6,564,294 | Strange pandas behaviour. character is found where it does not exist | <p>I aim to write a function to apply to an entire dataframe. Each column is checked to see if it contains the currency symbol '$' and remove it.</p>
<p>Surprisingly, a case like:</p>
<pre><code>import pandas as pd
dates = pd.date_range(start='2021-01-01', end='2021-01-10').strftime('%d-%m-%Y')
print(dates)
</code></pr... | <python><pandas> | 2023-02-12 12:22:08 | 1 | 324 | Chukwudi |
75,426,868 | 2,723,298 | TensorFlow GPU problem 'libnvinfer.so.7' and ' 'libnvinfer.so.7'' could not load | <p>I installed TensorFlow under <a href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux#WSL_2" rel="nofollow noreferrer">WSL 2</a>, <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_22.04_LTS_(Jammy_Jellyfish)" rel="nofollow noreferrer">Ubuntu 22.04</a> (Jammy Jellyfish), I followed the in... | <python><tensorflow><gpu> | 2023-02-12 12:08:30 | 2 | 538 | BARIS KURT |
75,426,783 | 655,404 | Interfacing MIDI device (Akai LPD8 mk2) from Python - works for reading but not sending | <h1>Preface</h1>
<p>I have an <a href="https://www.akaipro.com/lpd8-mk2" rel="nofollow noreferrer">Akai LPD8 mk2</a> which I would like to interface from Python.</p>
<p>There are two projects that (I believe) provide interfaces for the predecessor (mk1):</p>
<ul>
<li><a href="https://github.com/zetof/LPD8" rel="nofollo... | <python><midi> | 2023-02-12 11:53:50 | 0 | 1,906 | NichtJens |
75,426,621 | 10,613,037 | How to write to the cell below level 0 of a multiindex | <p>I've got a df with a MultiIndex like so</p>
<pre class="lang-py prettyprint-override"><code>nums = np.arange(5)
key = ['kfc'] * 5
mi = pd.MultiIndex.from_arrays([key,nums])
df = pd.DataFrame({'rent': np.arange(10,60,10)})
df.set_index(mi)
</code></pre>
<pre><code>
rent
kfc 0 10
1 20
2 30
... | <python><pandas> | 2023-02-12 11:22:35 | 1 | 320 | meg hidey |
75,426,519 | 2,487,835 | Map array values to unique sequential values sorted by occurences | <p>In my ML app, I use an output 1D np.array Y to color code a scatterplot dots.
I need to bring a variety of widely distributed integer values to sequential integers to utilize better distribution of colors in the colormap.</p>
<p>What I did is this:</p>
<pre><code>def normalize(Y):
U = np.unique(Y)
for i in r... | <python><numpy><numpy-ndarray> | 2023-02-12 11:05:33 | 4 | 3,020 | Lex Podgorny |
75,426,461 | 12,574,341 | Check if generator is empty without consuming it | <p>I filter a location for entities other than the player:</p>
<pre class="lang-py prettyprint-override"><code>entities = filter(lambda entity: entity != player, location.entities)
</code></pre>
<p>If there are any entities, print each one of them:</p>
<pre class="lang-py prettyprint-override"><code>if any(entities):
... | <python><iterator> | 2023-02-12 10:52:26 | 0 | 1,459 | Michael Moreno |
75,426,142 | 1,497,139 | pure text non latex results for python bibtex parser | <p>see also <a href="https://github.com/sciunto-org/python-bibtexparser/issues/352" rel="nofollow noreferrer">https://github.com/sciunto-org/python-bibtexparser/issues/352</a></p>
<p>currently i am doing:</p>
<pre class="lang-py prettyprint-override"><code>doi=DOI(self.doi)
meta_bibtex=doi.fetchBibtexMeta()
bd=bibtexpa... | <python><bibtex> | 2023-02-12 09:55:05 | 1 | 15,707 | Wolfgang Fahl |
75,426,108 | 1,413,799 | Is there a way to do conditional parsing with python's struct.unpack? | <p>I'm trying to parse out a byte-oriented structure (GMTI dwell data in AEDP-7 format) where the presence of some of the fields is indicated by a 64-bit flag field at the start of the structure.</p>
<p>Because it works so well for earlier parts, I'd like to use Python's <code>struct</code> module to do the parsing. Ho... | <python><parsing> | 2023-02-12 09:46:48 | 0 | 702 | BradHards |
75,426,081 | 10,613,037 | How to attach a groupby aggregate to the original dataframe where the aggregate is placed in a new column at the bottom of each group | <p>I've got a dataframe <code>df = pd.DataFrame({'A':[1,1,2,2],'values':np.arange(10,30,5)})</code></p>
<p>How can I group by <code>A</code> to get the sum of <code>values</code>, where the sum is placed in a new column <code>sum_values_A</code>, but only once at the bottom of each group. e.g.</p>
<pre><code> A va... | <python><pandas><dataframe> | 2023-02-12 09:41:06 | 2 | 320 | meg hidey |
75,425,973 | 16,220,410 | extract data from each pdf in a folder | <p>pic below is the code and output of my pdf, what would like is to extract the data in each pdf file in a folder and paste into an excel file, below is also my initial python code</p>
<p><a href="https://i.sstatic.net/PeMel.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PeMel.png" alt="enter image des... | <python><pdf> | 2023-02-12 09:20:54 | 2 | 1,277 | k1dr0ck |
75,425,967 | 4,935,567 | Keep installed packages between patch updates | <p>Using <em>pyenv</em> is there a way to keep packages installed for a version when upgrading to a different patch release? E.g. suppose I installed <em>IPython</em> with <code>3.11.1</code> and now am installing <code>3.11.2</code>, but want to keep the IPython. My own guess is it's impossible as there are different ... | <python><python-3.x><pyenv><pyenv-virtualenv> | 2023-02-12 09:19:45 | 0 | 2,618 | Masked Man |
75,425,931 | 2,532,496 | Python Link TKinter distribution at runtime | <p>How can I link to a non-default Tkinter (Tk/Tcl) distribution at runtime? The following will link automatically to the default Tkinter. I am on macOS and have custom Tk.Frameworks and Tcl.Framework. I want to be able to link to them when I run my script.</p>
<pre><code>import tkinter as tk
root= tk.Tk()
canvas1 = ... | <python><tkinter> | 2023-02-12 09:14:06 | 0 | 445 | Kelly o'Brian |
75,425,731 | 1,982,032 | Why the data type in last columns is str instead of float? | <p>All the data fomr column B to column K are numbers stored as text in excel file.<br />
<a href="https://i.sstatic.net/JPq3h.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JPq3h.png" alt="enter image description here" /></a></p>
<p>I have uploaded the excel file in dropbox as a sample to test with.<br... | <python><excel><pandas> | 2023-02-12 08:27:25 | 5 | 355 | showkey |
75,425,729 | 18,143,359 | Issue with QR Code reading with OpenCV or Pyzbar | <p>I'm trying to decode a QR Code using Python, or any other language to be honest. I am also familiar with Javascript or PHP, but Python seemed to be the most appropriate one for this task.</p>
<p>This is part of a bigger piece of code that I am writing for a little challenge. I need to extract a password from the QR ... | <python><opencv><qr-code><zbar> | 2023-02-12 08:26:51 | 2 | 639 | Emilien |
75,425,390 | 13,349,539 | Positional operator not working in MongoDB with array elements FastAPI | <p>I have a document that looks like this:</p>
<pre><code>{
"_id": "cc3a8d7f-5962-47e9-a3eb-09b0a57c9fdb",
"isDeleted": false,
"user": {
"timestamp": "2023-02-12",
"name": "john",
"surname": "doe",
... | <python><mongodb><nosql><fastapi> | 2023-02-12 06:59:11 | 1 | 349 | Ahmet-Salman |
75,425,311 | 2,403,819 | tox is not able to recognize python versions installed by pyvenv | <p>I am trying to learn how to use tox for python unit testing on multiple python installations. I have used <code>pyenv</code> to install multiple python installations to the <code>/home/username/.pyenv/versions/version_number/bin/python</code>, where <code>version_number</code> could be 3.9.16, or 3.10.9. I have ad... | <python><pyenv><tox> | 2023-02-12 06:39:13 | 1 | 1,829 | Jon |
75,425,177 | 1,344,144 | Is it possible to check the exact type of parameterized generics at runtime in Python ^3.10? | <p>I have some custom type definitions using parameterized generics. Now at runtime, I want to find out if a variable does have this custom type. Here's a minimal example:</p>
<pre><code>>>> from collections.abc import Callable
>>> MyType = Callable[[int], int]
>>> my_fun: MyType = lambda x: ... | <python><generics><python-typing> | 2023-02-12 05:57:21 | 1 | 1,101 | idleherb |
75,425,140 | 16,853,253 | Flask app showing error showing attribute error when accessing foreignkey value | <p>AttributeError: 'int' object has no attribute 'username' . I don't know why this happening.
In this <code>return jsonify([{'products':c.products, "user": c.user.username} for c in cart])</code> <code>c.user.username</code> throws Attribute error.</p>
<p>Code is below</p>
<p>#Views</p>
<pre><code>@app.route... | <python><sqlalchemy> | 2023-02-12 05:47:39 | 1 | 387 | Sins97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.