QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,442,052 | 4,398,966 | shallow copy problem with values and references | <p>In python I have:</p>
<pre><code>x = [1,2,3,[4,5,6]]
y = x[:]
x[3][0] = 9
</code></pre>
<p>so now:</p>
<pre><code>x = [1,2,3,[9,5,6]]
y = [1,2,3,[9,5,6]]
</code></pre>
<p>but:
x[0] = 99</p>
<p>then:</p>
<pre><code>x = [99,2,3,[9,5,6]]
</code></pre>
<p>and:</p>
<pre><code>y = [1,2,3,[9,5,6]]
</code></pre>
<p>how com... | <python><shallow-copy> | 2023-11-07 23:33:11 | 0 | 15,782 | DCR |
77,442,036 | 1,874,170 | Renaming/re-declaring functions for CFFI? | <p>I have a C library for which I'm trying to create (out-of-line, API mode) <a href="https://github.com/python-cffi/cffi" rel="nofollow noreferrer">CFFI</a> bindings. The C library provides various implementations of each function, but all of them have this giant, obnoxious prefix added onto them.</p>
<p>For example, ... | <python><namespaces><function-declaration><python-cffi> | 2023-11-07 23:28:37 | 1 | 1,117 | JamesTheAwesomeDude |
77,441,848 | 6,462,301 | How to have plotly subplot subtitles with a multi-line main title? | <p>Consider the following python code:</p>
<pre><code>from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(
rows=2, cols=1,
subplot_titles=("Plot 1", "Plot 2"))
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6]),
row=1, col=1)
fig.ad... | <python><plotly> | 2023-11-07 22:31:04 | 0 | 1,162 | rhz |
77,441,803 | 1,255,016 | Parallel computing in python within recursion | <p>I am interested in parallelizing a <code>func()</code> of a python program, which frequently calls a <code>compute_heavy()</code> function. Noticeably, this parallelization should not be an implementation detail invisible from the outside. One way to parallelize is based on <code>multiprocessing</code> pools:</p>
<p... | <python><parallel-processing> | 2023-11-07 22:19:55 | 2 | 4,452 | hfhc2 |
77,441,623 | 1,925,303 | deptry reports dependencies as unused, although I need them | <p>In my python project, I use poetry version 1.7.0 and have a <code>pyproject.toml</code> containing</p>
<pre><code>[tool.poetry.dependencies]
python = "^3.11"
dogpile-cache = {extras = ["redis"], version = "^1.2.2"}
redis = "^4.5.5"
...
[tool.poetry.group.dev.dependencies]
dep... | <python><python-poetry> | 2023-11-07 21:36:39 | 1 | 1,958 | SBH |
77,441,574 | 6,447,399 | Adding a 3rd chain to langchain to output multiple prompts | <p>I have been following some tutorials on langchain and I have got a little stuck regarding generating an output from some inputs. Basically what I am trying to do is:</p>
<ol>
<li>Input only the "cuisine"</li>
<li>From this, it generates a restaurante name,</li>
<li>The restaurante name gets passed to anoth... | <python><langchain> | 2023-11-07 21:26:42 | 0 | 7,189 | user113156 |
77,441,496 | 3,574,603 | Python: How do I correctly decrypt the text sent from my Ruby script? | <p>I am trying to encrypt text locally in Ruby and decrypt it on the server with Python.</p>
<p>I post the encrypted phrase like so:</p>
<pre class="lang-rb prettyprint-override"><code>require "base64"
require "openssl"
public_key = OpenSSL::PKey::RSA.new File.read './publickey.pem'
encrypted = pub... | <python><rsa><pycryptodome> | 2023-11-07 21:11:25 | 0 | 3,678 | user3574603 |
77,441,429 | 754,136 | Load YAML files in structured folders with OmegaConf | <pre><code>configs
|_________ experiment
| |--------- test.yaml
|--------- default.yaml
</code></pre>
<p><code>default.yaml</code> has some configuration parameters and then</p>
<pre><code>experiment: test.yaml
</code></pre>
<p><code>test.yaml</code> defines more parameters, such as <code>learning_rate: 0.1</co... | <python><yaml><omegaconf> | 2023-11-07 20:57:32 | 1 | 5,474 | Simon |
77,441,417 | 1,492,613 | How can I let pip install dependencies of my current source package without actually installing the package? | <p>According to many suggestions, we are deprecating the <em><a href="https://stackoverflow.com/questions/74506852/what-is-the-requirements-txt-what-should-be-in-it">requirements.txt</a></em> file. So now developers are purely based on dependencies described in <em>setup.py</em> and <em>pyproject.toml</em> (if one want... | <python><pip> | 2023-11-07 20:55:00 | 3 | 8,402 | Wang |
77,441,373 | 2,080,960 | When running my pip package I get ModuleNotFoundError | <p>I have a Python program which works great when running it from the src directory E.g.:</p>
<pre><code>> python start.py
</code></pre>
<p>I've published the package to pip, and after I've installed it and running it I get:</p>
<pre><code>> microservicebus-py
Traceback (most recent call last):
File "/usr/... | <python><python-3.x> | 2023-11-07 20:48:29 | 0 | 963 | wmmhihaa |
77,441,269 | 379,572 | How to convert a Python generator to async generator? | <p>I have a generator function in Python which is IO bound. I'd like to convert it to an async generator, where the generator loop is running in a separate process or thread. For example, loading chunks of data from a socket, where we'd like to load the next chunk while we process the previous. I'm imagining a Queue wo... | <python><multithreading><concurrency><python-asyncio><generator> | 2023-11-07 20:27:49 | 2 | 7,358 | Azmisov |
77,441,245 | 12,436,050 | Group by column and assign value to a new column based on other column values in python | <p>I have following dataframe</p>
<pre><code>col1 col2 col3
HP:0002616 ['HP:0001679'] Abnormal aortic morphology
HP:0002616 ['HP:0002597'] Abnormality of the vasculature
HP:0002616 ['HP:0001626'] Abnormality of the cardiovascular system
HP:0002616 ['HP:0000118'] Phenotypic abnormality
HP:00026... | <python><group-by> | 2023-11-07 20:23:24 | 1 | 1,495 | rshar |
77,441,226 | 7,479,675 | Resizing SVG Images to Specific Dimensions without Visual Alteration using Python | <p>I’m currently working on resizing SVG images using Python and I need some assistance. Specifically, I want to resize any given SVG image to the following dimensions:</p>
<pre><code>width = '512'
height = '512'
viewBox = '0 0 512 512'
</code></pre>
<p>Additionally, I need to redraw the vectors in such a way that the ... | <python><svg> | 2023-11-07 20:20:34 | 0 | 392 | Oleksandr Myronchuk |
77,441,171 | 12,468,387 | Failed building wheel for twisted-iocpsupport | <p>I'm trying to dockerize my django project. When i run "docker build -t django_project" i get following error:</p>
<pre><code>18.82 Building wheel for twisted-iocpsupport (pyproject.toml): started
19.23 Building wheel for twisted-iocpsupport (pyproject.toml): finished with status 'error'
19.24 error: ... | <python><django><docker><twisted><daphne> | 2023-11-07 20:10:17 | 1 | 449 | Denzel |
77,441,136 | 6,594,089 | Multiple instances of inner classes in Python | <p>I'm trying to create a Child class within a Person class, but am having trouble accessing the child object after creation, when more than one instance is created dynamically.</p>
<p>For example, I ask the user how many kids they have, and I then want to create an instance of the inner child class for each child they... | <python><class><inner-classes> | 2023-11-07 20:02:20 | 1 | 459 | LBJ33 |
77,441,030 | 1,471,980 | how do you get job id for splunk saved search in python | <p>I am trying to retrieve job id from splunk using python.</p>
<p>when I do this in curl, it works. It prints out the sid number.</p>
<pre><code>curl -u <username>:<password> -k https://example.com:8089/services/search/jobs -d search="search interface*"
</code></pre>
<p>I get:</p>
<pre><code><... | <python><python-requests><splunk> | 2023-11-07 19:42:21 | 1 | 10,714 | user1471980 |
77,440,909 | 19,130,803 | dash dbc Modal: background more blur or dark | <p>I am working on a dash app.I am using <code>dbc Modal</code> with <code>backdrop=False</code> and getting totally visible background when modal is open. Also I tried <code>backdrop='static'</code> and getting atleast faint background.</p>
<pre><code>import dash_bootstrap_components as dbc
from dash import Input, Out... | <python><plotly><plotly-dash> | 2023-11-07 19:20:23 | 1 | 962 | winter |
77,440,833 | 2,658,278 | Removing non-numeric rows in a Pandas data frame mid-chain | <p>I have a Pandas dataframe with a column called EID. It is mostly integers but there are a few non-numeric values in the column. I'm trying to remove them in the middle of a function chain.</p>
<p>Here are some of the errors I get in the middle of my debugging session:</p>
<pre><code>(Pdb) df.dropna(subset=['EID']).q... | <python><pandas> | 2023-11-07 19:08:18 | 2 | 552 | Josh English |
77,440,686 | 10,634,362 | POST method cannot redirect to HTML page(Backend Flask, Frontend Vanilla JS) | <p>I am trying to use value of dropdown from frontend to backend where on behalf of the dropdown value calculation will be happened and that endpoint will return a HTML page.
Would like to add that, I don't need to get any response from the POST method (eg: <code>return jsonify</code>). So far, I am using <code>Flask</... | <javascript><python><html><flask> | 2023-11-07 18:40:20 | 2 | 701 | karim |
77,440,355 | 4,602,359 | Regular expression with negative lookahead and negative lookbehind to check if my match IS NOT between [[ and ]] | <p>I'm trying to write a Python script which replaces occurrences of given keywords, in given md file, by themself between [[ and ]].</p>
<p>It will be used several times on the same files, so I don't want to end with, for instance, FOO becoming [[FOO]], then [[[[FOO]]]] etc.</p>
<p>So I don't want FOO to be circle wi... | <python><regex><regex-negation><regex-replace> | 2023-11-07 17:42:04 | 2 | 348 | A. Ocannaille |
77,439,657 | 3,104,974 | Refer to Column by Content of Another Column | <p>I have a Dataframe of the following pattern</p>
<pre><code>+---+---+---+---+
|ref| A| B| C|
+---+---+---+---+
| A| 2| 3| 4|
| C| 9| 8| 7|
| B| 5| 6| 7|
+---+---+---+---+
</code></pre>
<p>I want to have a new column that contains the value of the column referenced in <code>ref</code>, so</p>
<pre><code... | <python><pyspark> | 2023-11-07 15:52:55 | 2 | 6,315 | ascripter |
77,439,652 | 2,123,706 | convert column of lists of dictionaries to separate columns | <p>I have:</p>
<pre><code>grp = ["A","B","C","A","C","C","B"]
dictl = ["[{'TypeID': 0, 'Description': 'blah', 'DateCreated': '2018-08-09T14:00:30.957'}]",
"[{'TypeID': 0, 'Description': 'blah', 'DateCreated': '2018-08-09T14:00:30.957'}... | <python><pandas> | 2023-11-07 15:52:09 | 2 | 3,810 | frank |
77,439,647 | 2,725,810 | Unaccounted for time with ThreadPoolExecutor | <p>I have an AWS Lambda function:</p>
<pre class="lang-py prettyprint-override"><code>import boto3
import json
import concurrent.futures
from stats import Timer
client = boto3.client('lambda')
def do_lambda():
timer = Timer()
response = client.invoke(
FunctionName = 'arn:aws:lambda:us-east-1:497857710... | <python><multithreading><performance><aws-lambda><threadpool> | 2023-11-07 15:51:23 | 1 | 8,211 | AlwaysLearning |
77,439,388 | 4,019,775 | Locust - Group multiple api calls into one | <p>Is there a way to group multiple api calls into 1 in the locust report/UI ? I have this specific requirement because I want to acheive 40 transactions/second and in my case 3 api calls in sequential fashion make up for 1 transaction. I have already wrapped all my api calls into 1 task. Here is the code.</p>
<pre><co... | <python><performance-testing><load-testing><locust> | 2023-11-07 15:15:02 | 1 | 884 | Nilamber Singh |
77,439,357 | 5,565,481 | Chrome browser closes immediately after being launched with selenium | <p>Hello im trying to run the following code in python.</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
def v... | <python><google-chrome><selenium-webdriver><testing><automation> | 2023-11-07 15:10:40 | 1 | 861 | Mr_Shoryuken |
77,439,324 | 482,439 | Caddy: How to serve static files from Django | <p>It's my first experience with Caddy and I'm having difficulties configuring it properly concerning static files.</p>
<p>I'm using an Ubuntu server and I'm running Caddy and Django+Gunicorn as Docker containers.</p>
<p>It works perfectly well except that it gives a 404 on static files such as CSS and JS files.</p>
<p... | <python><django><caddy><caddyfile> | 2023-11-07 15:06:25 | 1 | 625 | AntonioR |
77,439,308 | 2,414,957 | fixing the repetitive wave structure in depth map when writing to disk | <p>My depth map has no problem when I visualize it using <code>rviz2</code> however when I save it using <code>astype(np.uint16)</code> after multiplying the depth values by <code>1000</code> as mentioned by the author of BundleSDF git repo here, it saves depth images in problematic shape.</p>
<p>If I use this script t... | <python><numpy><opencv><computer-vision><ros2> | 2023-11-07 15:05:04 | 0 | 38,867 | Mona Jalal |
77,439,294 | 21,404,794 | plotting line between values ignoring NaN values | <p>I'm trying to do a plot with a bunch of data, and I want some of the data, which has NaNs, to be plotted too. The problem I face is that I want a line through the NaN values connecting the other values. If we look at the image, the blue dots should be connected like the orange ones. If there were no NaNs I could dra... | <python><matplotlib> | 2023-11-07 15:02:45 | 1 | 530 | David Siret Marqués |
77,439,288 | 22,128,188 | Encountered error while generating package metadata | <p>Collecting dotenv</p>
<pre><code>Using cached dotenv-0.0.5.tar.gz (2.4 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[77 lines of output]
C:\... | <python><pycharm><python-venv><dotenv> | 2023-11-07 15:02:21 | 1 | 396 | navalega0109 |
77,439,273 | 7,243,493 | order of python dict changes when send as a json response (python 3.11.3) | <p>I am trying to send a python dict to my frontend so can create some html based on the values, i therefore need the order of the dict to be reliable but when i send my dict to the frontend it changes the order.
I am using python 3.11.3</p>
<p>this is python dict i send as a response in add_indicator()</p>
<pre><code>... | <javascript><python><json><dictionary><request> | 2023-11-07 14:59:48 | 1 | 568 | Soma Juice |
77,439,174 | 1,142,881 | How to create a dataclass child instance from a parent's instance? | <p>I have the following <code>dataclass</code> use-case:</p>
<pre><code>from dataclasses import dataclass
@dataclass
class A:
x: int = 0
@dataclass
class B(A):
y: int = 0
a = A(x=5)
# what would a flatten implementation be?
b = B(flatten(a)?, y=6)
</code></pre>
<p>how to accomplish this use-case?</p>
| <python> | 2023-11-07 14:45:21 | 2 | 14,469 | SkyWalker |
77,439,172 | 8,844,500 | 'str' object has no attribute 'base_dtype' using keras_core and tensorflow | <p>I scratch my head on the following (simplistic) problem using keras_core on tensorflow</p>
<pre class="lang-py prettyprint-override"><code>import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import numpy as np
import keras_core as keras
import tensorflow as tf
import torch
print("Keras ve... | <python><tensorflow><keras><pytorch> | 2023-11-07 14:45:08 | 1 | 329 | FraSchelle |
77,439,119 | 13,132,728 | How to turn multiple rows of the same key with one differing column value in to one row consisting of the count of that variable column for each key | <p>I have a dataframe that is structured like so:</p>
<pre><code>pd.DataFrame(
{'col1':['foo','foo','foo','foo','foo','foo'],'col2':['bar','bar','bar','bar','bar','bar'],'col3':['baz','baz','baz','baz','baz','baz'],'varying_column':['x','y','z','d','e','f']},index=['a','b','c','a','a','b']
).reset_index()
m... | <python><pandas> | 2023-11-07 14:38:46 | 2 | 1,645 | bismo |
77,439,089 | 3,044,825 | Popup parameter of ipyleaflet CircleMarker triggers TraitError | <p>I'm trying to make event callback work in <code>ipyleaflet.CircleMarker</code>. I also need to add <code>CircleMarker.popup</code> to see info of marker that I have clicked:</p>
<pre><code>from ipywidgets import HTML
from ipyleaflet import Map, basemaps, CircleMarker#, Popup
address_collection =\
{0: {'address': 'L... | <python><jupyter-notebook><leaflet><ipyleaflet> | 2023-11-07 14:35:15 | 0 | 5,979 | mathfux |
77,438,916 | 11,328,614 | Python pandas, read_fwf | <p>I'm trying to read a table from a text file (or <code>StringIO</code>) into <code>pandas</code>. To accomplish this, I use <code>pandas.read_fwf</code>.</p>
<p>However, I'm facing problems with the automatic column width detection.
In my case it works properly for columns 1-3 but not for column 4, which contains inf... | <python><python-3.x><pandas><datatable><fixed-width> | 2023-11-07 14:13:06 | 0 | 1,132 | Wör Du Schnaffzig |
77,438,791 | 179,581 | Can I make a macOS app made of Python script behave in the Dock like normal apps do? | <p>The executable inside <code>my.app/Contents/MacOS</code> directory is a Python script (<code>app.py</code>) containing:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/python3
import os
from wsgiref.simple_server import make_server
with make_server(host=(host := '127.0.0.1'), port=(port := 1337),
... | <python><macos><dock> | 2023-11-07 13:53:52 | 0 | 11,136 | Andy |
77,438,731 | 7,423,100 | Fixing datatype error in oracledb from Python ORA-01790 | <p>I have the following code:</p>
<pre class="lang-py prettyprint-override"><code>data = [1,2,None,4,5,6]
sql = """
SELECT :1 AS ID, :2 AS pkey, :3 AS issuenum FROM dual UNION ALL
SELECT :4 AS ID, :5 AS pkey, :6 AS issuenum FROM dual
"""
cur = con.cursor()
cur.execute(sql, data)
data = ... | <python><python-3.x><python-oracledb> | 2023-11-07 13:45:51 | 1 | 1,303 | Finrod Felagund |
77,438,628 | 11,203,574 | How to analyze PDF using ChatGPT / Vision python API? | <p>I have a list of pdf files and I want to analyze the first page of each document to extract information. I've tried a lot of free and paid OCR, but in my case, the results aren't good enough.</p>
<p>So I want to try using the ChatGPT API in python. How do I go about it?</p>
<p>Also, I saw in <a href="https://platfor... | <python><pdf><openai-api><chatgpt-api> | 2023-11-07 13:32:03 | 1 | 377 | Aurelien |
77,438,611 | 4,490,376 | How can I test the error message returned by a flask app using render_template() | <p>I'm writing some unittests for a basic flask app. This app takes some data in as a post request and then fires it off to another service, before displaying the response to user on a web-page.</p>
<p>item_blueprint.py</p>
<pre><code>from flask import Blueprint, render_template, request, redirect, session
import requ... | <python><flask><pytest><werkzeug> | 2023-11-07 13:29:34 | 1 | 551 | 741852963 |
77,438,515 | 10,590,609 | Python type hint pickable argument | <p>I want to communicate to users of my code that some function requires a pickable object. Here is an example that abstracts from any project details:</p>
<pre class="lang-py prettyprint-override"><code>import pickle
from typing import Callable
def pickable():
print("I am pickable!")
def get_non_pick... | <python><pickle><python-typing> | 2023-11-07 13:16:29 | 1 | 332 | Izaak Cornelis |
77,438,455 | 9,318,323 | Pandas.pivot TypeError: super(type, obj): obj must be an instance or subtype of type | <p>I have some code that stopped working after updating pandas from 1.3.2 to 2.1.1.
I do not understand why and how to solve it, as the error is unclear to me. Help me figure it.</p>
<p>Snippet of my code:</p>
<pre><code>import pandas as pd
d = {'value': [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
'x_axis... | <python><pandas><dataframe><pivot-table> | 2023-11-07 13:07:57 | 1 | 354 | Vitamin C |
77,438,431 | 3,203,158 | How to create a dummy onnx matching the I/O name, datatype, and shape of a given onnx model? | <p>I possess an ONNX model stored at a specific path, which is integrated into an established software pipeline where modifications are restricted. My objective is to develop a deep learning model and evaluate its compatibility with the existing pipeline. Currently, I am trying to create a dummy ONNX model that mimics ... | <python><pytorch><onnx><onnxruntime> | 2023-11-07 13:04:30 | 0 | 922 | aroyc |
77,438,275 | 12,390,973 | how to add emission related global constraint in pypsa? | <p>I have created a very small program to understand the workings of Pypsa. It has an hourly time interval load profile with random values between 2000MW-3000MW with 1-month total values. To serve this load profile I have added 11 generators:</p>
<pre><code>3 Coal
2 Gas
3 Nuclear
2 Solar
1 Backup
</code></pre>
<p>There... | <python><pandas><pypsa> | 2023-11-07 12:38:38 | 1 | 845 | Vesper |
77,438,251 | 13,518,907 | Langchain ParentDocumetRetriever: Save and load | <p>I am using the PartentDocumentRetriever from Langchain.
Now I first want to build my vector database and then want to retrieve stuff.</p>
<p>Here is my file that builds the database:</p>
<pre><code># =========================
# Module: Vector DB Build
# =========================
import box
import yaml
from langchai... | <python><nlp><langchain> | 2023-11-07 12:36:09 | 3 | 565 | Maxl Gemeinderat |
77,438,162 | 687,739 | How to mutate dataclass argument upon instantiation? | <p>I have a <code>dataclass</code> that looks like this:</p>
<pre><code>@dataclass
class AllLastTick:
tick_type_mapping = {
0: "bid_size",
1: "bid_price",
2: "ask_price",
3: "ask_size",
4: "last_trade_price",
5: "... | <python><python-dataclasses> | 2023-11-07 12:19:28 | 1 | 15,646 | Jason Strimpel |
77,438,149 | 219,976 | Insert large amount of data in table with index in Postgres | <p>I have a table <code>tbl</code> in Postgres with 50 million rows. The <code>tbl</code> has an index on <code>column_1</code> and there are a lot of queries to this table like</p>
<pre><code>select * from tbl
where column_1 = 'value'
</code></pre>
<p>Each query returns 0-30 rows, 10 on avarage.</p>
<p>Once a day I co... | <python><postgresql><indexing><airflow> | 2023-11-07 12:17:08 | 2 | 6,657 | StuffHappens |
77,438,103 | 4,399,016 | Selecting Rows that only match the column values in another data frame in Python | <p>I have a data frame:</p>
<pre><code>>df_idbank.dtypes
DATASET object
IDBANK object
KEY object
FREQ object
INDICATEUR object
CORRECTION_label_en object
</code></pre>
<p>Etc.</p>
<p>I have another data frame:</p>
<... | <python><pandas><dataframe><pandas-loc> | 2023-11-07 12:07:59 | 1 | 680 | prashanth manohar |
77,438,010 | 15,638,204 | Is there a way to call and focus any popup window outside of the main window app? | <p>I am trying to open a popup window when the user types something.</p>
<p>I read somewhere that Windows only allows you to focus a popup window if it has been called form the main window.</p>
<p>I search in the web and found this "work around", not very robust, because the methods to force focus were not wo... | <python> | 2023-11-07 11:52:26 | 1 | 956 | avocadoLambda |
77,437,981 | 15,638,204 | Mypy unable to analyse types of tuple elements in a list comprehension | <p>All presented code samples were tested with Python 3.11, and mypy 1.6.0</p>
<p>And the problem is: mypy sees no problems in the following code:</p>
<pre><code>MyTupleType = tuple[int, str, bool]
Tuples = list[MyTupleType]
def findAllByInt(values : Tuples, ref : int) -> Tuples:
return [v for v in values if v[1... | <python> | 2023-11-07 11:48:22 | 1 | 956 | avocadoLambda |
77,437,716 | 4,435,175 | How to use .assign with with .where() for "condition, true, false" like in numpy.where()? | <p>I have a dataframe df:</p>
<pre><code># %%
import pandas as pd
# %%
values = [("a", 1), ("b", 2), ("c", 3), ("d", 4), ("a", 4), ("b", 6), ("c", 7), ("d", 8)]
df = pd.DataFrame(values, columns=["name", "value"])
# %%
<... | <python><pandas><conditional-statements><conditional-operator> | 2023-11-07 11:10:00 | 2 | 2,980 | Vega |
77,437,694 | 12,242,085 | How to drop duplicates in Data Frame based on combination of values in 2 columns in Python Pandas? | <p>I have Data Frame in Python Pandas like below:</p>
<pre><code>df = pd.DataFrame({
'id' : [999, 999, 999, 185, 185, 185, 999, 999, 999],
'target' : [1, 1, 1, 0, 0, 0, 1, 1, 1],
'event': ['2023-01-01', '2023-01-02', '2023-02-03', '2023-01-01', '2023-01-02', '2023-01-03', '2023-01-01', '2023-01-02', '2023-0... | <python><pandas><dataframe><group-by> | 2023-11-07 11:05:44 | 3 | 2,350 | dingaro |
77,437,451 | 14,643,315 | In Selenium, how can I disable images or go headless after a certain event? | <p>My script logs into a site and clicks on various buttons.
From the start and until login is complete, there is a chance that a captcha would pop up, which I need to solve manually.</p>
<p>My question is: <strong>after</strong> solviong the captcha, is there a way to tell my script to go headless, or at least disable... | <python><selenium-webdriver> | 2023-11-07 10:29:30 | 0 | 453 | sadcat_1 |
77,437,353 | 828,279 | Polars qcut return quantile break points | <p>With Polars (0.19) is it possible to make qcut return the break-points? These break-points are the numerical value at which the distribution is cut. For a normal distribution, quantile 0.5 will return the break-point ~0. We can return also the labels but these have to be strings. Is there anyway to also return the <... | <python><python-polars> | 2023-11-07 10:16:01 | 0 | 13,502 | Dan |
77,436,994 | 4,451,521 | what is the effect of loc in a dataframe? | <p>If I have this minimal reproducible example</p>
<pre><code>import pandas as pd
df = pd.DataFrame({"A":[12, 4, 5, None, 1],
"B":[7, 2, 54, 3, None],
"C":[20, 16, 11, 3, 8],
"D":[14, 3, None, 2, 6]})
index_ = ['Row_1', 'Row_2',... | <python><pandas> | 2023-11-07 09:25:15 | 4 | 10,576 | KansaiRobot |
77,436,907 | 5,087,283 | Keep Python code safe from execution by Pydoc | <p>This question is related to the question <a href="https://stackoverflow.com/questions/33190444/stop-pydoc-from-running-my-python-program">Stop pydoc from running my Python program</a>, except that here I'm not actually trying to document my own code - I'm just trying to use <code>pydoc</code> to look up unrelated do... | <python><path><file-extension><pythonpath><pydoc> | 2023-11-07 09:14:49 | 0 | 811 | Metamorphic |
77,436,740 | 2,101,765 | Statforecast - AutoArima: How to run different models for each unique ids | <p>I am using <code>statsforecast</code> package and fitting AutoARIMA model. Code looks like the following.</p>
<pre><code>forecast = {}
models = {}
for item in Ids:
sf = StatsForecast(
models=[
AutoARIMA()
],
freq='M'
)
d = train_data[train_data['unique_id']==item
s... | <python><parameters><time-series><arima><statsforecast> | 2023-11-07 08:53:15 | 1 | 1,806 | Manoj G |
77,436,736 | 11,124,121 | Is there anyway to merge two datasets that with two similar key column but not the same key column? | <p>I have two datasets as follows:</p>
<p>a:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>have lunch</th>
<th>have dinner</th>
</tr>
</thead>
<tbody>
<tr>
<td>set a</td>
<td>set 1</td>
</tr>
<tr>
<td>set b</td>
<td>set 2</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
<... | <python><r><pandas><tidyverse> | 2023-11-07 08:52:59 | 2 | 853 | doraemon |
77,436,636 | 5,912,544 | Generate one dataframe per element in a column and merge into current dataframe | <p>Given the following (example) dataframe :</p>
<pre><code>import pandas as pd
import pathlib
from pathlib import Path
cwd = Path('Path/to/somewhere')
df = pd.DataFrame(
{
'var1': [0, 5, 10, 15, 20, 25],
'var2': ['A', 'B']*3,
'var3': ['A', 'B']*3,
'path_col': [cwd / 'a.dat', cwd / ... | <python><pandas> | 2023-11-07 08:36:15 | 1 | 624 | MaximGi |
77,435,735 | 496,136 | Why does this code fail to move a sharepoint file to a different directory using Office365-REST-Python-Client | <ol>
<li>List item</li>
</ol>
<p>I am using python 3.10
using Office365-REST-Python-Client==2.4.1</p>
<p>my code attempts to move a file from sharepoint</p>
<pre><code>def get_file(ctx: ClientContext, name: str) -> File:
result = None
try:
file: File = ctx.web.get_file_by_server_relative_url(name)
ctx.load(f... | <python><shared-libraries><office365-rest-client> | 2023-11-07 05:25:28 | 0 | 6,448 | reza |
77,435,467 | 7,554,103 | Check if object is an instance of a group of classes | <p>I have an object, and it is either</p>
<ul>
<li><code>statsmodels.genmod.generalized_linear_model.GLMResultsWrapper</code></li>
<li><code>statsmodels.regression.linear_model.RegressionResultsWrapper</code></li>
<li><code>statsmodels.base.elastic_net.RegularizedResultsWrapper</code></li>
</ul>
<p>or</p>
<ul>
<li><cod... | <python><class><scikit-learn><instance><statsmodels> | 2023-11-07 03:54:01 | 1 | 375 | wwj123 |
77,435,415 | 721,810 | Can't create text and annotations outside Matplotlib graph | <p>The following Python code generates a figure using Matplotlib in Jupyter Notebook which is ideal in appearance for an application that I am working on.</p>
<pre><code>import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
fig, ax = plt.subplots(facecolor='lightgrey')
# Define some graph offsets
star... | <python><matplotlib><jupyter-notebook> | 2023-11-07 03:36:32 | 3 | 1,889 | Brian O'Donnell |
77,435,365 | 10,200,497 | within each group-by, use formula for difference of values on the bottom row, picking column depending on whether one column is NaN | <p>This is my dataframe:</p>
<pre><code>df = pd.DataFrame(
{
'sym': ['a', 'a', 'b', 'c', 'c', 'c'],
'x': [100, 120, 80, 8, 8, 40],
'y': [20, 20, np.nan, 20, np.nan, 20],
'z': [2, 3, 4, 5, 6, 7],
}
)
</code></pre>
<p>And this is the output that I want. I want to create column <co... | <python><pandas> | 2023-11-07 03:16:47 | 2 | 2,679 | AmirX |
77,435,356 | 59,470 | OpenAI API: New version (v1) of the OpenAI Python package appears to contain breaking changes | <p>I have been playing with openai==0.28.1 and created a few projects by following examples from <em>deeplearning.ai</em> short courses that use ChatGPT and other OpenAI models (courses for ChatGPT, <a href="https://en.wikipedia.org/wiki/LangChain" rel="nofollow noreferrer">LangChain</a>, and more). Until today, everyt... | <python><openai-api><chatgpt-api> | 2023-11-07 03:12:56 | 1 | 19,919 | topchef |
77,435,161 | 1,653,225 | How do you tell setuptools to build an extension for --debug when using pyproject.toml / PEP 518 | <p>I have created <a href="https://github.com/OddSource/ifaddrs4u/tree/main/ifaddrs4py" rel="nofollow noreferrer">a Python project with a C++ extension</a> using <code>pyproject.toml</code> (PEP 518, PEP 517, PEP 621, PEP 660, etc.). I'm sure I could be doing some things better, but generally speaking it's working grea... | <python><c++><setuptools><debug-symbols><python-extensions> | 2023-11-07 02:05:54 | 0 | 3,248 | Nick Williams |
77,435,116 | 4,764,604 | RuntimeError: CUDA error: CUDA-capable device(s) is/are busy or unavailable while GPU utilization is 0% according to nvidia-smi | <p>I'm trying to launch a gradio backend that uses the LLM calls from Facebook. But it tells me that GPUs are not available:</p>
<pre><code>(.venv) reply@reply-GP66-Leopard-11UH:~/dev/chatbot-rag$ gradio gradio-chatbot.py
Warning: Cannot statically find a gradio demo called demo. Reload work may fail.
Watching: '/hom... | <python><gpu><nvidia><large-language-model><gradio> | 2023-11-07 01:46:31 | 0 | 3,396 | Revolucion for Monica |
77,435,102 | 8,951,295 | overwrite a txt file every hour instead of append using python | <p>I have a monitoring code from shodan <a href="https://help.shodan.io/guides/how-to-monitor-network" rel="nofollow noreferrer">https://help.shodan.io/guides/how-to-monitor-network</a></p>
<p>the script is continuously running and print the finding in CLI.
I extracted the data that I needed in this format <code>data=(... | <python><python-3.x><time> | 2023-11-07 01:41:46 | 1 | 643 | ELMO |
77,435,098 | 2,990,266 | Why does patching a classmethod on a base class effect subclasses? | <p>I ran into a problem with patching a <code>classmethod</code> on a base-class. The problem is that patching the base-class effects calling the classmethod on a subclass.</p>
<p>I expect the output of this to produce <code>["foo", "bar"]</code> however with the <code>mocker.spy(Foo, "wrapper&... | <python><mocking><pytest><patch> | 2023-11-07 01:40:26 | 1 | 2,025 | Aage Torleif |
77,434,872 | 5,927,701 | pythonic way to convert pptx to pdf | <p>I am trying to convert <code>PPTX</code> file to <code>PDF</code> file in core <code>Python</code></p>
<p>Method 1:</p>
<pre><code>import comtypes.client
def PPTtoPDF(inputFileName, outputFileName, formatType = 32):
powerpoint = comtypes.client.CreateObject("Powerpoint.Application")
powerpoint.Vis... | <python><pdf><reportlab><python-pptx> | 2023-11-07 00:09:52 | 0 | 4,590 | data_person |
77,434,808 | 6,761,992 | OpenAI API: How do I enable JSON mode using the gpt-4-vision-preview model? | <p>Update: It seems like they made a mistake in the API docs, and fixed it now.</p>
<p>Earlier, it said "when calling <code>gpt-4-vision-preview</code> or <code>gpt-3.5-turbo</code>," but now reads "when calling <code>gpt-4-1106-preview</code> or <code>gpt-3.5-turbo-1106</code>."</p>
<hr />
<p>Accor... | <python><openai-api><gpt-4> | 2023-11-06 23:46:14 | 5 | 309 | chibop |
77,434,637 | 3,574,603 | Unable to reference env variable when script is run as a service | <p>I have an environment variable <code>KEY</code>. It is defined in <code>.bashrc</code></p>
<pre><code>export KEY=...
</code></pre>
<p>I can confirm that the variable is set with <code>echo $KEY</code>.</p>
<p>I have a Python script that references the variable with:</p>
<pre><code>os.environ.get('KEY')
</code></pre>... | <python><linux><environment-variables> | 2023-11-06 22:50:22 | 0 | 3,678 | user3574603 |
77,434,581 | 16,808,528 | Output data does not match headers, off by one | <p>I have vaccination text data like this:</p>
<pre><code>vaccinations_text = """
|Entry #|Vaccine|Type of vaccine|Lot #|Manufacturer|VIS edition date|Date given|Vaccinator (initials)|
|1|Influenza|H1N1|2F03930|NOV|8/24/09|12/7/09|PLE|
|2|Tetanus, Diphtheria, Pertussis|Td|U049393AA|ASP|4/2/95|10/7/95|ODK... | <python> | 2023-11-06 22:33:57 | 2 | 477 | Rstudyer |
77,434,333 | 2,391,144 | How can I use python-click to make a multi-command CLI interface | <p>I'd like to create a CLI for my application that's flexible and extensible. Click seems like the right solution but I'm new to it and have not seen an example that fits what I'm looking for. The application has a variety of different inputs (file, TCP socket, ZMQ etc); a variety of different tasks it can perform (ta... | <python><python-click> | 2023-11-06 21:25:02 | 0 | 1,247 | Youssef Bagoulla |
77,434,196 | 226,473 | Is there a way to return all rows where only one column is not null? | <p>I have a dataframe that I'd like to break up into logical sub-dataframes.</p>
<p>The most logical way to do this, given how the data is, is to select rows from the original dataframe where only one of the columns is not null (i.e. <code>df.column.notnull()</code> is <code>True</code>).</p>
<p>Is there a shorthand fo... | <python><pandas><dataframe> | 2023-11-06 20:54:30 | 1 | 21,308 | Ramy |
77,434,156 | 1,753,525 | Pycharm FastAPI configuration works on Run, stalls on Debug when adding a breakpoint | <p>I just created a new Python project using Poetry. It's pretty simple, this is my pyproject.toml:</p>
<pre><code>[tool.poetry]
name = "my-app"
version = "0.1.0"
description = ""
authors = ["me"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12&quo... | <python><debugging><pycharm><fastapi><python-poetry> | 2023-11-06 20:46:56 | 1 | 687 | Samer |
77,434,087 | 4,882,545 | Execute GCP Cloud Run job with environment variable override using Python client | <p>I am trying to trigger a GCP Cloud Run job from a python script following the run_job documentation (<a href="https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.jobs.JobsClient#google_cloud_run_v2_services_jobs_JobsClient_run_job" rel="nofollow noreferrer">https://cloud.google.com... | <python><google-cloud-platform><google-cloud-functions><cloud><google-cloud-run> | 2023-11-06 20:35:09 | 1 | 533 | Raimundo Manterola |
77,434,044 | 2,638,049 | manage.py migrate on Amazon Linux 2023 | <p>I am trying to deploy my django environment on aws linux 2023 and I have a file with command for migration:</p>
<pre><code>container_commands:
01_migrate:
command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate"
leader_only: true
</code></pre>
<p>Then I get an error in ... | <python><django><amazon-web-services> | 2023-11-06 20:25:53 | 1 | 1,639 | serge |
77,433,576 | 8,116,305 | How to apply rolling_map() in Polars for a function that uses multiple input columns | <p>I have a function using Polars Expressions to calculate the standard deviation of the residuals from a linear regression (courtesy of <a href="https://stackoverflow.com/questions/74895640/how-to-do-regression-simple-linear-for-example-in-polars-select-or-groupby-con">this post</a>).</p>
<p>Now I would like to apply ... | <python><dataframe><python-polars><rolling-computation> | 2023-11-06 18:58:17 | 1 | 343 | usdn |
77,433,449 | 4,426,091 | psycopg2: WHERE =ANY with multiple columns | <p>PostgreSQL v14
Psycopg2 v2.9.3</p>
<p>I can do this in straight PostgreSQL / pgsql, however I can't seem to get it in Psycopg2.</p>
<p>Given an example table:</p>
<pre><code> CREATE TABLE accounts (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
account_name TEXT,
account_number TEXT... | <python><postgresql><psycopg2> | 2023-11-06 18:36:26 | 1 | 7,430 | Brooks |
77,433,420 | 4,859,780 | How do I tell matplotlib.pyplot to draw the figure on a different display? | <p>I am using a laptop (mac os) with two external displays. When I use <code>matplotlib.pyplot</code> to plot anything, the new figure always shows up on the laptop screen.</p>
<p>Is there a programmatic way to have <code>matplotlib.pyplot</code> create the figure on a different display (rather than having to manually... | <python><macos><matplotlib> | 2023-11-06 18:29:27 | 1 | 1,157 | bphi |
77,433,354 | 2,458,922 | Google Colab Roll Back | <p>Some Keras Package of my old code , Of Sept 2023 stopped working in Nov 6 2023.
I am not remembering what all were those package by default by then.</p>
<p>Is there any way I can have the Google Colab roll back to a previous veriosn.</p>
<p>Below is the Error Message from my current code while complied a couple of m... | <python><google-cloud-platform><google-colaboratory> | 2023-11-06 18:17:58 | 1 | 1,731 | user2458922 |
77,433,314 | 7,422,748 | How to write a default parameter callback function that does nothing? [Python] | <p>I sometimes want to pass in a callback function as a parameter to <code>my_function</code>. However, I want the default behavior to simply do nothing.</p>
<p>I find myself wanting to write the following <strong>invalid</strong> lines of code:</p>
<pre class="lang-py prettyprint-override"><code>def my_function(args, ... | <python><callback><default-parameters> | 2023-11-06 18:11:17 | 2 | 316 | Pedro Contipelli |
77,433,205 | 1,554,386 | How to install mysqlclient in a python:3-slim Docker image without bloating the image? | <p>I'm using <code>python:3-slim</code> Docker image and want to use the mysqlclient package from Pypi but getting the following error from <code>RUN pip install mysqlclient</code> command:</p>
<pre><code>...
Collecting mysqlclient
Downloading mysqlclient-2.2.0.tar.gz (89 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━... | <python><docker><mysql-python> | 2023-11-06 17:48:35 | 1 | 27,985 | Alastair McCormack |
77,433,148 | 4,001,769 | Regex to find header position getting all the text between first and last header | <p>I have a string that represents the text in a file, and I would like to find the header for the text. It is well structured, so I was gessing it would be fairly simple to do it, but the line breaks are breaking me (pun intentended)!
The header looks like this:</p>
<pre><code>Start of the header
Something inside the ... | <python><regex> | 2023-11-06 17:38:31 | 2 | 428 | Andre Guilhon |
77,433,096 | 6,759,459 | NotImplementedError: Loading a dataset cached in a LocalFileSystem is not supported | <p>I try to load a dataset using the <code>datasets</code> python module in my local Python Notebook. I am running a Python 3.10.13 kernel as I do for my virtual environment.</p>
<p>I cannot load the datasets I am following from a tutorial. Here's the error:</p>
<pre><code>----------------------------------------------... | <python><python-3.x><pip><openai-api><huggingface-datasets> | 2023-11-06 17:29:38 | 2 | 926 | Ari |
77,433,017 | 521,347 | AlloyDB- CREATE DATABASE can not be run in a transaction block | <p>Since AlloyDB does not support creating a database using terraform yet, I am trying to create it using Alembic and sqlAlchemy. I am using <code>postgresql+psycopg2</code> as the driver.My code looks similar to the only answer on <a href="https://stackoverflow.com/questions/53847829/postgres-pg8000-create-database">h... | <python><postgresql><sqlalchemy><alembic><google-alloydb> | 2023-11-06 17:18:12 | 0 | 1,780 | Sumit Desai |
77,432,967 | 8,030,746 | Why am I getting TimeoutException in Selenium with Python? | <p>Just started learning Selenium with Python. And no matter how much I change the WebDriverWait, it's still giving me the TimeoutException.</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support i... | <python><selenium-webdriver> | 2023-11-06 17:06:41 | 1 | 851 | hemoglobin |
77,432,950 | 3,170,116 | remove duplicates from a DataFrame, and keep all columns from that row | <p>I am attempting to use pyspark to de-duplicate a DataFrame. Here is the DataFrame:</p>
<pre><code>employee_name department start_date favorite_color
---------------------------------------------------------------------------
James sales 2023-11-03T12:38:02.371076Z green
J... | <python><pyspark> | 2023-11-06 17:04:15 | 1 | 370 | ChadSC |
77,432,905 | 8,076,979 | Why does dataclass favour __repr__ over __str__? | <p>Given the following code, I think output <code>(A)</code> makes sense since <code>__str__</code> takes precedence over <code>__repr__</code> however I am a bit confused about output <code>(B)</code> why does it favour <code>__repr__</code> over <code>__str__</code> and is there a way to make the class use the <code>... | <python><python-dataclasses> | 2023-11-06 16:59:16 | 2 | 969 | Tobias |
77,432,881 | 571,950 | How to use dynamic types as return types in Python/mypy | <p>I am trying to use a dynamically created type to use as return type.</p>
<p>The code works, but mypy throws an error.</p>
<p>The code snippet shows the problem in a very simplified way, but where I am using dynamic return types in my project, they have meaning (FastAPI for capturing the response structure in OpenAPI... | <python><fastapi><mypy><pydantic> | 2023-11-06 16:55:48 | 1 | 747 | Jakob Simon-Gaarde |
77,432,777 | 4,399,016 | Pivoting a Pandas data frame from long to wide | <p>I have this code from <a href="https://stackoverflow.com/a/47152692/4399016">here</a>:</p>
<pre><code>np.random.seed([3, 1415])
df2 = pd.DataFrame({'A': list('aaaabbbc'), 'B': np.random.choice(15, 8)})
df2
A B
0 a 0
1 a 11
2 a 2
3 a 11
4 b 10
5 b 10
6 b 14
7 c 7
</code></pre>
<p>The expected... | <python><pandas><dataframe><group-by><pivot-table> | 2023-11-06 16:40:17 | 0 | 680 | prashanth manohar |
77,432,734 | 7,456,317 | Install a Python package and debug it | <p>I have the following use case:
I want to write some code that uses a package from GitHub, while debugging that package. I cloned that package next to the directory with my code, so the directory structure looks like this:</p>
<pre><code>/code
/github-package
/my-code
</code></pre>
<p>The package comes with a <co... | <python><setuptools><python-packaging> | 2023-11-06 16:35:20 | 0 | 913 | Gino |
77,432,589 | 2,725,810 | What resource is my Lambda function exhausting? | <p>The following AWS Lambda function uses multi-threading to read 10,000 small objects of about 40KB each from AWS DynamoDB.</p>
<pre class="lang-py prettyprint-override"><code>import boto3
import threading
import math
import json
class DynamoDB:
def __init__(self, table_name):
self.client = boto3.client('... | <python><multithreading><aws-lambda><amazon-dynamodb><boto3> | 2023-11-06 16:12:42 | 0 | 8,211 | AlwaysLearning |
77,432,481 | 2,647,747 | what does [x, y, λ] = xyλ mean in python | <p>I came across the code snippet recently.</p>
<pre class="lang-py prettyprint-override"><code>def DL (xyλ) :
[x, y, λ] = xyλ
return np.array([
dfdx(x, y) - λ * dgdx(x, y),
dfdy(x, y) - λ * dgdy(x, y),
- g(x, y)
])
</code></pre>
<p>However I don't know what <code>[x,... | <python> | 2023-11-06 15:58:04 | 1 | 373 | Zwy |
77,432,381 | 2,386,113 | How to set the plotting area size in Matplotlib? | <p>I am able to set the figure size but I need to have the same size for the plots. I am saving the plots as SVG and then loading them in Latex to create a figure. I have verified that the size of all the figures is the same but as shown by the <strong>red horizontal line</strong> in the screenshot below, the height of... | <python><matplotlib> | 2023-11-06 15:42:25 | 0 | 5,777 | skm |
77,432,378 | 9,150,928 | What is the result/effect of layers.__init__ in side a class without declaring them as variables? | <p>First to declear, I am not good at Python yet.</p>
<p>Below is a snippet of the original microsoft LoRA implementation.</p>
<pre><code>import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from typing import Optional, List
class LoRALayer():
def __init__(
self,
r: int,... | <python><pytorch> | 2023-11-06 15:41:52 | 1 | 327 | S. Jay |
77,432,303 | 5,032,387 | How to make configuration settings part of Strategy in python-hypothesis | <p>I want to write a test for a method using the hypothesis library.</p>
<p>Within the method, I import configuration settings that differ according to the job that I'm running the codebase for (each unique run of the code gets different settings).</p>
<p>The methods look something like this</p>
<p>Module <code>user_se... | <python><testing> | 2023-11-06 15:30:34 | 1 | 3,080 | matsuo_basho |
77,432,232 | 5,640,517 | Python in Jupyter notebook, integers and is operator | <p>Reading these <a href="https://stackoverflow.com/questions/77432108/how-does-memory-management-in-python-work-for-integers">How does memory management in Python work for integers?</a> and <a href="https://stackoverflow.com/questions/306313/is-operator-behaves-unexpectedly-with-integers">"is" operator behav... | <python><jupyter-notebook> | 2023-11-06 15:21:23 | 0 | 1,601 | Daviid |
77,432,229 | 4,810,328 | Python ctypes dtype multiply | <p>I have the following line in python:</p>
<pre><code>a = (ctypes.c_float*10)()
</code></pre>
<p>Here a is initialized as an object with _<em>repr</em>_ result:</p>
<pre><code><__main__.c_float_Array_10 object at 0x7fbb3e6cf340>
</code></pre>
<p>My understanding is that this object is some sort of a pointer that... | <python><python-3.x><ctypes> | 2023-11-06 15:21:11 | 1 | 711 | Tarique |
77,432,123 | 20,591,261 | Line plot doesn't align with corresponding bars | <p>I'm trying to make a bar chart with a line plot, but the line plot is starting from 2 instead or 1.</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
url = 'https://raw.githubusercontent.com/Arancium98/datasets/main/ventas_pizzas2.csv'
df = pd.read_csv(url)
VentaS = df.groupby('week')['total_... | <python><pandas><bar-chart><linechart> | 2023-11-06 15:03:46 | 1 | 1,195 | Simon |
77,432,043 | 1,014,217 | How to keep session state variables across a multipage app in Streamlit | <p>My app has a few pages, and the first time it loads, it will detect if there is an access token in the session state, if not the user with click on the login to go to Azure Id, and then a code will be returned in the query parameters and then an access token will be retrieved, thenI can use to render some buttons de... | <python><streamlit> | 2023-11-06 14:53:34 | 0 | 34,314 | Luis Valencia |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.