I’m using Beautiful Soup to put in a excel table some infos from a website. The bold titles are shown in the head columns while the text after the colon appear in the rows. What I’m doing is finding the text and searching for next_sibling –> The problem is that in some cases the text afte…
Tag: python
How to filter a column by the last characters in Python
I have a column with a string similar to country string_num Botswana 864-0-0 Germany 968-0-5 Thailand 684-1-0 I would like to filter out all the strings that end with the numbers-0-0 and get a full data set view of rest. I have tried the following code: The code runs, but I still see the rows that end with -0…
How would I code a simulation of 2 machines with a buffer using simpy?
I am new to simulation and am going through the simpy documentation. I kind of get the gist of it but cannot really seem to grasp how to translate the production line that I want to simulate. I am trying to simulate a production line with m number of machines and m-1 number of buffers. The machines basically …
dictionary inside column of a dataframe
I have a pandas dataframe that has a column like this : I want to make a condition on the whole dataframe based on the id value. I did many attempts but failed. it says key error, it cannot access ‘id’ which is inside the column ‘platform’. Any help is welcome, and thank you in advance…
Error installing cloud-sql-python-connector[pg8000] in Python 3.7
I am trying to connect to a Cloud SQL postgresql instance through python 3.7 from my local machine. I am following the guide from the README cloud-sql-python-connector. There it says to pip install the necessary module with the following command, for a postgresql instance: But when I run this in my terminal, …
Need to run the code again if it fails, is there anyway out?
i have written a selenium automation code however it is very unstable because of the Salesforce website , i need some expertise in my code. i wanted to know how i can re run the code if it fails. below is my code , i will not able able to share some part of my code. i was trying to
How to accurately check folders or files in python
I’ve been trying to code something that helps me make a file whenever it got deleted. My code: Do you guys have any ideas to continuously check if the file is still there? Answer Like Sayse, I would prefer to only check when needed. But if you *really* want to check regularly, you can use the threading …
I’m trying to use multiple nested np.where to create a column of a data frame in python ,facing error on the same
Consider a data frame with 97 rows and 44 columns where i have three columns whose names are “Bostwick”,”mu_yield” , so i’m trying to create a new column called “Target” where if the “Bostwick” column values lie between “5.00 and 6.75” else if …
How do you make a system that runs a different def randomly when a def is running?
I’m trying to make a game purely out of python, and I’m trying to make a system that runs a def randomly, does anyone know how? (Not making a system where it picks a random def, instead, it runs a def randomly depending on time) Any library is fine too. Edit 1: The def I was referring to was a
How to count word similarity between two pandas dataframe
Here’s my first dataframe df1 Here’s my second dataframe df2 Similarity Matrix, columns is Id from df1, rows is Id from df2 Note: 0 value in (1,1) and (3,2) because no text similar 1 value in (3,1) is because of Bersatu and Kita’ (Id 1ondf2is avalilable in Id3ondf1` 0.33 is counted because o…