[python] Getting min and max Dates from a pandas dataframe

How do I get the min and max Dates from a dataframe's major axis?

           value
Date                                           
2014-03-13  10000.000 
2014-03-21   2000.000 
2014-03-27   2000.000 
2014-03-17    200.000 
2014-03-17      5.000 
2014-03-17     70.000 
2014-03-21    200.000 
2014-03-27      5.000 
2014-03-27     25.000 
2014-03-31      0.020 
2014-03-31     12.000 
2014-03-31      0.022

Essentially I want a way to get the min and max dates, i.e. 2014-03-13 and 2014-03-31. I tried using numpy.min or df.min(axis=0), I'm able to get the min or max value but that's not what I want

This question is related to python datetime pandas

The answer is


min(df['some_property'])
max(df['some_property'])

The built-in functions work well with Pandas Dataframes.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to datetime

Comparing two joda DateTime instances How to format DateTime in Flutter , How to get current time in flutter? How do I convert 2018-04-10T04:00:00.000Z string to DateTime? How to get current local date and time in Kotlin Converting unix time into date-time via excel Convert python datetime to timestamp in milliseconds SQL Server date format yyyymmdd Laravel Carbon subtract days from current date Check if date is a valid one Why is ZoneOffset.UTC != ZoneId.of("UTC")?

Examples related to pandas

xlrd.biffh.XLRDError: Excel xlsx file; not supported Pandas Merging 101 How to increase image size of pandas.DataFrame.plot in jupyter notebook? Trying to merge 2 dataframes but get ValueError Python Pandas User Warning: Sorting because non-concatenation axis is not aligned How to show all of columns name on pandas dataframe? Pandas/Python: Set value of one column based on value in another column Python Pandas - Find difference between two data frames Pandas get the most frequent values of a column Python convert object to float