Skip to content

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…

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…

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 …