I have CSV files like following I want to replace Result1, Result2, and Result3 columns by all zero if the sum of their column values is greater than 1. I tried this script When I do this operation Result3 column is dropped since it has all zero values. How do I do this operation only on the columns which sat…
Tag: python
How to use “on edit” events/signals with e.g. QLineEdit in pyside6 (Qt6)
Sorry for this post but I still don’t get it after my research on the internet. I am using Python PySide6 since I need to due to some display scaling issues I have with PyQt6 and other older versions. I already have implemented the basics of a large program with dynamic .ui loading and now I want to imp…
Adding a full stop to text when missing
How to add a full stop to a text please? I am not able to get the desired combined text. Answer You can use where and cat: Result: (this also works for the case when text1 is given and text2 is NaN)
my python Ray script runs on a single worker only
I am a new with Ray and after have read he documentation, I came up with a script that mimics what I want to do further with Ray. Here is my script: My problem is that when I run this script it runs on a single worker as indicated by the Ray output whereas I would expect 4 workers to
Selenium – couldn’t click next page
I’m trying to click the next button (>) and then repeat until the last page is reached. I’ve tried searching for solutions from similar questions but I couldn’t figure out what’s wrong/make it work. Here is my code, thank you! Answer Your xpath looks incorrect, please try the below …
faster processing of a for loop with put requests python
I have a json file – that i am reading and processing each element due to the api and the payload that is required. I am looking for ways to speed this up through multi processing / concurrency – not for sure the proper approach. I think either of those would work as they are individual request up…
Python local variable to global variable
I’m trying to write a modular script, with functions -Function 1 age = input(“tell me your age : “) -Function 2 weight = input(“tell me your weight : “) -Function 3 birthday = input(“tell me your birthday : “) at the end, i want to send a mail outside functions like :…
Python if statement not working correctly and no idea why
In my code I iterate through dataframes of each year to calculate the number of wins (increase between numbers) and losses (decrease between numbers), and the ratio of wins to losses. The loop I run correctly displays the right number of wins and losses in the dataframe they are eventually pushed to. However,…
How to detect which key was pressed on keyboard/mouse using tkinter/python?
I’m using tkinter to make a python app and I need to let the user choose which key they will use to do some specific action. Then I want to make a button which when the user clicks it, the next key they press as well in keyboard as in mouse will be detected and then it will be bound
How to use i right in a for loop?
I have 3 lists and I need to calculate for each i the product of first list i, second list i and third list len-(i+1). I tried to make a for loop which will do it for each i and I wrote this But it says in the second line “‘type’ object is not iterable” How can I make it