Questions tagged [python]

Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Please note that Python 2 is officially out of support as of 2020-01-01. For version-specific Python questions, add the [python-2.7] or [python-3.x] tag. When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.

Filter by
Sorted by
Tagged with
0 votes
0 answers
2 views

How to Bulk Speed UP and Crop Videos FFMPEG

I have videos in (input) folder that is located on the root of the script, I also have output folder on the root, The input folder has several videos that i want to speed up in bulk by 1.1 percent, I ...
Usemo Shank's user avatar
-1 votes
0 answers
5 views

How to read html information that is not directly displayed in a link with python?

I create a code in python that use the following line to read information and table from a html link to get coordinates from a project. path = https://busquedas.elperuano.pe/normaslegales/otorgan-a-la-...
Maria Fernanda's user avatar
0 votes
0 answers
6 views

Trouble training image detection model

I want to pick out, identify, and even count several symbols on an image. It simply fails to locate them. I have tried template matching if I crop the template directly from the main image, template ...
Brandon's user avatar
  • 13
0 votes
1 answer
6 views

pex built by pex doesn't run outside its virtualenv

TL;DR I built pex according to the guide https://pex.readthedocs.io/en/v2.1.145/buildingpex.html and was expecting it to run fine outside of the virtualenv I used to build it, but alas: $ ~/bin/pex ...
Marcello Romani's user avatar
0 votes
2 answers
16 views

How to convert object column to geometry in pandas python?

