Skip to content

DOC: Add infer frequency to docs #10053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Top-level dealing with datetimelike
bdate_range
period_range
timedelta_range
infer_freq

Top-level evaluation
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1364,6 +1365,7 @@ Time/Date Components
DatetimeIndex.is_quarter_end
DatetimeIndex.is_year_start
DatetimeIndex.is_year_end
DatetimeIndex.inferred_freq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also defined for TimedeltaIndex


Selecting
~~~~~~~~~
Expand Down Expand Up @@ -1414,6 +1416,7 @@ Components
TimedeltaIndex.microseconds
TimedeltaIndex.nanoseconds
TimedeltaIndex.components
TimedeltaIndex.inferred_freq

Conversion
~~~~~~~~~~
Expand Down
5 changes: 5 additions & 0 deletions pandas/tseries/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def freqstr(self):

@cache_readonly
def inferred_freq(self):
"""
Trys to return a string representing a frequency guess,
generated by infer_freq. Returns None if it can't autodetect the
frequency.
"""
try:
return infer_freq(self)
except ValueError:
Expand Down
5 changes: 3 additions & 2 deletions pandas/tseries/frequencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@ def _period_str_to_code(freqstr):
def infer_freq(index, warn=True):
"""
Infer the most likely frequency given the input index. If the frequency is
uncertain, a warning will be printed
uncertain, a warning will be printed.

Parameters
----------
index : DatetimeIndex
index : DatetimeIndex or TimedeltaIndex
if passed a Series will use the values of the series (NOT THE INDEX)
warn : boolean, default True

Expand All @@ -684,6 +684,7 @@ def infer_freq(index, warn=True):
freq : string or None
None if no discernible frequency
TypeError if the index is not datetime-like
ValueError if there are less than three values.
"""
import pandas as pd

Expand Down