We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: If

Python : How to remove a file if exists and handle errors | os.remove() | os.ulink()

In this article we will discuss how to remove a file if only it exists and how to handle other types of exceptions using os.remove() & os.ulink(). How to remove a file using os.remove() python ‘s os module provides a function to remove the file i.e. Advertisements os.remove(path_of_file) It accepts the file path as argument …

Python : How to remove a file if exists and handle errors | os.remove() | os.ulink()Read More

Python : Check if a process is running by name and find it’s Process ID (PID)

In this article we will discuss a cross platform way to find a running process PIDs by name using psutil. To install python’s psutil library use, Advertisements pip install psutil Check if a process is running To check if process is running or not, let’s iterate over all the running process using psutil.process_iter() and match …

Python : Check if a process is running by name and find it’s Process ID (PID)Read More

Check if a Pandas DataFrame is empty or not

In this article, we will discuss four different ways to check if a given DataFrame is empty or not. Check whether DataFrame is empty using Dataframe.empty In Python’s pandas, the Dataframe class provides an attribute empty i.e. Dataframe.empty It return True if DatafFrame contains no data. Advertisements Let’s see an example, Create an empty DatafFrame …

Check if a Pandas DataFrame is empty or notRead More

Python : Check if a String contains a sub string & find it’s index | case insensitive

In this article we will discuss different ways to check if a sub-string exists in another string and if yes then find it’s index. Will also explore ways to check the existence of sub-string in case in-sensitive manner by ignoring case. Check if a String contains another string or character using “in” and “not in” …

Python : Check if a String contains a sub string & find it’s index | case insensitiveRead More

Pandas : Check if a value exists in a DataFrame using in & not in operator | isin()

In this article we will dicuss different ways to check if a given value exists in the dataframe or not. First of all, we need to import the pandas module i.e. Advertisements import pandas as pd Let’s create a dataframe, # List of Tuples empoyees = [(‘jack’, 34, ‘Sydney’, 155) , (‘Riti’, 31, ‘Delhi’ , …

Pandas : Check if a value exists in a DataFrame using in & not in operator | isin()Read More

Cart

Your Cart is Empty

Back To Shop