I have a dataframe that includes these three columns: lat long Mapped Location 36.0455 -86.7122 POINT (-86.7122 36.0455) 36.1343 -86.7806 POINT (-86.7806 36....
al_pal's user avatar
  • 1
0 votes
0 answers
13 views

how to assign a task result to variable while task is not finished yet

I'm trying to update a variable's value in an infinite loop. a demo code of my situation is like this: import asyncio, random async def coro1(): await asyncio.sleep(random.randint(1,5)) ...
Naadiyaar's user avatar
0 votes
0 answers
9 views

Invalid Qt Designer file when moving ui files to folder

Im trying to create a GUI in PyQt6 with multiple pages with the stacked widget I followed This tutorial and it worked but when i tried to put the files in seperate folders it didnt work. And every ...
thecodepro90's user avatar
0 votes
0 answers
4 views

Why Scapy PcapReader method shows Raw instead of DiamG?

I have a pcap file generated with tcpdump that contains diameter traffic and reading it with Scapy PcapReader. It shows me that each packet has a DiamG layer, so AVPs can be easily extracted. However, ...
Jairo Caicedo's user avatar
-4 votes
0 answers
29 views

what is wrong with my code, and I am new to python [closed]

input=('pick a number between 1 and 20:') i=input a=10 if float(int((i))<=a print("hello there") else: print("hi") while a<=10: print(i+1) I keep get this ...
Bill White jr's user avatar
0 votes
0 answers
6 views

Openpyxl returning "Series" instead of value

I use combo boxes to get criteria to match from a pandas dataframe that sources from openpyxl and return a value. excel spreadsheet dashboard = pd.read_excel(path, sheet_name=0) def find_ins(num): ...
Tyler Bishop's user avatar
0 votes
2 answers
19 views

How to highlight the differences in nearly duplicate rows of a dataframe?

I have a pandas dataframe with several columns of data. For each set of duplicates in column A, I would like to highlight the differences from the original duplicates. For example Name Value1 ...
Umar Ali's user avatar
-5 votes
0 answers
22 views

triangle with each row the odd numbers, e.g. first row 1, second 3,5, third 7,9,11 etc [closed]

Given the triangle of consecutive odd numbers: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 ... i'm not getting error messages , more like unexpected result i expect it to create a list of lists with first ...
cerbero666's user avatar
0 votes
0 answers
25 views

Managing (Deleting) Multiple Python Environment

I understand this is probably a duplicated question, but I still have a hard time figuring out what to do in my case. The following is my Python kernel: While I know that /usr/bin/python3 is the ...
pbb's user avatar
  • 55
0 votes
0 answers
10 views

Pulling values form methods into other classes in Python

I'm writing a Python script with Kivy. As of now, the app is working as expected. Except I've hit a roadblock and have been unable to find the solution. In the "class Output(screen)" class, ...
Brian Tomasetti's user avatar
0 votes
0 answers
8 views

How to format Ragged Tensor for Encoder-Decoder model?

I'm working on building a seq2seq model using Encoder-Decoder architecture for which I have built a tf.data.Dataset pipeline that reads the text from the directories, vectorizes using them tf.keras....
Krishnang K Dalal's user avatar
0 votes
0 answers
9 views

Calculating error band for ROC curves of multiclass

I'm trying to plot ROC curve for multiclass and then plot the results with error band around each line This is the code I'm using to plot the ROC curve # AUC-ROC score auc_roc = roc_auc_score(y_test, ...
Arwa's user avatar
  • 166
0 votes
1 answer
19 views

Read Excel files from subfolders

I dont know where I have gone wrong. I have excel files stored in sub-folders which are country names. Now I have written code to find those excels, read them then extract data from sheets. I have a ...
Livingstone's user avatar
0 votes
1 answer
10 views

How to do group_by_rolling grouped by day by hour in polars in Python?

Let's say you have a dataset with the following column, Node, Time, date, Hour, Amount. Time is spaced hourly. date is simply the current date corresponding to Time. You should have only one ...
EtienneT's user avatar
  • 5,045
0 votes
1 answer
10 views

How to set a driver-side query execution timeout using psycopg?

Is there a driver-side socket/query timeout setting for psycopg? I would like to limit my query execution time so that queries run against a database that is experiencing an outage will timeout ...
acongo-i's user avatar
0 votes
0 answers
7 views

How to iterate through paginated results in the Python SDK for Microsoft Graph?

I'm getting to grips with the Python SDK, having never used GraphQL before (but I'm familiar with the basic concept). I'm able to retrieve the odata_next_link value from responses, but I'm not sure ...
scubbo's user avatar
  • 4,969
-5 votes
2 answers
40 views

FizzBuzz count issue [closed]

I have been running into an issue with my python code for a Fizz Buzz program. I want the loop to stop dead on the count 100, but I can only seem to manage to stop the count at 99 or 101. Is there any ...
Rschmidt Schmidt's user avatar
1 vote
1 answer
19 views

Pre-built class variables in Enum subclass

I'm making a set of Enum classes, and I'd like to build a few iterables over the Enum members up front. Ideally these iterables would be accessible in O(1) time (after the initial build) via a class ...
obviouslyalive's user avatar
0 votes
0 answers
13 views

Pycharm Terminal (Powershell) uses incorrect path for virtual environment even though python interpreter path is correct

I work in Pycharm on a python project. I want to use the terminal within Pycharm (powershell) to install new packages. When I run pip install websockets. I get the following error: Fatal error in ...
Filipovic's user avatar
0 votes
1 answer
27 views

Find the amount of rows that follow certain rules including starting date and boolean value in this day

I have a dataframe that has 2 columns named "timestamp" and "is_holiday". Timestamp goes with "yyyy-mm-dd" , "is_holiday" goes with 0 or 1 depending if there is ...
krmbla's user avatar
  • 1
-2 votes
0 answers
16 views

Time series line plot excluding weekends [duplicate]

I am using python and matplotlib to plot time series data. The dataset only has values for Monday-Friday. I end up with these straight lines on the chart during the weekends. Is there a way I can ...
Wesley Laurence's user avatar
0 votes
0 answers
5 views

Error in MySQL using python and XAMPP: MySQL Connection not available

I'm making a discount card system, there will be payments using stripe and registration, I'm using MySQL and XAMPP for the database, but I'm having a problem, it's giving me this error: MySQL ...
Davi's user avatar
  • 1
0 votes
0 answers
5 views

ValidationError when instantiating SimpleNodeParser class from llama index

Taking straight from the docs ... from llama_index.node_parser import SimpleNodeParser from llama_index import SimpleDirectoryReader # load the blogs in using the reader docs = SimpleDirectoryReader('...
superhero's user avatar
  • 185
0 votes
0 answers
15 views

Issues with Numpy initialisation

In the initialisation function, I've encountered the following issue while working with ACO: I have multiple paths, each of which is subdivided into arcs that are segmented into segments, and ...
Charmante's user avatar
0 votes
0 answers
8 views

How to Create Conda Environment in AWS Lambda at Run Time?

I am using an AWS lambda as part of my CI/CD pipeline. The lambda checks out some code using the provided git url and commit hash in the event. Then, it goes into the source code and does a conda env ...
Riley Hun's user avatar
  • 2,541
0 votes
1 answer
10 views

Oracle "ORA-00942: table or view does not exist" using Django with multiple databases/schemas

I recently had to change up my Django back end to accommodate a "restricted database user". Instead of querying the database using the database admin user that is responsible for making/...
George Nassar's user avatar
1 vote
1 answer
26 views

is there a way to create and init a dir variable in one line using pathlib?

I try to stick to pathlib to create and manipulate path but generating folders is always a pain. If I want to init a "toto" folder in a "tutu" folder and store the path in a ...
Pierrick Rambaud's user avatar
-4 votes
0 answers
14 views

How to get all shot chart data from every player between 2002 and current season?

I've tried looping through 2002 - 2023 with 'season' as an argument but it's giving me an error: Error fetching shot chart details for player 77583, team 1610612737, and year 2004: ShotChartDetail....
jerseydoe's user avatar
0 votes
1 answer
24 views

How to remove special character from excel header in pandas

I'm trying to read an excel file in pandas which has special characters in its header. I have a column with name like this "Col(≤9%)". How can I remove less than equal sign here? If the ...
hampi2017's user avatar
  • 701
0 votes
0 answers
14 views

"TypeError: copy() missing 1 required positional argument: 'dst' when importing external libraries in IDLE"

I'm facing an issue in my Python development environment, specifically when working in IDLE. Whenever I try to import external libraries using statements like import library_name, I encounter the ...
sadra hoseini's user avatar
0 votes
0 answers
15 views

Python- accessing Tkinter slider(scale) value in another class than it was created

I am very new to python. I am trying to make simple app using code snippet created by user "FooBar167" used to zoom large images (original post here: https://stackoverflow.com/a/48137257). ...
KarolB's user avatar
  • 21
0 votes
0 answers
18 views

Como converter números para binário octal e hexadecimal em python [closed]

Hoje, estou aqui para tirar a dúvida de algumas pessoas sobre como converter números em python imaginemos que temos uma variável num = 12 e quisessemos converter ela # para converter em octal print(...
lebi15's user avatar
  • 1
0 votes
0 answers
16 views

How to rotate the image while keeping its actual dimensions?

I am trying to solve a problem with image rotation. I have some PNG image that contains a photo of a solar panel. It is cropped exactly around the panel. I place this image in a satellite map, where ...
freerider's user avatar
-1 votes
0 answers
15 views

Qt QMap strange behaviour

#include "widget.h" #include "./ui_widget.h" #include "logindialog.h" #include "signindialog.h" Widget::Widget(QWidget *parent) : QWidget(parent) , ui(...
Salar Alo's user avatar
0 votes
2 answers
30 views

Why am I getting error 'Invalid float value' when trying to pass float variable as argument to subprocess?

I have a Python script which takes multiple arguments. I want to run this script with different value of arguments. I have written the following code for a trial run but I am getting an error: L1=[9,...
Priyajit Jana's user avatar
-1 votes
0 answers
10 views

CommError in the wandb machine learning modeling

for run in range(5): # 1️⃣ Start a new run to track this script wandb.init(reinit=True, project="basic-intro", config={ "learning_rate": 0.02, ...
امیرحسین پژوهان's user avatar
0 votes
1 answer
24 views

How to keep Processes alive in python multiprocessing so that they maintain state and can be reused?

I would like to divide an expensive computation among many subprocesses that can all work on part of the problem in an embarassing parallel way. However, each subprocess needs a large amount of ...
Alex's user avatar
  • 1,442
-2 votes
0 answers
24 views

What is an example of such an underflow in Python?

I am trying to give an example of an underflow in Python where multiplying a lot of small fractions result in garbage output. I tried, >>> print(f'{0.45:.20f}') 0.45000000000000001110 >>...
scribe's user avatar
  • 669
0 votes
0 answers
6 views

Sagemaker AutoML not finding .gzip file

I have a file saved in an s3 bucket with the extension .gzip. I am then launching an AutoML job using boto3, but it does not find the file (I am certain it is in there). I get this error in the log of ...
Aaron England's user avatar
-1 votes
0 answers
17 views

How can i fix AttributeError: module 'numpy' has no attribute 'int' [duplicate]

I'm trying to convert text to voice in rvc-tts-webui (https://github.com/litagin02/rvc-tts-webui) enter image description here I'm getting a lot of errors: Traceback (most recent call last): File &...
flytec's user avatar
  • 1
0 votes
1 answer
13 views

Web-Browser asks to upload file

I am trying to automate one of my tasks using python and selenium. I am very new to both, so I may not have the expertise as everyone else. Their is a part in my task where I visit a web page to ...
Zyngle's user avatar
  • 11
1 vote
1 answer
22 views

imshow with x-axis as log scale is not equally-spaced

I am using pcolor to generate the following plot (code below). It has a colorbar in log scale and the x-values are in log-scale too. The problem is that the rectangles in this plot have different ...
Physics_Student's user avatar
0 votes
1 answer
25 views

Trying to end my python code if certain conditions are met without any output

I'm a very amateur programmer and was just messing around with making my own code outside of class. I made a simple game of sorts where random numbers meant to represent a series of dice rolls are ...
SaturnT's user avatar
0 votes
0 answers
16 views

TypedDict does not show any error for mandatory fields

I am using TypedDict, for creating some rules for my dictionary. When I am passing my one key value pair and not passing the other keys and values it is still printing the output and not showing any ...
jonson's user avatar
  • 105
0 votes
1 answer
17 views

python how to read .xls file on python3.11.5

When I try to read an .xls file I get this error: Exception has occurred: XLRDError `Unsupported format, or corrupt file: Expected BOF record; found b'<?xml ve' File "G:\projects\python\tg-...
user22506198's user avatar
-1 votes
0 answers
17 views

python ne demarre pas quand j'exécute mon script [closed]

Bonjour voici le message d'erreur quand je veux executer mon script python que dois je faire svp?Merci jlb python: can't open file 'C:\Users\jeanl\OneDrive\Documents\shiftheroes\shiftheroes_': [Errno ...
JLBcodeur's user avatar

1
2 3 4 5
43236