is_leap_year is the inbuilt method to indicate whether a given year is leap year or not in Pandas Python. Let’s see how to
- Get Whether the given year is leap year or not in pandas python
First lets create the dataframe
import pandas as pd
import numpy as np
import datetime
date1 = pd.Series(pd.date_range('2012-1-1 12:00:00', periods=7, freq='Y'))
df = pd.DataFrame(dict(date_given=date1))
print(df)
so the resultant dataframe will be

is_leap_year function gets whether the given year is leap year or not.
df['is_leap_year'] = df['date_given'].dt.is_leap_year print(df)
so the resultant dataframe will be






