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 ⌀ |
|---|---|---|---|---|---|---|---|---|
78,108,880 | 2,998,077 | Error on Google Colab on an installed package | <p>In Google Colab, I am running below lines.</p>
<pre><code>!pip3 install -U scipy
!git clone https://github.com/jnordberg/tortoise-tts.git
%cd tortoise-tts
!pip3 install transformers==4.19.0
!pip3 install -r requirements.txt
!python3 setup.py install
import torch
import torchaudio
import torch.nn as nn
import torch.... | <python><google-colaboratory> | 2024-03-05 15:37:03 | 0 | 9,496 | Mark K |
78,108,839 | 2,599,709 | restricts doesn't seem to be uploaded when using a private endpoint for matching engine | <p>I have a matching engine set up in Google Cloud that is on a VPC. I'm uploading vectors and trying to use the <code>restricts</code> attribute to save some metadata for limiting searches later on.</p>
<p>When I create my datapoint, it seems like the restricts attribute is there:</p>
<pre class="lang-py prettyprint-o... | <python><gcloud><google-ai-platform> | 2024-03-05 15:30:36 | 1 | 4,338 | Chrispresso |
78,108,792 | 16,759,116 | Why is builtin sorted() slower for a list containing descending numbers if each number appears twice consecutively? | <p>I sorted four similar lists. List <code>d</code> consistently takes much longer than the others, which all take about the same time:</p>
<pre class="lang-none prettyprint-override"><code>a: 33.5 ms
b: 33.4 ms
c: 36.4 ms
d: 110.9 ms
</code></pre>
<p>Why is that?</p>
<p>Test script (<a href="https://ato.pxeger.com/... | <python><algorithm><performance><sorting><time-complexity> | 2024-03-05 15:21:50 | 2 | 10,901 | no comment |
78,108,709 | 11,281,877 | Hybrid deep learning model combining backbone model and handcrafted features | <p>I have RGB images and I'd like to build a regression model to predict 'Lodging_score' combining densenet121 as backbone and handcrafted features in a csv file. Running my script below, I got the following error ValueError: Layer "model" expects 2 input(s), but it received 1 input tensors. Inputs received: ... | <python><tensorflow><deep-learning> | 2024-03-05 15:09:19 | 1 | 519 | Amilovsky |
78,108,436 | 386,861 | Setting order of categorical columns in Altair histogram | <p>Trying to swap order of columns in histogram.</p>
<pre><code>data = {'Age group': {0: '0 - 4', 1: '12 - 16', 2: '5 - 11', 3: 'not specified'},
'Count': {0: 81.0, 1: 86.0, 2: 175.0, 3: 0.0}}
dp = pd.DataFrame(data)
alt.Chart(dp).mark_bar().encode(
x=alt.X('Age group:N', title='Age group'),
y='Count:Q',
... | <python><pandas><altair> | 2024-03-05 14:26:27 | 2 | 7,882 | elksie5000 |
78,108,381 | 3,990,451 | selenium python how to wait for presence individual elements after table found | <p>I wait for the presence of headers of a table.</p>
<pre><code>headers = wait.until(EC.presence_of_all_elements_located((By.XPATH, "//table[@class='react-table']/thead/tr/th/span")))
</code></pre>
<p>headers is then a python list of webelements.</p>
<p>However when I iterate over that list with a variable <... | <python><selenium-chromedriver> | 2024-03-05 14:17:21 | 1 | 982 | MMM |
78,108,326 | 1,595,417 | Deadlock in Python garbage collection on exception | <p>I have encountered a strange situation where a program won't exit due to the way python handles exceptions. In this situation, I have an object which owns a Thread, and this Thread is only shut down when the object's <code>__del__</code> method is called. However, if the program "exits" due to an exception... | <python><exception><garbage-collection><python-multithreading><deadlock> | 2024-03-05 14:07:27 | 1 | 1,019 | xpilot |
78,108,088 | 2,287,486 | Pandas loop for checking the most recent data with conditions | <p>This question shouldn't be closed as I have already checked this question <a href="https://stackoverflow.com/questions/32459325/select-row-by-max-value-in-group-in-a-pandas-dataframe">Select row by max value in group in a pandas dataframe</a> Here it doesn't go back to check the empty values and doesnt have the cond... | <python><pandas><loops> | 2024-03-05 13:30:19 | 1 | 579 | khushbu |
78,107,849 | 2,741,831 | use auxiliary input with keras in middle of network | <p>I have the following models, one is used for calculating trajectories, the other for judging them. The scoring model has all layers, the targeting one only the first half. Both need the targeting parameters to calculate a trajectory and then scoring it respectively. In order for the scoring model to have access to t... | <python><tensorflow><keras> | 2024-03-05 12:49:08 | 1 | 2,482 | user2741831 |
78,107,822 | 3,829,943 | How to refuse to respond using Flask? | <p>I'm using Flask to implement a web service.</p>
<pre class="lang-py prettyprint-override"><code>@app.route('/myservice',methods=['POST'])
def myservice():
if abnormal_activity_detected():
refuse to make any response.
</code></pre>
<p>I'd like to know how to properly refuse to make a response from the serv... | <python><web-services><flask> | 2024-03-05 12:44:51 | 0 | 984 | Chiron |
78,107,775 | 610,569 | How to increase the width of hidden linear layers in Mistral 7B model? | <p>After installing</p>
<pre><code>!pip install -U bitsandbytes
!pip install -U transformers
!pip install -U peft
!pip install -U accelerate
!pip install -U trl
</code></pre>
<p>And then some boilerplates to load the Mistral model:</p>
<pre><code>from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndByte... | <python><huggingface-transformers><attention-model><mistral-7b> | 2024-03-05 12:36:47 | 1 | 123,325 | alvas |
78,107,726 | 2,215,094 | Fake pathlib.Path in class variable using pyfakefs' | <p>I have a class variable of type <code>pathlib.Path</code>.</p>
<pre class="lang-py prettyprint-override"><code>from pathlib import Path
class MyClass:
FILE_PATH = Path('/etc/ids.json')
</code></pre>
<p>I know that <em>pyfakefs</em> is not able to mock this automatically. So in my test I use its <code>Patcher</... | <python><pyfakefs> | 2024-03-05 12:28:47 | 1 | 385 | Jan Schatz |
78,107,698 | 3,433,875 | Showing change in a treemap in matplotlib | <p>I am trying to create this:</p>
<p><a href="https://i.sstatic.net/Duw5g.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Duw5g.png" alt="Treemap in matplotlib" /></a></p>
<p>The data for the chart is:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data = {
&... | <python><matplotlib><treemap> | 2024-03-05 12:22:22 | 1 | 363 | ruthpozuelo |
78,107,528 | 2,641,825 | Using doctest with pandas, how to fix the number of columns in the output example? | <p>I have a package with many methods that output pandas data frame.
I would like to test the examples with pytest and doctest as explained on the <a href="https://docs.pytest.org/en/4.6.x/doctest.html#output-format" rel="nofollow noreferrer">pytest doctest integration page</a>.</p>
<p>Pytest requires the output data f... | <python><pandas><pytest><doctest> | 2024-03-05 11:52:21 | 0 | 11,539 | Paul Rougieux |
78,107,353 | 5,618,856 | How to make a list (or any other value) immutable: a real constant in Python? | <p>In an <a href="https://stackoverflow.com/questions/11111632/python-best-cleanest-way-to-define-constant-lists-or-dictionarys">old discussion</a> I found the reference to typing <code>Final</code>. I tried the example <a href="https://typing.readthedocs.io/en/latest/spec/qualifiers.html#semantics-and-examples" rel="n... | <python><python-3.x><constants><immutability><python-typing> | 2024-03-05 11:22:28 | 1 | 603 | Fred |
78,107,266 | 6,081,921 | Join PySpark ML predictions to identifier data | <p>I'm building a classification model using PySpark and its ML library. In my input dataframe, I have an identifier column (called <code>erp_number</code>) that I want to exclude from building the model (I don't want it to be a feature of the model), but I want to add it back when the predictions are output.</p>
<pre>... | <python><pyspark> | 2024-03-05 11:10:25 | 1 | 954 | cyrilb38 |
78,107,055 | 4,269,851 | Python changing dictionary values in a loop | <p>Shortest spelling to change dict values is (not using one liners)</p>
<pre><code># process array with loop
dct = {1: 'one', 2: 'two', 3: 'three'}
for key, value in dct.items():
dct[key] = 'new'
print(dct)
#{1: 'new', 2: 'new', 3: 'new'}
</code></pre>
<p>According to python manual <code>.values()</code> '<em>... | <python><python-3.x><loops><dictionary> | 2024-03-05 10:40:09 | 2 | 829 | Roman Toasov |
78,107,054 | 1,120,977 | `convert_time_zone` function to retrieve the values based on the timezone specified for each row in Polars | <p>I'm attempting to determine the time based on the timezone specified in each row using <code>Polars</code>. Consider the following code snippet:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
from datetime import datetime
from polars import col as c
df = pl.DataFrame({
"time":... | <python><datetime><timezone><python-polars> | 2024-03-05 10:39:59 | 2 | 2,631 | Sungmin |
78,106,979 | 1,006,955 | u# format character removed from Python 3.12 C-API, how to account for it? | <p>A bunch of unicode-related functionality was removed from the Python 3.12 C-API. Unfortunately for me, there's a very old piece of code (~2010) in our library that uses these and I need to migrate this functionality somehow over to 3.12 since we're looking to upgrade to 3.12 eventually. One thing I'm specifically st... | <python><python-c-api> | 2024-03-05 10:27:58 | 1 | 7,498 | Nobilis |
78,106,890 | 5,790,653 | How to find if one value of dictionary has certain value in a list of dicts | <p>This is my list:</p>
<pre class="lang-py prettyprint-override"><code>list1 = [
{'id': 1, 'custom': 'one'},
{'id': 2, 'custom': 'two'},
{'id': 3, 'custom': 'one'},
{'id': 1, 'custom': 'two'},
{'id': 3, 'custom': 'two'},
{'id': 4, 'custom': 'one'},
{'id': 5, 'custom': 'two'},
]
</code></pre... | <python> | 2024-03-05 10:13:05 | 4 | 4,175 | Saeed |
78,106,793 | 10,750,541 | How to group data and also specify the percentiles in a go.box? | <p>I am trying to achieve a plotly Figure like the following furthier down but instead of the whiskers to show the min and max, I want the percentiles 10th and 90th and I cannot figure a way to make it work.</p>
<p>There is some inspiration <a href="https://stackoverflow.com/questions/70966883/how-to-specify-the-percen... | <python><pandas><plotly><boxplot><plotly.graph-objects> | 2024-03-05 09:56:47 | 0 | 532 | Newbielp |
78,106,617 | 859,604 | Drawbacks of system-site-packages? | <p>An advantage of using the <a href="https://docs.python.org/3/library/venv.html" rel="nofollow noreferrer">venv</a> option <code>--system-site-packages</code> is that it avoids having multiple copies of a given package on one’s system, when several packages rely on the same version of that package (especially handy w... | <python><python-venv> | 2024-03-05 09:30:08 | 0 | 1,115 | Olivier Cailloux |
78,106,497 | 17,624,474 | Pull PubSub Message through Proxy server - Python | <p>I am using this below script to pull message, I have developed as per document but facing error</p>
<pre><code>import json
from googleapiclient.discovery import build
from httplib2 import Http
import httplib2
from oauth2client.service_account import ServiceAccountCredentials
# Replace placeholders with your project... | <python><proxy><google-cloud-pubsub><publish-subscribe><http-proxy> | 2024-03-05 09:07:08 | 1 | 312 | Moses01 |
78,106,328 | 10,639,382 | Updating pandas dataframe using Dash | <p>Hi I am wondering if its possible to develop a dashboard where some inputs (from check boxes/radio items etc.) can update pandas dataframe in the backend.
Basically I am trying to develop a data labeling tool. For example, an image is shown in the dashboard and you pick several classes using check boxes after which ... | <python><plotly-dash> | 2024-03-05 08:35:51 | 1 | 3,878 | imantha |
78,106,285 | 6,212,718 | Polars dataframe: rolling_sum look ahead | <p>I want to calculate <code>rolling_sum</code>, but not over x rows above the current row, but over the x rows below the current row.</p>
<p>My solution is to sort the dataframe with <code>descending=True</code> before applying the <code>rolling_sum</code> and sort back to <code>descending=False</code>.</p>
<p><strong... | <python><python-polars> | 2024-03-05 08:27:01 | 1 | 1,489 | FredMaster |
78,106,213 | 1,367,655 | How to do a nested loop over a variable length list of generators? | <p>I have a list of generators <code>L = [gen_1,...,gen_n]</code> with variable length <code>n</code>.</p>
<p>How can I implement in a compact way the following:</p>
<pre><code>for el_1 in gen_1:
for ...
for el_n in gen_n:
do_something([el_1,...,el_n])
</code></pre>
<p>That should be a fairly co... | <python><generator><combinations><variable-length><nested-for-loop> | 2024-03-05 08:13:47 | 0 | 980 | Radio Controlled |
78,106,147 | 2,964,472 | Python date formatting ValueError: unconverted data remains: | <p>I was just iterating over a log and trying to find the difference in timestamps, between logs.
Below is my unit test code of the problem. Trying to understand why this is not being parsed in the format. Any help will be greatly appreciated.</p>
<pre><code>#import datetime
#import pandas as pd
from datetime import da... | <python><datetime><strptime> | 2024-03-05 08:01:07 | 1 | 1,606 | NarasimhaTejaJ |
78,106,118 | 12,042,622 | Extending a CMake-based C++ project to Python using Pybind11 | <p>I have a (large) C++ project built with CMake, and I am trying to use pybind11 on it. The targets include:</p>
<ol>
<li>to build and run an executable (like a normal C++ project);</li>
<li>to call some C++ methods through python.</li>
</ol>
<p>Therefore, I tried <em>cmake_example</em> (<a href="https://github.com/py... | <python><c++><cmake><pybind11> | 2024-03-05 07:55:25 | 0 | 751 | Joxixi |
78,105,605 | 313,273 | Setting an event loop fails on IPython 8.22.1 / Python 3.11 | <p>Is the following reaction normal or is there a problem with my Python install. From the past hours of reading I just did, it really <em>should</em> work. Otherwise, what am I doing wrong?</p>
<pre><code>Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0]
Type 'copyright', 'credits' or 'license' for more informa... | <python><python-3.x><python-asyncio> | 2024-03-05 06:02:07 | 1 | 2,429 | eje211 |
78,105,399 | 10,200,497 | What is the best way to filter groups by two lambda conditions and create a new column based on the conditions? | <p>This is my DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': ['x', 'x', 'x', 'x', 'y', 'y', 'y', 'y', 'z', 'z', 'z', 'p', 'p', 'p', 'p'],
'b': [1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1]
}
)
</code></pre>
<p>And this the expected output. I want to create column ... | <python><pandas><dataframe><group-by> | 2024-03-05 04:56:30 | 5 | 2,679 | AmirX |
78,105,348 | 1,117,320 | How to reduce python Docker image size | <p>My Python based Docker image is 6.35GB. I tried multi stage build and several other options found while searching( like cache cleanup) Nothing helped.</p>
<p>I might be missing something really important.</p>
<pre><code># Use a smaller base image
FROM python:3.11.4-slim as compiler
# Set the working directory in th... | <python><docker><dockerfile> | 2024-03-05 04:38:49 | 3 | 4,690 | ambikanair |
78,105,199 | 683,482 | Given Data Frame containing string values, how to find the correlation between a group of values in a pandas dataframe column? | <p>I have a dataframe df:</p>
<pre><code>ID District Var1 (Average Down Time) Var2 (Incident Count)
0206571-017 TSUEN WAN 1.2 4
0206571-017 TSUEN WAN 2.1 6
0206571-017 TSUEN WAN 3.0 7
0206571-... | <python><dataframe><correlation> | 2024-03-05 03:38:30 | 1 | 3,076 | Jeff Bootsholz |
78,105,102 | 2,744,242 | Merge multiple sublists where the value is not zero | <p>What is the best way in Python to perform a merge where the value is not 0, resulting in the following outcome?</p>
<pre><code>list = [
[0, 0, 0, '', 0, 0, 0, 0, 0],
[0, 0, 0, 0, 'b', 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 'c', 0, 0],
[0, 0, 0, 0, 0, 0, 0, '', 0],
[0, 0, 0, 0, 0, 0, 0, 0, '']
]
[[0, 0,... | <python> | 2024-03-05 03:01:20 | 1 | 13,406 | rafaelcb21 |
78,104,696 | 1,447,953 | New column, sampled from list, based on column value | <pre><code>values = [1,2,3,2,3,1]
colors = ['r','g','b']
expected_output = ['r', 'g', 'b', 'g', 'b', 'r'] # how to create this in pandas?
df = pd.DataFrame({'values': values})
df['colors'] = expected_output
</code></pre>
<p>I want to make a new column in my dataframe where the colors are selected based on values in an... | <python><pandas><dataframe> | 2024-03-05 00:13:24 | 3 | 2,974 | Ben Farmer |
78,104,587 | 12,309,386 | Polars efficiently extract subset of fields from array of JSON objects (list of structs) | <p><strong>Question</strong>: using Polars, how can I more efficiently extract a subset of fields from an array of JSON objects?</p>
<p><strong>Background</strong></p>
<p>I have a large (~ 300GB) jsonlines/ndjson file where each line represents a JSON object which in turn contains nested JSON.
I am interested in just ... | <python><json><dataframe><python-polars> | 2024-03-04 23:39:18 | 1 | 927 | teejay |
78,104,505 | 14,250,641 | Large Pandas dataframe finding overlapping regions | <p>I have a Pandas DataFrame in pandas with genomic regions represented by their chromosome, start position, and stop position. I'm trying to identify overlapping regions within the same chromosome and compile them along with their corresponding labels. I'm not sure if the way that I'm doing is correct-- also I want an... | <python><pandas><dataframe><bioinformatics> | 2024-03-04 23:08:45 | 1 | 514 | youtube |
78,104,367 | 19,565,276 | Hash function for sets of IDs | <p>Is there a hash algorithm/function in Python that is able to convert sets of unique strings to a single hash string?</p>
<p>For example, a set of <code>{a,b,c}</code> would return some unique ID, the same unique ID as for <code>{c,a,b}</code> or <code>{b,c,a}</code> etc.</p>
| <python><algorithm><hash><set> | 2024-03-04 22:27:01 | 1 | 311 | Lucien Chardon |
78,104,362 | 4,119,262 | Why is a test (100/100) leading to an unexpected output? | <p>I am trying to learn python. In this context, I work on this exercise:</p>
<ul>
<li>I take a fraction from the user (X/Y) and return a result</li>
<li>If Y is greater than X, I prompt the user to provide another fraction</li>
<li>If X or X are not integers, I prompt the user to provide another fraction</li>
<li>If X... | <python><while-loop><break> | 2024-03-04 22:26:12 | 1 | 447 | Elvino Michel |
78,104,317 | 881,637 | I'm recieving an "AttributeError: 'NoneType' object has no attribute '_instantiate_plugins'" error | <p>I have a straightforward Flask app based on a straightforward tutorial, and I'm trying to get my DB credentials out of the code and into an environment variable. I've got <code>DB_CONNECTION_STR</code> defined in <code>.env</code>, which is at the root of my application. The following is the top of my <code>database... | <python><flask><sqlalchemy> | 2024-03-04 22:12:42 | 1 | 1,160 | Taylor Huston |
78,104,294 | 7,090,501 | AzureOpenAI upload a file from memory | <p>I am building an assistant and I would like to give it a dataset to analyze. I understand that I can upload a file that an assistant can use with the following code:</p>
<pre class="lang-py prettyprint-override"><code>from openai import AzureOpenAI
import pandas as pd
client = AzureOpenAI(**credentials_here)
pd.Da... | <python><openai-api><azure-openai><openai-assistants-api> | 2024-03-04 22:06:10 | 1 | 333 | Marshall K |
78,103,980 | 610,569 | What is the expected inputs to Mistral model's embedding layer? | <p>After installing</p>
<pre><code>!pip install -U bitsandbytes
!pip install -U transformers
!pip install -U peft
!pip install -U accelerate
!pip install -U trl
</code></pre>
<p>And then some boilerplates to load the Mistral model:</p>
<pre><code>from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndByte... | <python><huggingface-transformers><huggingface-tokenizers><mistral-7b> | 2024-03-04 20:45:31 | 1 | 123,325 | alvas |
78,103,543 | 2,406,499 | How to get a total count of records in dataframe B for each record on df A based on conditions | <p>I have 2 df's that look like this</p>
<p>services_df</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>Service id</th>
<th>Domain</th>
</tr>
</thead>
<tbody>
<tr>
<td>111</td>
<td><a href="http://www.abc.com" rel="nofollow noreferrer">www.abc.com</a></td>
</tr>
<tr>
<td>222</td>
<td>xyz.com... | <python><pandas><dataframe><google-colaboratory> | 2024-03-04 19:09:17 | 1 | 1,268 | Francisco Cortes |
78,103,535 | 2,157,783 | Pip: unistall ALL pkgs installed during `-e` installation | <p>I just installed a github repo with <code>-e .</code>; That's what I intended to do, only I didn't notice I was in my <code>base</code> conda env rather than in the intended environment.</p>
<p>That package, in turn, installed a sh*tload of dependencies (like something north of ~20 Gb). Now, I'm in need of uninstall... | <python><pip><anaconda><conda> | 2024-03-04 19:06:15 | 1 | 680 | MadHatter |
78,103,459 | 7,746,472 | Import from parallel folder in Python | <p>I can't figure out the way to import from a parallel folder.</p>
<p>Importing from the same directory works fine:</p>
<pre><code>project_folder
-subfolder1
-my_prog.py
-credentials.py
</code></pre>
<p>credentials.py contains</p>
<pre><code>api_key = "supersecretapikey"
</code></pre>
<p>and my_pro... | <python><python-3.x><python-import> | 2024-03-04 18:51:44 | 2 | 1,191 | Sebastian |
78,103,405 | 10,491,381 | Real case ODE using solve_ivp | <p>I'm new to ODEs (Differential equations) and need to model y' = ax</p>
<p>This is the story :
Let's assume that a population increases by 100% per unit of time ( rate = 1)
For example, if at time 1, the population is 1,
at time 2 it will be 2 persons, and at time 3 , there will be 4 persons, at time 4, there will be... | <python><scipy><ode> | 2024-03-04 18:35:25 | 0 | 347 | harmonius cool |
78,103,022 | 10,985,257 | Explanation of reportAttributeAccessIssue of pylance | <p>I have following class</p>
<pre class="lang-py prettyprint-override"><code>class ProcessRunner:
def __init__(self, network: nn.Module) -> None:
self.network: nn.Module = network
def run(self, processes: List[Process]):
for process in processes:
process.network = self.network
... | <python><python-typing><pyright> | 2024-03-04 17:15:41 | 1 | 1,066 | MaKaNu |
78,102,952 | 745,903 | Is there a standard class / type that represents valid Python identifiers? | <p>Being interpreted and lassez-faire, Python often blurs the boundary between what's an entity in the language (like a variable or class) or simply an entry in a runtime dictionary. The perhaps most prominent example are keyword arguments: one can switch between calling a function with individual arguments, whose name... | <python><keyword-argument> | 2024-03-04 17:03:55 | 1 | 121,021 | leftaroundabout |
78,102,923 | 14,338,504 | Is it possible to execute snowflake python code (snowpark.Session) through airflow's SnowflakeOperator? | <p>I have an airflow DAG using SnowflakeOperator with sql="myscript.sql"</p>
<p>I'd like to have another member of this dag using snowflake.Session code, i.e. dataframe code.</p>
<p>Is there an easy way to set this up?</p>
<p>I've read the docs for <a href="https://airflow.apache.org/docs/apache-airflow-provi... | <python><snowflake-cloud-data-platform><airflow> | 2024-03-04 16:57:26 | 1 | 651 | blake |
78,102,877 | 18,690,626 | PyTorch throws batch size error with any value but 1 | <p>I made a neural network model with PyTorch, it kind of resembles the vgg19 model. Every time i enter a value for batch size i got the error:</p>
<pre><code>ValueError: Expected input batch_size (1) to match target batch_size (16).
</code></pre>
<p>This is not happening with the batch size value of 1, it starts train... | <python><machine-learning><pytorch><neural-network> | 2024-03-04 16:51:12 | 1 | 620 | eaidy |
78,102,827 | 6,498,649 | cannot understand python match case | <p>why the two examples give 2 different results? if <code>str()</code> is equal to <code>''</code> the result should be the same.</p>
<pre><code> # example 1
match 'ciao':
case str():
print('string')
case _:
print('default')
# >>> string
# examp... | <python><match><case> | 2024-03-04 16:40:38 | 1 | 403 | Dario Colombotto |
78,102,745 | 9,707,286 | Langchain CSVLoader | <p>Not a coding question, but a documentation omission that is nowhere mentioned online at this point. When using the Langchain CSVLoader, which column is being vectorized via the OpenAI embeddings I am using?</p>
<p>I ask because viewing this code below, I vectorized a sample CSV, did searches (on Pinecone) and cons... | <python><loader><langchain><pinecone> | 2024-03-04 16:29:06 | 1 | 747 | John Taylor |
78,102,664 | 22,221,987 | Importing classes from different module levels causes typehint and argument warning disabling | <p>I have this file structure:</p>
<pre><code> - package
- sub_package_1
- __init__.py
- sub_module_1.py
- sub_package_2
- __init__.py
- sub_module_2.py
</code></pre>
<p>In <code>sub_module_1.py</code> we have this code:</p>
<pre><code>class A:
def __init__(self):
self.b = B()
... | <python><python-3.x><import><path><sys> | 2024-03-04 16:14:45 | 2 | 309 | Mika |
78,102,616 | 4,406,532 | Timeline in Python - creating spaces between dates lines | <p>Following by is the code and its output.</p>
<ol>
<li>Is there a way to create space between the date line to the lower event name, so that there will not be overlapping as seen in the figure.</li>
<li>There is a space between the 'positive' events names and their horizontal tick. Is there a way to eliminate the spa... | <python><matplotlib><time-series><timeline> | 2024-03-04 16:06:36 | 1 | 2,293 | Avi |
78,102,584 | 8,541,953 | Fail to restore conda environment | <p>I have installed some dependencies that have screwed my conda environment. Having my conda environment activated, I am running <code>conda list --revisions</code> I am getting a list. By the date, I would like to select the number 10.</p>
<p>Following the instructions available in the conda documentation, I am tryin... | <python><anaconda><conda><miniconda> | 2024-03-04 16:00:02 | 0 | 1,103 | GCGM |
78,102,413 | 9,462,829 | Change server header on all endpoints (Flask + Nginx + Gunicorn) | <p>I'm working on a Flask app that uses gunicorn and nginx and should hide its server header, so I managed to do it only for the homepage, like this:</p>
<p><code>gunicorn.conf.py</code></p>
<pre><code>import gunicorn
gunicorn.SERVER = ''
</code></pre>
<p><code>nginx.conf</code></p>
<pre><code>events {
worker_conne... | <python><flask><nginx><gunicorn> | 2024-03-04 15:30:50 | 0 | 6,148 | Juan C |
78,102,355 | 1,251,549 | How perform task in airflow that executes regardless of failed tasks but fail the DAG when error appeared in previous tasks? | <p>The scenario is simple airflow DAG starts a cluster, submits a job and terminates cluster. The problem is that the cluster needs to be terminated always. E.g. even when previous task failed. If I add <code>TriggerRule.ALL_DONE</code> - I guarantee that cluster is terminated. But in that case DAG will be successful. ... | <python><directed-acyclic-graphs><airflow-2.x> | 2024-03-04 15:25:08 | 0 | 33,944 | Cherry |
78,102,296 | 13,086,128 | How to group dataframe rows into list in polars group_by | <pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
"Letter": ["A", "A", "B", "B", "B", "C", "C", "D", "D", "E"],
"Value': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
})
</... | <python><dataframe><python-polars> | 2024-03-04 15:17:10 | 3 | 30,560 | Talha Tayyab |
78,101,969 | 2,256,700 | Require decorated function to accept argument matching bound `TypeVar` without narrowing to that type | <p>If I define my decorator like this</p>
<pre class="lang-py prettyprint-override"><code>T = TypeVar('T', bound=Event)
def register1(evtype: Type[T]) -> Callable[[Callable[[T], None]], Callable[[T], None]]:
def decorator(handler):
# register handler for event type
return handler
return deco... | <python><mypy><python-decorators><python-typing><pyright> | 2024-03-04 14:29:06 | 2 | 989 | MaPePeR |
78,101,835 | 12,164,800 | How to find all function calls a defined function makes? (including recursive and futher down the stack calls) | <p>I'm using Python's AST module, and stuck on a given problem (it may be that AST isn't the right tool for this problem).</p>
<p>I want to determine if a given function (let's say "print" as an example) is called, by a defined function.</p>
<p>For example:</p>
<p>file_one.py</p>
<pre class="lang-py prettypri... | <python><abstract-syntax-tree> | 2024-03-04 14:09:27 | 0 | 457 | houseofleft |
78,101,812 | 10,499,034 | How to change internal grid margin in matplotlib scatterplot | <p>I need to be able to add a margin before 0 on the Y axis. to make the second figure below look like the first figure with whitespace before 0. I have tried use_sticky-edges to false and have tried:</p>
<pre><code>plt.margins(0.2,0.2)
</code></pre>
<p>That allows me to change the space on the X axis but the Y axis ... | <python><matplotlib> | 2024-03-04 14:06:33 | 1 | 792 | Jamie |
78,101,782 | 3,114,229 | python file from task scheduler as system | <p>I have created a python script to monitor the current version of MS Edge. When run, the script creates a .txt file called previous_version.txt and writes the version number in the text file. This works well when I run the file manually.</p>
<p>Now I'm trying to add this script to task scheduler and add it as a syste... | <python><scheduled-tasks><pywin32> | 2024-03-04 14:01:51 | 2 | 419 | Martin |
78,101,699 | 103,682 | AttributeError: module 'builtins' has no attribute 'RemovedIn20Warning' | <p>I am trying to run tests and setting certain types of warnings as errors. No matter which warning I set to be treated in pytest.ini I get same exception, just the type changes. What do I need to do to get passed this exception?</p>
<pre><code>ERROR: while parsing the following warning configuration:
error::Remove... | <python><pytest><python-poetry> | 2024-03-04 13:47:22 | 2 | 17,645 | epitka |
78,101,282 | 19,838,445 | pydantic validate all Literal fields | <p>I have multiple pydantic 2.x models and instead of applying validation per each literal field on each model</p>
<pre class="lang-py prettyprint-override"><code>class MyModel(BaseModel):
name: str = ""
description: Optional[str] = None
sex: Literal["male", "female"]
@fie... | <python><python-typing><pydantic><literals> | 2024-03-04 12:37:17 | 1 | 720 | GopherM |
78,101,227 | 10,268,534 | Why I cannot type a `list` parameter in a class with an existing `list` method | <p>I'm working with Python 3.10 and I have this class (which I have simplified):</p>
<pre class="lang-py prettyprint-override"><code>class Greetings:
def list(self) -> list[str]:
return ['ab', 'cd']
def hello(self, names: list[str]) -> None:
for name in names:
print("Hell... | <python><python-typing><python-3.10> | 2024-03-04 12:29:13 | 1 | 478 | pakobill |
78,101,176 | 2,386,113 | Accessing class present in a different folder in Python | <p>I want to access a configuration class in my script. The configuration class is present in a folder which is one level up and then in a separate folder. My folder and file organization is below:</p>
<pre><code>.
├── configs
│ ├── config.json
│ ├── config_manager.py
│ └── __init__.py
└── simulaton_scripts
└... | <python> | 2024-03-04 12:21:01 | 1 | 5,777 | skm |
78,101,036 | 20,954 | WeakMethod in WeakSet | <p>I would like to use the functionality of a <a href="https://docs.python.org/3/library/weakref.html#weakref.WeakSet" rel="nofollow noreferrer"><code>weakref.WeakSet</code></a>, but in this set I would like to store bound methods, so I have to use <a href="https://docs.python.org/3/library/weakref.html#weakref.WeakMet... | <python><python-3.x><weak-references> | 2024-03-04 11:54:33 | 1 | 3,184 | Tom Pohl |
78,100,922 | 2,443,944 | pytorch split array by list of indices | <p>I want to split a torch array by a list of indices.</p>
<p>For example say my input array is <code>torch.arange(20)</code></p>
<pre><code>tensor([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19])
</code></pre>
<p>and my list of indices is <code>splits = [1,2,5,10]</code></p>
<p... | <python><numpy><pytorch><numpy-slicing> | 2024-03-04 11:30:09 | 4 | 2,227 | piccolo |
78,100,828 | 14,045,537 | Is Per-User Retrieval supports open-source vectorstore chromadb? | <p>From the <code>langchain</code> documentation - <a href="https://python.langchain.com/docs/use_cases/question_answering/per_user" rel="nofollow noreferrer">Per-User Retrieval</a></p>
<blockquote>
<p>When building a retrieval app, you often have to build it with multiple users in mind. This means that you may be stor... | <python><langchain><chromadb><vectorstore> | 2024-03-04 11:14:09 | 2 | 3,025 | Ailurophile |
78,100,752 | 4,852,094 | Using A type to define unpacked args from a method | <p>say I have a type:</p>
<pre><code>class MyType(Generic[T, U]):
def foo(self, *args: T) -> U:
pass
m = MyType[tuple[int, bool], str]
</code></pre>
<p>I want to be able to provide the args like:</p>
<pre><code>m.foo(1, True)
</code></pre>
<p>instead of</p>
<pre><code>m.foo((1, True))
</code></pre>
<p>I... | <python><python-typing> | 2024-03-04 11:01:34 | 1 | 3,507 | Rob |
78,100,683 | 12,436,050 | Group by and aggregate the columns in pandas | <p>I have following dataframe.</p>
<pre><code> org_id org_name category org_status created_on modified_on location_id loc_status street_x city country
0 ORG-100023310 advanceCOR GmbH Industry,Pharmaceutical company ACTIVE 2016-10-18T15:38:34.322+02:00 ... | <python><pandas><dataframe> | 2024-03-04 10:49:13 | 2 | 1,495 | rshar |
78,100,661 | 10,967,961 | Scraping hierarchical website in a specific category | <p>I am trying to scrape the following page: <a href="https://esco.ec.europa.eu/en/classification/skill_main" rel="nofollow noreferrer">https://esco.ec.europa.eu/en/classification/skill_main</a>. In particular I would like to click on all plus buttons under S-skills unless there are no more "plus buttons" to ... | <python><html><selenium-webdriver><web-scraping> | 2024-03-04 10:45:40 | 1 | 653 | Lusian |
78,100,348 | 13,628,676 | How to define a dict that maps types with callables that recieve arguments of that type? | <p>In Python, I have trouble defining a type. I would like something like this:</p>
<pre class="lang-py prettyprint-override"><code>def foo(x: int) -> int:
return x
def bar(x: str) -> str:
return x
# [...] MyDictType would be defined here...
my_dict: MyDictType = {
int: foo, # Goo... | <python><generics><python-typing> | 2024-03-04 09:54:15 | 1 | 538 | asmartin |
78,100,152 | 2,205,880 | How to disable introspection on graphene-python? | <p>The <a href="https://docs.graphene-python.org/en/latest/execution/queryvalidation/#disable-introspection" rel="nofollow noreferrer">docs</a> give this explanation:</p>
<pre><code>validation_errors = validate(
schema=schema.graphql_schema,
document_ast=parse('THE QUERY'),
rules=(
DisableIntrospect... | <python><graphql><graphene-python> | 2024-03-04 09:20:11 | 1 | 341 | user2205880 |
78,100,006 | 9,879,534 | How to change cpu affinity on linux with python in realtime? | <p>I know I can use <code>os.sched_setaffinity</code> to set affinity, but it seems that I can't use it to change affinity in realtime. Below is my code:</p>
<p>First, I have a cpp program</p>
<pre class="lang-cpp prettyprint-override"><code>// test.cpp
#include <iostream>
#include <thread>
#include <vec... | <python><linux><affinity> | 2024-03-04 08:55:43 | 1 | 365 | Chuang Men |
78,099,646 | 3,682,549 | pydantic error: subclass of BaseModel expected (type=type_error.subclass; expected_class=BaseModel) | <p>For the below given code i am getting pydantic error:</p>
<pre><code>from langchain.chains import LLMChain
from langchain.output_parsers import PydanticOutputParser
from langchain.prompts import PromptTemplate
from pydantic import BaseModel, Field
query = "Do you offer vegetarian food?"
class LineList(Ba... | <python><pydantic><langchain> | 2024-03-04 07:47:16 | 3 | 1,121 | Nishant |
78,099,555 | 4,399,016 | Pandas Resample 2M and 3M for every month | <p>I have this code to calculate Returns:</p>
<pre><code>import yfinance as yf
import numpy as np
import pandas as pd
df = yf.download('SPY', '2023-01-01')
df = df[['Close']]
df['d_returns'] = np.log(df.div(df.shift(1)))
df.dropna(inplace = True)
df_1M = pd.DataFrame()
df_2M = pd.DataFrame()
df_3M = pd.DataFrame()
d... | <python><pandas><data-wrangling><pandas-resample> | 2024-03-04 07:25:11 | 1 | 680 | prashanth manohar |
78,099,283 | 188,331 | Building a custom tokenizer via HuggingFace Tokenizers library from scratch, some vocabularies are added, but some are not | <p>I try to create a custom Tokenizer via the HuggingFace Tokenizers library from scratch, following <a href="https://huggingface.co/learn/nlp-course/chapter6/8?fw=pt" rel="nofollow noreferrer">this tutorial</a>.</p>
<p>My dataset consists of 80 million Chinese sentences. The structure of my <code>SentencePieceBPEToken... | <python><huggingface-tokenizers> | 2024-03-04 06:24:06 | 0 | 54,395 | Raptor |
78,099,223 | 2,161,073 | Display Nested Categories with Single Model | <pre><code>class ProductCategory(models.Model):
name = models.CharField(max_length=50, blank=True, null=True)
parent_category = models.ForeignKey(
'self', null=True, blank=True, on_delete=models.CASCADE)
category_image = models.ImageField(
upload_to='categories/product/imgs/', verbose_name=_... | <python><django> | 2024-03-04 06:06:58 | 0 | 324 | Devi A |
78,099,166 | 1,230,724 | Running many `pip install -r requirements.txt` concurrently | <p>I'd like to test multiple python projects concurrently. Each project is located in specific directory. Part of the testing is setting up a virtualenv with python packages (via <code>pip install -r requirements.txt</code>). Each project has its respective <code>requirements.txt</code>.</p>
<p>Each project gets its ow... | <python><pip> | 2024-03-04 05:49:22 | 1 | 8,252 | orange |
78,099,132 | 1,609,428 | How to extract and plot the immediate neighbors (and the neighbors of neighbors) in a networkx graph? | <p>Consider the following example</p>
<pre class="lang-py prettyprint-override"><code>import networkx as nx
G = nx.Graph()
G.add_edges_from(
[('A', 'B'), ('A', 'C'), ('D', 'B'), ('E', 'C'),
('H', 'C'), ('Y', 'I')])
nx.draw_networkx(G)
</code></pre>
<p><a href="https://i.sstatic.net/WwKPK.png" rel="nofollow n... | <python><graph><networkx> | 2024-03-04 05:36:54 | 3 | 19,485 | ℕʘʘḆḽḘ |
78,099,041 | 755,934 | sqlalchemy timestamps give inconsistent times for multiple columns | <p>I am using the SQLAlchemy ORM with Flask. Included below is a simplified version of my model:</p>
<pre><code>class RenterLead(BaseModel):
__tablename__ = "renter_leads"
uuid = db.Column(db.String, nullable=False, primary_key=True)
owner = db.Column(db.Integer, db.ForeignKey("users.id&qu... | <python><postgresql><sqlalchemy> | 2024-03-04 05:00:15 | 1 | 5,624 | Daniel Kats |
78,098,939 | 1,592,764 | Python/Telethon on SQLite database operational error: unable to open database file | <p>I have a python/telethon Telegram bot project consisting of a single python file, an SQLite databse, and a config file. The bot runs fine on my local system in a virtual environment (all three files are in the same directory) but when I attempt to run the python file on ubuntu server, I'm running into the following ... | <python><sqlite><permissions><telethon> | 2024-03-04 04:19:52 | 1 | 1,695 | Marcatectura |
78,098,830 | 9,357,484 | Version incompatibility between Spacy, Cuda, Pytorch and Python | <p>I want run spacy in GPu. The configuration that I installed for the Spacy is defined below</p>
<p>Name: spacy</p>
<p>Version: 3.7.4</p>
<p>The Cuda configuration that have in my Ubuntu 20.04.1 LTS based machine is</p>
<p>nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Ju... | <python><pytorch><nlp><spacy> | 2024-03-04 03:32:25 | 0 | 3,446 | Encipher |
78,098,740 | 12,314,521 | Does padded rows (fake inputs) affect backpropagation? | <p>Each row data doesn't have the same size. It looks like this:</p>
<p>Ideally, the shape of input data will be: <code>(batch_size, N, dim)</code></p>
<p>But each row in the batch is not equal dimension. E.g: it can be <code>(k, dim)</code> k < N</p>
<p>To feed to my model I have to add some fake rows called padded... | <python><deep-learning><pytorch><backpropagation> | 2024-03-04 02:52:44 | 0 | 351 | jupyter |
78,098,472 | 1,394,353 | How can I filter all rows of a polars dataframe that partially match strings in another? | <p>I want to delete all rows of a dataframe that match one or more rows in a filtering dataframe.</p>
<p>Yes, I know about filter by <a href="https://stackoverflow.com/questions/77476875/python-polars-how-to-delete-rows-from-a-dataframe-that-match-a-given-regex"><strong>one</strong> regex</a> and I also know how join c... | <python><dataframe><python-polars><bulkupdate> | 2024-03-04 00:50:51 | 2 | 12,224 | JL Peyret |
78,098,383 | 1,592,380 | Ipywidget selection box not opening | <p><a href="https://i.sstatic.net/lGa7V.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lGa7V.png" alt="enter image description here" /></a></p>
<p>I have a jupyter notebook and I'm running leafmap. I'm trying to add a filepicker that will open up a widget to select a local file. I have the following in ... | <python><jupyter-notebook><ipywidgets> | 2024-03-04 00:11:00 | 1 | 36,885 | user1592380 |
78,098,132 | 2,180,100 | Is there a more pythonic way to evaluate "for some"? | <p>Consider the pseudocode</p>
<pre><code>if P(S) for some S in Iterator:
Do something
</code></pre>
<p>When I write this in python I usually end up writing something like</p>
<pre><code>for S in Iterator:
if P(S):
Do something
break
</code></pre>
<p>Or if I want to avoid nesting an if in a lo... | <python><syntactic-sugar><control-structure> | 2024-03-03 22:14:58 | 0 | 729 | Sidharth Ghoshal |
78,098,063 | 4,119,262 | Unexpected result when testing conditional: checks if inputs starts with 0 or ends with numbers | <p>I am trying to learn Python, and in this context I work on a problem.
The problem aims to check if a string of characters:</p>
<ul>
<li>contains 2 characters at minimim and 6 at miximum</li>
<li>starts with 2 letters</li>
<li>if containing numbers, these arrive at the end of the string</li>
<li>the numbers do not st... | <python><string><if-statement> | 2024-03-03 21:48:43 | 1 | 447 | Elvino Michel |
78,097,971 | 999,137 | Langchain : How to store memory with streaming? | <p>I have a simple RAG app and cannot figure out how to store memory with streaming. Should <code>save_context</code> be part of the chain? Or do I have to handle it using some callback?</p>
<p>At the end of the example is <code>answer_chain</code>, where the last step is skipped. I believe it should be something at th... | <python><streaming><langchain> | 2024-03-03 21:14:05 | 1 | 971 | rtyshyk |
78,097,965 | 10,985,257 | Assign values via two subsequent masking operations in pytorch | <p>I have generated two different masks based on values:</p>
<pre class="lang-py prettyprint-override"><code>import torch
values = torch.tensor([0, 0.5, 0.99, 0.87])
saved_values = values + torch.tensor([0.1, -0.4, 0, 0.1])
result = torch.zeros_like(values)
mask1 = values > 0
mask2 = ~torch.greater(saved_values[ma... | <python><pytorch> | 2024-03-03 21:12:22 | 1 | 1,066 | MaKaNu |
78,097,805 | 7,846,884 | how to set output directory in shell in snakemake workflow | <p>the <code>--output_dir</code> in my shell command allows file to be written to that directory.
but i keep getting the error</p>
<pre><code>SyntaxError:
Not all output, log and benchmark files of rule bismark_cov contain the same wildcards. This is crucial though, in order to avoid that two or more jobs write to the ... | <python><snakemake> | 2024-03-03 20:13:57 | 1 | 473 | sahuno |
78,097,764 | 6,943,622 | Apply Operations to Make All Array Elements Equal to Zero | <p>So I attempted this leetcode problem and I was able to come up with a solution that passes 1017/1026 test cases. The remaining that failed did so due to the time limit exceeding and not incorrectness of the solution. So I am wondering if anyone has any ideas on how to optimize my approach. I know it has to do with t... | <python><arrays><sliding-window><prefix-sum> | 2024-03-03 19:57:35 | 1 | 339 | Duck Dodgers |
78,097,735 | 3,930,599 | PubSub async publishing | <p>I wanted to make sure (haven't found it anywhere in the documentation), If I am using PubSub async publishing as part of my service handling request logic (Python Django) -</p>
<pre><code>*handling request*
publish async PubSub messages
*handling request*
returning response
</code></pre>
<p>Is it guaranteed that the... | <python><google-cloud-platform><google-cloud-pubsub> | 2024-03-03 19:47:45 | 0 | 757 | Itai Bar |
78,097,730 | 1,874,170 | Calling SHGetKnownFolderPath from Python? | <p>I've written this minimal reproducible example to calculate the Desktop folder on Windows "the hard way" (using <code>SHGetKnownFolderPath</code>), but I seem to end up with a Success error code while the output buffer only yields <code>b'C'</code> when dereferenced via the <code>.result</code> property of... | <python><ctypes><c-strings><shell32.dll><lpwstr> | 2024-03-03 19:45:57 | 3 | 1,117 | JamesTheAwesomeDude |
78,097,632 | 8,203,926 | Concurrent Futures vs Asyncio Difference | <p>I trying to optimize a Python code by doing it asynchronous. For doing it I tried asyncio and concurrent.futures libraries.</p>
<p>Here are my codes:</p>
<pre><code>async def get_rds_instances(session, region, engine_types):
report_rds = []
mandatory_tags = {'Use-Case'}
client = session.client('rds', re... | <python><asynchronous><python-asyncio><concurrent.futures> | 2024-03-03 19:10:50 | 1 | 972 | Umut TEKİN |
78,097,600 | 5,370,979 | Convert Python code to verify webhook request into C# | <p>I am following the documentation of a payment provider (Lemon Squeezy) where my application needs to verify that webhook requests are indeed coming from the provider. The documentation only has PHP, Node.js, and Python code examples. My application is written in C#.</p>
<p>This is the Python code provided in the doc... | <python><c#><webhooks><digital-signature> | 2024-03-03 19:00:55 | 0 | 461 | nerdalert |
78,097,574 | 2,382,483 | How to setup the netCDF4 package in multistage docker build? | <p>I have an existing dockerfile that runs a python program involving netCDF4. Here's a simplified version:</p>
<pre><code>ARG BASE_IMG=python:3.11-slim
ARG VENV="/opt/venv"
# ------------------------------ #
FROM $BASE_IMG
ARG VENV
RUN apt-get update && \
apt-get upgrade && \
apt-ge... | <python><docker><netcdf><netcdf4> | 2024-03-03 18:52:08 | 1 | 3,557 | Rob Allsopp |
78,097,487 | 315,168 | PyLance in Visual Studio Code does not recognise Poetry virtual env dependencies | <p>I am using Poetry to manage a Python project. I create a virtual environment for Poetry using a normal <code>poetry install</code> and <code>pyproject.toml</code> workflow. Visual Studio Code and its PyLance does not pick up project dependencies in Jupyter Notebook.</p>
<ul>
<li>Python stdlib modules are recognised<... | <python><visual-studio-code><python-poetry><pylance> | 2024-03-03 18:22:15 | 3 | 84,872 | Mikko Ohtamaa |
78,097,421 | 170,966 | How to propagate opentelemetry span context to http request headers in B3 format? | <p>Our organization uses a few different tracing mechanisms. The prominent one is B3. But some services also use Datadog. For the purpose of this question, I am mainly concerned with B3.</p>
<p>I dont want to take dependency on any specific vendor. So I imported <code>opentelemetry</code> python sdk.</p>
<p>Now, I want... | <python><b3> | 2024-03-03 18:00:04 | 1 | 7,644 | feroze |
78,097,305 | 9,315,690 | How can I call a method on a handler created by logging.config.dictConfig in Python? | <p>I'm trying to set up a particular logging scheme for an application I'm building. For it, I want to be able to rotate logs arbitrarily on a custom condition. As such, the built-in options of rotating based on time (using <code>TimedRotatingFileHandler</code>) or log size (using <code>RotatingFileHandler</code>) are ... | <python><logging><python-logging><log-rotation> | 2024-03-03 17:23:11 | 2 | 3,887 | Newbyte |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.