How many times can you divide 24**36 by 2 until it becomes imprecise? I had this question on one of my quizzes in a python course, and I’m curious as to what the correct answer is. (It’s already submitted so no cheating here) I wrote this small bit of code in python to calculate how many times you…
Tag: python
Pandas cleaner syntax
I would like to replace the following syntax with a cleaner, chained syntax – perhaps using .pipe (similar to dplyr library in R): Sample dataset: Code to replace by piping: Expected output: Answer Here are two elegant ways to get your output: or
Scrapping with request_HTML
I am trying to scrape this website down below: https://www.kayak-polo.info/kphistorique.php?Group=CE&lang=en down below is my code. I am trying to actually get the text inside the caption element (as shown on the screenshot). However I believe I cannot find the tag because it has no closing tag and that&#…
How to set values in a dataframe according to multiple conditions and different groups?
I have a complex mapping problem. I have a table with groups. Each group has a list of 7 products The product list may contain duplicate products. MY GOAL : I have to map 5 products in the list of 7 products If the value of the column rank is equal to 1, 2, 3 then Product_1, Product_2, Product_3. If
What are the differences between strings ‘True’,’False’ and boolean True,False in Python
variety min max Pinot Grigio 4.0 70.0 Malbec-Syrah 4.0 78.0 White Blend 4.0 375.0 Tempranillo 4.0 600.0 variety min max Ramisco 495.0 495.0 Terrantez 236.0 236.0 Francisa 160.0 160.0 Rosenmuskateller 150.0 150.0 I got two different sorted values when I passed the ascending arguments in the list format of bool…
Merging values with a same key
Tried to google how to merge multiple dictionaries, but could not find a solution to merge values under same key in a dictionary. Although the original data is list, the expected results should be dictionary. I am stacked here, and hope someone show me a way to get resolve this. Original Data: Expected Result…
python question about loops comparing string to string
I am trying to emulate a circumstance where i send information and only get a true or false as a return. So i can check each character and if it is true, that means that character is in the string. I would know there would be a position 0 to some number x. I would receive a true result and
numpy slicing using multiple conditions where one of the conditions searches the neighborhood of an element
the problem is to take a black-white image, detect all the places where white borders on black, keep that white, and turn all other white pixels black. I know how to do this using normal for-loops and lists, but I want to do it w/ numpy, which I am not that familiar with. Here is what I have so far:
How to uninstall a .exe from a python script
Hello I can’t get an app to self uninstall. After converting a .py script to .exe when I press the button it is supposed to delete/uninstall itself from my computer. Actually I would like it to uninstall completely from my computer after pressing the button from the .exe how to do it? Here is the code: …
Combine and sort multiple array columns of values A and B where A is the common index
I have a n-long list of arrays. Each array consists of two columns: A) index values between 1-500 B) measured values Each A column is slightly different (i.e. missing or having extra values). I want to create single large array where i) there is single A (index) column consisting of all the index values and i…