I have a dataframe df and it has a Date column. I want to create two new data frames. One which contains all of the rows from df where
df
Date
You can use datetime accesor.
import datetime as dt df['Date'] = pd.to_datetime(df['Date']) include = df[df['Date'].dt.year == year] exclude = df[df['Date'].dt.year != year]