I’m trying to add a condition .apply with a lambda function that pickups up a keyword but ignores values if they contain a specific word “total.” My dataframe: Here’s my code: current col output: Desired col output: Question What am I doing wrong? I have tried the ~ to make it a NOT bu…
Tag: python
How to change the layout of a Tkinter Combobox?
To make the border disapear or simply change it’s color. I tried with highlighttickness or borderwidth but it doesn’t work. So I was told to try with the layouts, the thing is I don’t know how to change the border with the layouts On this pic the border is still visible on the combobox I wan…
How to calculate percentages inside nested dictionaries in Python
I have two dictionaries: For every key in the People dictionary, I want to calculate the percentage of values(fruits count) based on the fruit dictionary broken down by individual fruits and all fruits combined. This is how the calculation is: {‘sam’:{‘mango’:3/12 = 0.25,’kiwi…
Python: Inner Class
I am trying to create a json string from a class and I defined my class as follows: I’m getting an error ‘TypeError: ‘NoneType’ object is not callable’. Is it because I’m setting the Header and Body in the OuterClass definition myself to None? Answer The problem with your c…
How can I send and receive data between two PiPicos using LEDs?
How can I code two Pi Picos to send/receive data accurately to 10 milliseconds a bit using LED/Photodiode pairs? I am trying to send data from one PiPico to another wirelessly. I am on a bit of a time crunch and have unsuccessfully tried getting my photodiode circuit to output the correct voltage swings to us…
how to type a function that returns None if input is string otherwise return the input as is
I wonder what’s the right way to type annotate a python function as below? This is a toy example that is analogous to a python I encountered that needs type annotated. Using Union like doesn’t feel right because it doesn’t enforce the rules an int input must result in an int output. a float …
Select value from dropdown and click on search
I want they select value for the dropdown from the Ville option and then click on search option for each value but the problem is that they do not select value from ville these is pag link https://www.barreaunantes.fr/annuaire/ enter image description here Answer Your element locator strategy selection isn…
Scraping data from website that refreshes every 10 minutes in python
I am very new to web scraping and python in general. I am working on a project that requires me to scrape data from a website that refreshes/updates data every 10 minutes. I was able to scrape the data for the current 10 minutes but when the data refreshes the previous data is not valid anymore. I need help w…
Python Loops result not understanding [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 months ago. Improve this question Can …
How to save what a tkinter window looks like without screenshot? (Possibly a numpy array?)
I have a short program that generates images of 1, 2, 3, and 4 random coloured circles to train a neural network on. My issue is, just doing 4000 images takes about 20-30 mins, and I need about 50000 images. My current method is to create the image, screenshot it, and then delete the tkinter object and restar…