Skip to content

DateOffset should have a property for a "normalized" shortcut string #14614

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

Closed
femtotrader opened this issue Nov 8, 2016 · 2 comments
Closed

Comments

@femtotrader
Copy link

Following discussion in pydata/pandas-datareader#257

DateOffset should have a property for a "normalized" shortcut string

So for example we should have

to_offset("7Min").normalized_string == "7T"
to_offset("7MIN").normalized_string == "7T"
to_offset("7min").normalized_string == "7T"

Maybe something like

@property
def normalized_string(self):
     if self.n == 1:
         return self.rule_code
     else:
         return str(self.n) + offset.rule_code
@jorisvandenbossche
Copy link
Member

You have the freqstr attribute for this:

In [180]: freq = pd.tseries.frequencies.to_offset("7Min")

In [181]: freq
Out[181]: <7 * Minutes>

In [182]: freq.freqstr
Out[182]: '7T'

@femtotrader
Copy link
Author

Thanks
Sorry
So I'm closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants