Pandas
keyboard_arrow_down 655 guides
chevron_leftData Selection and Renaming
Method add_prefixMethod add_suffixMethod alignMethod at_timeMethod between_timeMethod dropMethod drop_duplicatesMethod duplicatedMethod equalsMethod filterMethod firstMethod getMethod headMethod idxmaxMethod idxminMethod lastMethod lookupMethod queryMethod reindexMethod renameMethod rename_axisMethod reset_indexMethod sampleMethod select_dtypesMethod set_axisMethod set_indexMethod tailMethod takeMethod truncate
check_circle
Mark as learned thumb_up
0
thumb_down
0
chat_bubble_outline
0
Comment auto_stories Bi-column layout
settings
Pandas DataFrame | at_time method
schedule Aug 12, 2023
Last updated local_offer
Tags Python●Pandas
tocTable of Contents
expand_more Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
Start your free 7-days trial now!
Pandas DataFrame.at_time(~)
method extracts rows that are of the specified time of day.
Parameters
1. time
| string
or datetime.time
The time of day.
2. axis
| int
or string
| optional
By default, axis=0
. Due to a lack of documentation, we're not too sure how this parameter can be used. If you have some insight, we'd love to chat with you!
Return Value
A DataFrame containing all the rows that are of the specified time of day.
Examples
Consider the following DataFrame:
index_date = pd.date_range("2020-12-25", periods=3, freq="12H")df = pd.DataFrame({"A":["a","b","c"]}, index=index_date)df
A2020-12-25 00:00:00 a2020-12-25 12:00:00 b2020-12-26 00:00:00 c
To learn more about the date_range(~)
method, click here for its documentation.
To fetch all rows where the time of day is "00:00"
(i.e. midnight):
df.at_time("00:00")
A2020-12-25 a2020-12-26 c
Here, the return type is a DataFrame.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
Official Pandas Documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.at_time.html
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!