If date column is the index, then use .loc for label based indexing or .iloc for positional indexing.

For example:

df.loc['2014-01-01':'2014-02-01']

See details here http://pandas.pydata.org/pandas-docs/stable/dsintro.html#indexing-selection

If the column is not the index you have two choices:

  1. Make it the index (either temporarily or permanently if it's time-series data)
  2. df[(df['date'] > '2013-01-01') & (df['date'] < '2013-02-01')]

See here for the general explanation

Note: .ix is deprecated.

Answer from Retozi on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-filter-dataframe-rows-based-on-the-date-in-pandas
How to Filter DataFrame Rows Based on the Date in Pandas? - GeeksforGeeks
July 23, 2025 - The code then converts the 'date' column to datetime format and filters the DataFrame to include rows with dates between '2020-08-01' and '2020-09-01' using the dt.strftime('%Y-%m-%d') method. The filtered DataFrame is then displayed. ... import pandas as pd # Create a sample dataframe df = pd.DataFrame({'num_posts': [4, 6, 3, 9, 1, 14, 2, 5, 7, 2], 'date': ['2020-08-09', '2020-08-25', '2020-09-05', '2020-09-12', '2020-09-29', '2020-10-15', '2020-11-21', '2020-12-02', '2020-12-10', '2020-12-18']}) # Convert the date to datetime64 df['date'] = pd.to_datetime(df['date'], format='%Y-%m-%d') # Filter data between two dates using dt.strftime() filtered_df = df[df['date'].dt.strftime( '%Y-%m-%d').between('2020-08-01', '2020-09-01')] # Display print(filtered_df)
Discussions

Can you filter pandas dataframes by Day/Month date without year? Writing a generalised function for between date that is year agnostic is proving difficult.
Ths issue stems from using year agnostic dates. If I want to return dates between June 15th - Sep 15th for every year it seems I need to manually… More on reddit.com
🌐 r/learnpython
8
6
April 19, 2024
Filtering dataframe by column = today's date
Something like this? df[df['date'] == datetime.now().date()] More on reddit.com
🌐 r/learnpython
3
1
April 16, 2021
How does one sort by date in a Dataframe?
One idea is to convert the dates when you read the file in, so that they're right from the beginning. df = CSV.read("/tmp/data.csv", dateformat="yyyy-mm-ddTHH:MM:SS.000Z", header=false, copycols=true) If you have a column you want to change, try something like: df = DataFrame( A = 1:5, B = ["2019-Jan-19", "2019-Feb-19", "2018-Jan-19", "2017-Feb-19", "2019-Jan-19"] ) df.B = DateTime.(df.B, "YYYY-uuu-dd") Then sort is just sort!(df, (:B)) More on reddit.com
🌐 r/Julia
3
4
August 26, 2019
Filtering by month in Python
Normally, I extract the date variable of interest to a separate column and then filter on that. It's not speed-optimal on large datasets, but it has the advantage of being explicit and the speed difference is generally inconsequential on smaller (less than a few hundred thousand records) data sets. So I would have something like this df['Month'] = df['Workflow_Start_date'].dt.month East = df[df['Month'] == 4] Then in your East df, you can just drop the Month column, or keep it. It doesn't really matter with only 30k records. That's all assuming your Workflow_Start_date variable is being read as a datetime (which it should be based on the last line of your post). If it isn't, you can modify the above lines to something like this df['Month'] = pd.to_datetime(df['Month']).dt.month East = df[df['Month'] == 4] I prefer this way because it is very explicit what you're doing, which means that it's easy to read and understand what you're doing. If you're working on a very large dataframe, then that extra column computation can be problematic as it can potentially take some time, but a small dataset like you have, with only 30k records, shouldn't be an issue in the slightest. More on reddit.com
🌐 r/learnpython
6
2
May 7, 2018
🌐
CodeSignal
codesignal.com › learn › courses › basic-tsla-financial-data-handling-in-pandas › lessons › filtering-data-by-date-range-in-pandas
Filtering Data by Date Range in Pandas - Python
With the date column converted to datetime objects, set as the index, and sorted, we can now filter the DataFrame by a specific date range. This technique is particularly useful when you need to analyze data for a specific year, month, or any custom date range.
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas filter dataframe rows on dates
Pandas Filter DataFrame Rows on Dates - Spark By {Examples}
October 4, 2024 - Pandas Filter DataFrame Rows by matching datetime (date) - To filter/select DataFrame rows by conditionally checking date use DataFrame.loc[] and
🌐
DataScientYst
datascientyst.com › filter-by-date-pandas-dataframe
How to Filter DataFrame by Date in Pandas
December 2, 2021 - Here are several approaches to filter rows in Pandas DataFrame by date: 1) Filter rows between two dates df[(df['date'] > '2019-12-01'
🌐
Reddit
reddit.com › r/learnpython › can you filter pandas dataframes by day/month date without year? writing a generalised function for between date that is year agnostic is proving difficult.
r/learnpython on Reddit: Can you filter pandas dataframes by Day/Month date without year? Writing a generalised function for between date that is year agnostic is proving difficult.
April 19, 2024 - Month '%b' as input, I need to filter dataframe for dates from beginning of the month 2 months ago to end of input month ... I can't understand functions for the life of me. ... Filter function is missing data. I'm using it to filter through days and grab the items that match if the day is between a certain range. When it comes to the end of the month it skips items ... Trying to learn Data Structures & Algorithms by Myself.
🌐
Saturn Cloud
saturncloud.io › blog › how-to-filter-pandas-dataframes-on-dates
How to Filter Pandas DataFrames on Dates | Saturn Cloud Blog
May 1, 2026 - By using the loc method and boolean arrays, you can easily filter DataFrames on specific dates or date ranges. By taking time zones into account, you can perform date filtering across different time zones.
Find elsewhere
🌐
Kanoki
kanoki.org › 2022 › 07 › 16 › pandas-filter-dates-by-month-hour-day-or-last-n-days-weeks
Pandas filter dates by month, hour, day and last N days & weeks | kanoki
July 16, 2022 - We have dataframe with dates or timestamps columns and we would like to filter the rows by Month, Hour, day or by last n days from today’s date. Pandas has a dt accessor object for datetimelike properties of the series and can be used to access the properties from Timestamp or a collection of timestamps like a DatetimeIndex.
🌐
IncludeHelp
includehelp.com › python › how-to-filter-pandas-dataframes-on-dates.aspx
How to filter Pandas DataFrames on dates? - Python
September 20, 2023 - # Importing pandas package import pandas as pd # Creating a Dictionary dict = { 'Name':['Amit','Bhairav','Chirag','Divyansh','Esha'], 'DOB':['07/12/2001','08/11/2002','09/10/2003','10/09/2004','11/08/2005'], 'Gender':['Male','Male','Male','Male','Female'] } # Creating a DataFrame df = pd.DataFrame(dict) # Converting the column DOB value into datetime format df['DOB']= pd.to_datetime(df['DOB']) # Display DataFrame print("Original DataFrame:\n",df,"\n") # Filtering DataFrame result = (df['DOB'] > '2002-08-01' ) & (df['DOB'] <= '2004-09-15') filtered_df = df.loc[result] # Display filtered data print("Filtered DataFrame:\n",filtered_df)
🌐
GPT Tutor Pro
gpttutorpro.com › pandas-dataframe-filtering-using-datetime-methods
Pandas DataFrame Filtering: Using Datetime Methods
March 12, 2024 - This blog will teach you how to use datetime methods in Pandas to filter data based on dates and times. You will learn how to create a datetime index, filter data by date, time, date range, time range, day of week, month, or year in Pandas.
🌐
Codesignal
learn.codesignal.com › preview › lessons › 2331
Codesignal
The first step in filtering data by date is to ensure that the date column is in a suitable format. Let's start by loading the Tesla ($TSLA) stock dataset and converting the "Date" column to datetime objects using pd.to_datetime(). import pandas as pd import datasets # Load TSLA dataset tesla_data = datasets.load_dataset('codesignal/tsla-historic-prices') tesla_df = pd.DataFrame(tesla_data['train']) # Convert the Date column to datetime type tesla_df['Date'] = pd.to_datetime(tesla_df['Date']) # Display initial rows to inspect the format print(tesla_df.head())
🌐
TutorialsPoint
tutorialspoint.com › python-pandas-filter-dataframe-between-two-dates
Python Pandas – Filter DataFrame between two dates
resDF = dataFrame.loc[(dataFrame["Date_of_Purchase"] >= "2021-05-10") & (dataFrame["Date_of_Purchase"] <= "2021-08-25")] ... import pandas as pd # dictionary of lists d = {'Car': ['BMW', 'Lexus', 'Audi', 'Mercedes', 'Jaguar', 'Bentley'],'Date_of_Purchase': ['2021-07-10', '2021-08-12', '2021-06-17', '2021-03-16', '2021-02-19', '2021-08-22'] } # creating dataframe from the above dictionary of lists dataFrame = pd.DataFrame(d) print"DataFrame...\n",dataFrame # fetch car purchased between two dates # 1st Date: 2021-05-10 # 2nd Date: 2021-08-25 resDF = dataFrame.loc[(dataFrame["Date_of_Purchase"] >= "2021-05-10") & (dataFrame["Date_of_Purchase"] <= "2021-08-25")] # print filtered data frame print"\nCars purchased between 2 dates: \n",resDF
🌐
InterviewQs
interviewqs.com › ddi-code-snippets › select-pandas-dataframe-rows-between-two-dates
Select Pandas dataframe rows between two dates - InterviewQs
next, set the desired start date and end date to filter df with -- these can be in datetime (numpy and pandas), timestamp, or string format
🌐
Tdhopper
tdhopper.com › blog › filter-by-date-in-a-pandas-multiindex
Filter by date in a Pandas MultiIndex - Tim Hopper
November 8, 2016 - The Pandas docs show how it can be used to filter a MultiIndex: It turns out you can easily use it to filter a DateTimeIndex level by a single date with df['2016-11-07'] or a range of dates with df['2016-11-07:2016-11-11']. This applies whether ...
🌐
Arab Psychology
scales.arabpsychology.com › home › how to filter a pandas dataframe by date range
How To Filter A Pandas DataFrame By Date Range
November 25, 2025 - Alternatively, if you are using explicit boolean indexing, you achieve non-inclusive behavior simply by changing the comparison operators. For instance, using > (greater than) instead of >= (greater than or equal to) ensures the start date is excluded from the resulting subset. This manual control is often preferred when the analyst needs strict exclusion based on time intervals, such as querying data that occurred after a specific event but before another. When dealing with date filtering, it is crucial to remember that pandas datetime objects often include time components (hours, minutes, seconds) even if they are defaulted to midnight (00:00:00).
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas select dataframe rows between two dates
Pandas Select DataFrame Rows Between Two Dates - Spark By {Examples}
November 27, 2024 - Let's see how to select/filter rows between two dates in Pandas DataFrame, in real-time applications you would often be required to select rows between
🌐
Reddit
reddit.com › r/learnpython › filtering dataframe by column = today's date
r/learnpython on Reddit: Filtering dataframe by column = today's date
April 16, 2021 -

I'm looking for a way to only extract rows where the date column is equal to today's date. If today is 4/14/21, I only want the row for that date, etc. I don't want to change the date, I basically want it to return the rows for whichever day it is. Any ideas?

date hand
2021-04-14 two pair
2021-04-15 flush
2021-04-15 straight
2021-04-16 royal flush
2021-04-16 ace high
2021-04-17 ace high
🌐
Linux find Examples
queirozf.com › entries › pandas-dataframe-examples-manipulating-date-and-time
Pandas Dataframe Examples: Manipulating Date and Time
September 17, 2022 - import pandas as pd df = pd.DataFrame({ ... # use strftime to turn a timestamp into a # a nicely formatted d-m-Y string: df["formatted_col"] = df["timestamp_col"].map(lambda ts: ts.strftime("%d-%m-%Y")) ... For example: Filter rows where date_of_birth is smaller than a given ...