Skip to content

Test/fix Period.to_timestamp issues #1116

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
wesm opened this issue Apr 23, 2012 · 0 comments
Closed

Test/fix Period.to_timestamp issues #1116

wesm opened this issue Apr 23, 2012 · 0 comments
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Apr 23, 2012

Should conform with new PeriodIndex.to_timestamp, add lots of test for annual, quarterly, other frequencies

    def start_time(self):
        return self.to_timestamp(which_end='S')

    def end_time(self):
        return self.to_timestamp(which_end='E')

    def to_timestamp(self, which_end='S'):
        """
        Return the Timestamp at the start/end of the period

        Parameters
        ----------
        which_end: str, default 'S' (start)
            'S', 'E'. Can be aliased as case insensitive
            'Start', 'Finish', 'Begin', 'End'

        Returns
        -------
        Timestamp
        """
        which_end = _validate_end_alias(which_end)
        new_val = self.asfreq('S', which_end)
        base, mult = _gfc(new_val.freq)
        return Timestamp(lib.period_ordinal_to_dt64(new_val.ordinal, base, mult))
@wesm wesm closed this as completed in 1a35746 Apr 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant