Newest 'python' Questions (original) (raw)

0 votes

0 answers

7 views

Why is my Python function not formatting it's input data as expected?

I have a python function to compare two pieces of data. One piece is stdout of a CompletedProcess object. When output to the console, it looks like this: 3 3 3 3 3 3 3 3 The other is a python list ...

N.T.'s user avatar

asked 7 mins ago

0 votes

0 answers

6 views

Is it safe to save preprocessed features with numpy in one Python environment and load them in another for model training?

I'm working on a deepfake detection project using TensorFlow 2.6.2 on Windows. Due to package version conflicts (e.g. tensorflow==2.6.2 requires flatbuffers==1.12, but mediapipe requires flatbuffers&...

陳冠霖's user avatar

asked 12 mins ago

-2 votes

0 answers

19 views

Python: regarding for loops, if/else & remove method

#Friends playing toss the water balloon Code works fine, but how do I do the following? Add an else statement that contains the ones who caught the balloon successfully (and print)? When someone ...

soar1024's user avatar

asked 20 mins ago

0 votes

0 answers

9 views

Qiskit v2.0.0 Statevector probabilities_dict throws TypeError: unsupported operand type(s) for -: 'int' and 'qiskit.circuit.Qubit'

It’s my first week coding in Qiskit, so I’m using the latest version v2.0.0, but there seems to be a big overhaul, so I’m struggling with reading the docs and even going to the source code, and ...

Alex F's user avatar

asked 26 mins ago

-2 votes

0 answers

17 views

How to get a list of site pages? [closed]

i'm looking for a lost page on a website that i know existed at one point and i'm worried that it's been deleted i don't know much about how to code so this is gonna be how i start because i really ...

dsntwrk's user avatar

asked 55 mins ago

-1 votes

0 answers

10 views

Python throws Certificate error even though Postman does not

I have Python and Postman installed on the same machine. Using Postman, I can make https calls to an API that is on a different machine, but still on our network. If I try to use Python to mke the ...

Keith Clark's user avatar

asked 1 hour ago

-2 votes

0 answers

25 views

Cleanup function in an object? [Python]

I have a python class which generates a file and was wondering if there was a way to make a cleanup function and I had a look at __del__ however from what I have seen its unreliable and doesn't always ...

Puddle's user avatar

asked 1 hour ago

0 votes

1 answer

19 views

Dynamic call to attribute's method ends up to calling it on wrong instance (after reseting attribute)

I'm encountering a behavior that surprises me on dynamic calls: I have a class that acts as an attribute for another class. When the container class resets this attribute, the methods of the attribute ...

coding_chicken's user avatar

asked 2 hours ago

-2 votes

0 answers

12 views

Mandelbrot Zoom

I recently watched a video on creating a Mandelbrot Zoom in Python - https://youtu.be/HtNUFdh2sjg?si=07JVGOlksJtmzev- After manually copying the file to use in Pycharm, I commented out what I thought ...

Simple Man's user avatar

asked 2 hours ago

0 votes

0 answers

19 views

How to use a class property as a decorator in Python?

I'm trying to make a RateLimiter class in Python that can be instantiated as a class property in other classes, and then applied to functions to be rate limited as a decorator. Here's the RateLimiter: ...

ROODAY's user avatar

asked 2 hours ago

-1 votes

0 answers

21 views

python script to generate a token from Delinea Secure Server

I need to generate a token but can't seem to make it work. auth_details = { "usernname" : "fakeuser", "password" : "fakepassword", "grant_type&...

whitemilkfish's user avatar

asked 3 hours ago

0 votes

0 answers

17 views

tf.keras.utils.image_dataset_from_directory Found 0 files belonging to 0 classes

I am currently attempting to develop an image classification model and have organized my data using the following DATASET/ ejercicio1/ train/ frames/ ejercicio1_train_0001.jpg ...

Adri's user avatar

asked 4 hours ago

-3 votes

