MCPcopy Index your code
hub / github.com/pydata/xarray / QuarterEnd

Class QuarterEnd

xarray/coding/cftime_offsets.py:498–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496
497
498class QuarterEnd(QuarterOffset):
499 # When converting a string to an offset, pandas converts
500 # 'Q' to a QuarterEnd offset starting in the month of
501 # December. When creating a QuarterEnd offset directly
502 # from the constructor, however, the default month is March.
503 # We follow that behavior here.
504 _default_month = 3
505 _freq = "QE"
506 _day_option = "end"
507
508 def rollforward(self, date):
509 """Roll date forward to nearest end of quarter"""
510 if self.onOffset(date):
511 return date
512 else:
513 return date + QuarterEnd(month=self.month)
514
515 def rollback(self, date):
516 """Roll date backward to nearest end of quarter"""
517 if self.onOffset(date):
518 return date
519 else:
520 return date - QuarterEnd(month=self.month)
521
522
523class YearOffset(BaseCFTimeOffset):

Callers 3

rollforwardMethod · 0.85
rollbackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…