예제 #1
0
파일: period.py 프로젝트: edmoody/pandas
    def asfreq(self, freq=None, how='E'):
        """

        Parameters
        ----------
        freq :
        how :

        Returns
        -------
        resampled : Period
        """
        how = _validate_end_alias(how)
        base1, mult1 = _gfc(self.freq)
        base2, mult2 = _gfc(freq)

        if mult2 != 1:
            raise ValueError('Only mult == 1 supported')

        if how not in ('S', 'E'):
            raise ValueError('relation argument must be one of S or E')

        end = how == 'E'
        new_ordinal = lib.period_asfreq(self.ordinal, base1, base2, end)

        return Period(ordinal=new_ordinal, freq=base2)
예제 #2
0
파일: period.py 프로젝트: takluyver/pandas
    def asfreq(self, freq=None, how="E"):
        """

        Parameters
        ----------
        freq :
        how :

        Returns
        -------
        resampled : Period
        """
        how = _validate_end_alias(how)
        base1, mult1 = _gfc(self.freq)
        base2, mult2 = _gfc(freq)

        new_ordinal = lib.period_asfreq(self.ordinal, base1, mult1, base2, mult2, how)

        return Period(new_ordinal, (base2, mult2))
예제 #3
0
    def asfreq(self, freq=None, how='E'):
        """

        Parameters
        ----------
        freq :
        how :

        Returns
        -------
        resampled : Period
        """
        how = _validate_end_alias(how)
        base1, mult1 = _gfc(self.freq)
        base2, mult2 = _gfc(freq)

        new_ordinal = lib.period_asfreq(self.ordinal, base1, mult1,
                                        base2, mult2, py3compat.str_to_bytes(how))

        return Period(ordinal=new_ordinal, freq=(base2, mult2))