In this article, we will be discussing about how to find duplicate rows in a Dataframe based on all or a list of columns. For this we will use Dataframe.duplicated() method of Pandas. Syntax : DataFrame.duplicated(subset = None, keep =

# Tag: Pandas DataFrame-program

## Extracting rows using Pandas .iloc[]Extracting rows using Pandas .iloc[]

Pandas provide a unique method to retrieve rows from a Data frame. Dataframe.iloc[] method is used when the index label of a data frame is something other than numeric series of 0, 1, 2, 3….n or in case the user

## Applying Lambda functions to Pandas DataframeApplying Lambda functions to Pandas Dataframe

In Pandas, we have the freedom to add different functions whenever needed like lambda function, sort function, etc. We can apply a lambda function to both the columns and rows of the Pandas data frame. Example 1: Applying lambda function

## How to Do a vLookup in Python using pandasHow to Do a vLookup in Python using pandas

Vlookup is essentially used for vertically arranged data. Vlookup is an operation used to merge 2 different data tables based on some condition where there must be at least 1 common attribute(column) between the two tables. After performing this operation

## Python – Pandas Extracting rows using .loc[]Python – Pandas Extracting rows using .loc[]

Pandas provide a unique method to retrieve rows from a Data frame. DataFrame.loc[] method is a method that takes only index labels and returns row or dataframe if the index label exists in the caller data frame. Syntax: pandas.DataFrame.loc[] Parameters:

## Python – Pandas DataFrame.astype()Python – Pandas DataFrame.astype()

DataFrame.astype() method is used to cast a pandas object to a specified dtype. astype() function also provides the capability to convert any suitable existing column to categorical type. DataFrame.astype() function comes very handy when we want to case a particular

## Split Pandas Dataframe by RowsSplit Pandas Dataframe by Rows

We can try different approaches for splitting Dataframe to get the desired results. Let’s take an example of a dataset of diamonds. # importing libraries import seaborn as sns import pandas as pd import numpy as np # data

## How to calculate the Percentage of a column in Pandas ?How to calculate the Percentage of a column in Pandas ?

A Percentage is calculated by the mathematical formula of dividing the value by the sum of all the values and then multiplying the sum by 100. This is also applicable in Pandas Dataframes. Here, the pre-defined sum() method of pandas

## How to convert Dictionary to Pandas Dataframe?How to convert Dictionary to Pandas Dataframe?

Let’s discuss how to convert Python Dictionary to Pandas Dataframe. We can convert a dictionary to a pandas dataframe by using the pd.DataFrame.from_dict() class-method. Example 1: Passing the key value as a list. import pandas as pd data

## Python – Pandas df.size, df.shape and df.ndimPython – Pandas df.size, df.shape and df.ndim

Pandas .size, .shape and .ndim are used to return size, shape and dimensions of data frames and series. Syntax: dataframe.size Return : Returns size of dataframe/series which is equivalent to total number of elements. That is rows x columns. Syntax: