Beispiel #1
0
 def base_quarter(self):
     """
     Get the DateRange of the quarter that contains self.bdate.
     """
     quarter = get_quarter(self.bmonth)
     start, end = self.get_quarter_range(self.byear, quarter)
     return DateFrame(start, end)
Beispiel #2
0
 def base_month(self):
     """
     Get the DateRange of the month that contains self.bdate
     """
     year, month = self.byear, self.bmonth
     start, end = self.get_month_range(year, month)
     return DateFrame(start, end)
Beispiel #3
0
    def next_year(self, years=1):
        """
        Get the DateRange that n years after self.bdate.

        Argus:
            year - next n years
        """
        start, end = self.relative_year(years=years)
        return DateFrame(start, end)
Beispiel #4
0
    def next_week(self, weeks=1):
        """
        Get the DateRange that n weeks after self.bdate.

        Argus:
            weeks - next n weeks
        """
        start, end = self.relative_week(weeks=weeks)
        return DateFrame(start, end)
Beispiel #5
0
    def next_quarter(self, quarters=1):
        """
        Get the DateRange that n quarters after self.bdate.

        Argus:
            quarters - next n quarters
        """
        start, end = self.relative_quarter(quarters=quarters)
        return DateFrame(start, end)
Beispiel #6
0
    def next_month(self, months=1):
        """
        Get the DateRange that n months after self.bdate.

        Argus:
            months - next n months
        """
        start, end = self.relative_month(months=months)
        return DateFrame(start, end)
Beispiel #7
0
    def next_day(self, days=1):
        """
        Get the DateRange that n days after self.bdate.

        Argus:
            days - next n days
        """
        start, end = self.relative_day(days=days)
        return DateFrame(start, end)
Beispiel #8
0
    def prev_day(self, days=1):
        """
        Get the DateRange that n days before self.bdate.

        Argus:
            days - n days ago
        """
        ndays = days * -1
        start, end = self.relative_day(days=ndays)
        return DateFrame(start, end)
Beispiel #9
0
    def prev_year(self, years=1):
        """
        Get the DateRange that n years before self.bdate.

        Argus:
            years - n years ago
        """
        nyears = years * -1
        start, end = self.relative_year(years=nyears)
        return DateFrame(start, end)
Beispiel #10
0
    def prev_quarter(self, quarters=1):
        """
        Get the DateRange that n quarters before self.bdate.

        Argus:
            quarters - n quarters ago
        """
        nquarters = quarters * -1
        start, end = self.relative_quarter(quarters=nquarters)
        return DateFrame(start, end)
Beispiel #11
0
    def prev_month(self, months=1):
        """
        Get the DateRange that n months before self.bdate.

        Argus:
            months - n months ago
        """
        nmonths = months * -1
        start, end = self.relative_month(months=nmonths)
        return DateFrame(start, end)
Beispiel #12
0
    def prev_week(self, weeks=1):
        """
        Get the DateRange that n weeks before self.bdate.

        Argus:
            weeks - n week ago
        """
        nweeks = weeks * -1
        start, end = self.relative_week(weeks=nweeks)
        return DateFrame(start, end)
Beispiel #13
0
    def to_date(self, to_date):
        """
        Return the DateRange from self.bdate to `to_date`

        Argus:
            to_date - Example: date(2015, 1, 1)
        """
        if to_date < self.bdate:
            raise InvalidDateRange()

        return DateFrame(self.bdate, to_date + timedelta(days=1))
Beispiel #14
0
    def from_date(self, from_date):
        """
        Return the DateRange from `from_date` to self.bdate

        Argus:
            from_date - Example: date(2015, 1, 1)
        """
        if from_date > self.bdate:
            raise InvalidDateRange()

        return DateFrame(from_date, self.bdate + timedelta(days=1))
Beispiel #15
0
 def base_day(self):
     """
     Get the DateRange of self.bdate.
     """
     return DateFrame(self.bdate, self.bdate)
Beispiel #16
0
 def base_week(self):
     """
     Get DateRange of the week that contains self.bdate.
     """
     start, end = self.get_week_range(self.bdate)
     return DateFrame(start, end)
Beispiel #17
0
 def base_year(self):
     """
     Get the DateRange of the year that contains self.bdate.
     """
     start, end = self.get_year_range(self.byear)
     return DateFrame(start, end)