0 answers

22 views

Metrics seem off in LSTM Code applied to Stock Market

I'm having some issues with my project code (written in Python 3.11.9). I'm primarily using Keras for this project. The project's main goal is to apply LSTM, Adaptive LSTM, and Transformer-based time ...

Arthur Morgan's user avatar

asked 5 hours ago

0 votes

0 answers

41 views

How to make data submitted by a user save in Python? [closed]

import time book_genres = ["1 Fantasy,", "2 Romance,", "3 Childrens,", "4 Comedy,", "5 Graphic Novel,", "6 Educational,", "7 Religious,&...

Kenneth Scurlock's user avatar

asked 5 hours ago

-1 votes

1 answer

31 views

Source command doesn't work on windows - can't activate venv

The "source" command for choosing a Python virtual env does not work on Windows. It's only available on Unix. After looking through StackOverflow for how to use this properly, I was ...

Darkhydro's user avatar

asked 6 hours ago

-6 votes

0 answers

31 views

How will i connect all this py games? [closed]

to have a main menu, play and credit at the front page and once clicked the play button itll execute each game https://docs.google.com/document/d/1R9nWd4yVqdfTJtGULZM2BA3mEOXG2dcnUkkiJiYK2R8/edit?usp=...

Sean Concepcion's user avatar

asked 6 hours ago

-1 votes

0 answers

29 views

The mean of my aggregated values seems incorrect (dataset cleaned with pandas)

I am using pandas to clean a global coral bleaching dataset. I want to get the Percent_bleaching, Temperature_Mean and Date column for all the countries in the Caribbean and have been trying to find ...

Mina Vijayshankar's user avatar

asked 6 hours ago

2 votes

0 answers

51 views

Polars check if column is unique

There are multiple ways to check if a column in polars is unique, i.e. it can be used as a key. For example df.get_column("a").is_unique().all() (Previously I had df["a"], but ...

qwr's user avatar

asked 7 hours ago

0 votes

0 answers

13 views

"ModuleNotFoundError: No module named 'ESMF'" when importing xesmf installed via conda

I have tried to install xESMF module developed by pangeo-data collective into my conda environment with conda install -c conda-forge --override-channels xesmf however when I try to import xesmf I get ...

Dima Chubarov's user avatar

asked 7 hours ago

0 votes

0 answers

9 views

Which Principal Component Analysis method for a stationnary, non-linear 3D dataset?

I have a 3D dataset of glacier surface velocities (time, latitude, longitude). Typically the patterns are stationnary in time, non-linear (in space nor time), and sometimes oscillatory. I have been ...

Nihilum's user avatar

asked 7 hours ago

0 votes

0 answers

10 views

MetPy "interpolate_to_isosurface" results in "IndexError: Unlabeled multi-dimensional array cannot be used for indexing: pressure_level"

I need help on the usage of MetPy's interpolate_to_isosurface function (link). My goal was to interpolate a gridded meteorological dataset, such that its vertical coordinate is transformed from ...

Brian Añano's user avatar

asked 7 hours ago

-7 votes

0 answers

39 views

Python: Default Argument [closed]

Why is it that when i run (on VS code): def add(a, b): return a+ b add() I receive a Traceback (as I should), but when I run: def add(a, b): return a + b add(7, 8) no return value is ...

Audrey Okafor's user avatar

asked 7 hours ago

-1 votes

0 answers

25 views

Encrypted TCPIP MacOS vs Chrome and Python [closed]

Trying to connect to thorlabs PM103E via TCPIP in python. The socket python package does not work ( MacOS with M2 running sequioia 15.4). It can connect, but never responds I used the vendor ...

Jeff Secor's user avatar

asked 7 hours ago

0 votes

0 answers

15 views

SEARCH sintaxis for AWS Boto3 client (Python) query expression

i'm trying to get information for NetworkIn and NetworkOut metrics with boto3 client for python, using the get_metric_data method. I am using the boto3 library and the client like this: Client = boto3....

FIM's user avatar

asked 8 hours ago

0 votes

2 answers

21 views

Need help accessing "Groups" folder in Outlook using pywin32

I am trying to read emails of a particular mail group using pywin32 which, is showing under "Groups" of my outlook mail (shown in screenshot). I am able to access all the folders under my ...

user30450254's user avatar

asked 8 hours ago

-10 votes

0 answers

41 views

having an error while hosting a django website on a heroic suggest me some good platform [closed]

I have made a website using django and purchased a domain on go daddy but could not find any platform to host. found one heroic but having some error into vs code while trying to install heroku. Any ...

Kathan2312's user avatar

asked 9 hours ago

1 vote

0 answers

12 views

pyproject.toml: specify dynamic parameters for C extension

I'm updating a Python package that contains some C extensions. In a previous version I had all parameters set up in the setuptools setup() function, and now I am porting that setup into a new version ...

user3758232's user avatar

asked 9 hours ago

-1 votes

0 answers

24 views

how to fix python package import problems

turtle package in pycharm gives(Import resolves to its containing file), and in vscode gives("python", "code": { "value": "reportShadowedImports""source&...

Layla Yahya's user avatar

asked 9 hours ago

0 votes

0 answers

27 views

How to modify the metadata creation date of a file through Python?

I have a lot of photos with wrong dates in metadata. When I upload them to a web service like Amazon Photos for example, they are disorganized due to that. So I am doing a Python 3 script in Linux to ...

forvas's user avatar

asked 9 hours ago

0 votes

0 answers

46 views

Sympy won't accept I as a symbol while differentiating

I made a simple program to calculate std for a given set of numbers and a function. While inputing some data today I realized that if one of the variables is called I it gives 0 as the derivative. ...

JONIAK4D's user avatar

asked 10 hours ago

0 votes

0 answers

39 views

Django ValueError: Cannot query "instructor": Must be "User" instance

I'm getting the following error when trying to access my homepage: ValueError at / Cannot query "instructor": Must be "User" instance. Request Method: GET ...

Walid Yassine's user avatar

asked 10 hours ago

0 votes

0 answers

21 views

RuntimeError: Event loop is closed - unittest, pytest

I have been working on yet another api using fastapi and trying to write test cases for the apis but facing error that event loop is closed My setup: so i am using asyncpg driver/library to connect to ...

Super Ultra Noob's user avatar

asked 11 hours ago

-8 votes

0 answers

35 views

Program for checking 24h price change [closed]

I have following code: pip install requests playsound pillow import requests import time import smtplib from email.mime.text import MIMEText from tkinter import Tk, Label from playsound import ...

Kamil Zalewski's user avatar

asked 11 hours ago

0 votes

0 answers

27 views

Not able to connect to Selenium Chrome service

Getting the following error on my Mac: selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /Users/michaelgelberg/.wdm/drivers/chromedriver/mac64/136.0.7103.92/...

Michael Gelberg's user avatar

asked 11 hours ago

-2 votes

2 answers

45 views

How to generate a list of words using random letters? [closed]

I'm trying to generate a list of words (with a random length of 1,4,7,or 2) using random letters. I'm having trouble with the final for loop adding onto the previous iteration. Thanks! import random ...

Will Vaught's user avatar

asked 11 hours ago

Are nested helper() functions a good practice [closed]

In my code for a DSA class dynamic programming problem I currently have this solution that provides the expected answer: def canPartition(nums): n = len(nums) S = sum(nums) if S % 2 != 0: ...

bebel's user avatar

asked 11 hours ago

-3 votes

0 answers

41 views

function wont run after definition of a function [closed]

I have a function app that calls the below code. When debugging it will not hit either call of SaveBlobToBlobStorage...need to know why? SaveBlobToBlobStorage is defined above this code. app = func....

MARK KNIGHT's user avatar

asked 11 hours ago

-1 votes

0 answers

16 views

After filling out the company search form and clicking the "Suchen" button, Selenium throws a NoSuchElementException when trying to click the first company name in the result list. Key ...

Vaibhavi K's user avatar

asked 11 hours ago

-3 votes

0 answers

38 views

How can I create Ternary Plots in Seaborn

Hi I want to plot multiple ternary diagrams such as the one below (done with plotly express) but its customisation is limited. So I wanted to do it with Seaborn. Is it possible to make ternary plots ...

LeoV's user avatar

asked 11 hours ago

3 votes

1 answer

55 views

Create a typing from a custom dataclass

I'm currently working with a dataclass (defined in one of the dependencies I'm currently working with inside of my project), which is defined similar to this snippet: from dataclasses import dataclass ...

Jaime 's user avatar

asked 11 hours ago

-1 votes

0 answers

37 views

What does "NSWindow geometry should only be modified on the main thread" mean?

My script involves a rumps library that makes a menu bar item which contains a pyautogui thingy that monitors your cursor so where ever you keep it on Standby for like 5 seconds or so it saves the ...

msr mpt's user avatar

asked 11 hours ago

0 votes

2 answers

30 views

How can I change the white color in QComboBox?

I would like to change the color or adjust the size of this rectangle behind the open Combobox I noticed that there is a problem with the increased size of this white background and the offset options ...

nekoshaurman's user avatar

asked 11 hours ago

1 vote

0 answers

16 views

Python linter configuration in Android studio

Within a flutter project I have the functions folder for cloud functions that should be written in python. What I did so far: In File >> Project Structure >> SDKs I added the python ...

Olf's user avatar

asked 11 hours ago

-4 votes

2 answers

34 views

How can I track mouse movements in a Windows terminal without triggering text selection in Python? [closed]

I'm working on a Python project where I want to track mouse movements inside a Windows terminal, but without triggering text selection or affecting the terminal’s regular behavior (like highlighting ...

O Majestático's user avatar

asked 12 hours ago

1 vote

0 answers

23 views

What is the purpose of the output parameter in the server function of a shiny app?

In R, the output is used to render outputs by assigning the result of a render function to some element of the output object. It does not seem to work this way in python. Some example python code: def ...

Chechy Levas's user avatar

asked 12 hours ago

Python - Pynput & the time module do not seem to work together in a loop

So I have written this Python script to vote repeatedly (It's allowed) for a friend on a show at a local TV station. import os import time from pynput.keyboard import Key, Controller os.system("...

ferd's user avatar

asked 12 hours ago

0 votes

0 answers

24 views

TypeError: 'method' object is not subscriptable -- Mapping Text in 1 DataFrame to a Dictionary in a Different Script [closed]

I'm using Python 3.11.9 on Windows via Visual Studio Code. I have a column (BUDGET_TYPE_NAME) with strings/text in it that I would like to map to a dictionary being called from a different script, but ...

TJ123's user avatar

asked 12 hours ago

1 vote

2 answers

43 views

Extrusion of line in Matplotlib

I am trying to "trivially" extend this line in a third dimension, such that the blue line in this picture becomes the boundary of a sheet, and the endpoints of the boundary are x_1x_1x1, x2x_2x_2: ...

Novaphys's user avatar

asked 12 hours ago

0 votes

0 answers

10 views

exogene and static features for lightgbm in automlforecast

i tried several approaches to implement exogene features in my lightgbm prediction with automlforecast and optuna. I also read the documentation, but i do not find the right positon where to implement ...

hadji's user avatar

asked 12 hours ago

1 vote

0 answers

13 views

Utilizing cocoapi for evaluation in python produces print results in console

I am using the Coco eval script for my project. I have modified the demo provided here. The commands I use are basically those: cocoGt = COCO(gt_json) cocoDt = cocoGt.loadRes(results_json) imgIds = ...

Eypros's user avatar

asked 12 hours ago