chap_core.time_period package¶
Submodules¶
chap_core.time_period.date_util_wrapper module¶
- class chap_core.time_period.date_util_wrapper.DateUtilWrapper(date: datetime)[source]¶
Bases:
object
- class chap_core.time_period.date_util_wrapper.Day(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.date_util_wrapper.Month(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.date_util_wrapper.PeriodRange(start_timestamp: TimeStamp, end_timestamp: TimeStamp, time_delta: TimeDelta)[source]¶
Bases:
BNPDataClass- concatenate(other: PeriodRange) PeriodRange[source]¶
- property delta¶
- property end_timestamp¶
- classmethod from_time_periods(start_period: TimePeriod, end_period: TimePeriod)[source]¶
- classmethod from_timestamps(start_timestamp: TimeStamp, end_timestamp: TimeStamp, time_delta: TimeDelta)[source]¶
- property month¶
- searchsorted(period: TimePeriod, side='left')[source]¶
Find the index where the period would be inserted to maintain order
- property shape¶
- property start_timestamp¶
- todict()[source]¶
Convert the data into a dictionary with the field names as keys and the corresponding data as values.
Returns¶
dict[str, ArrayLike]
- tolist()[source]¶
Convert the data into a list of entries from the corrsponding dataclass with normal python types. Similar to np.tolist and pd.tolist. This is good for debugging, but for real applications requires a lot of memory allocation. For iterating over the data, use toiter instead.
Returns¶
list[cls.dataclass]
- topandas()[source]¶
Convert the data into a pandas DataFrame with the fields as columns
Returns¶
pandas.DataFrame
- property week¶
- property year¶
- class chap_core.time_period.date_util_wrapper.TimeDelta(relative_delta: relativedelta)[source]¶
Bases:
DateUtilWrapper
- class chap_core.time_period.date_util_wrapper.TimePeriod(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
object- property end_timestamp¶
- property id¶
- property last_day¶
- property n_days¶
- property start_timestamp¶
- class chap_core.time_period.date_util_wrapper.TimeStamp(date: datetime)[source]¶
Bases:
DateUtilWrapper- property date: datetime¶
- property week¶
- class chap_core.time_period.date_util_wrapper.Week(date, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.date_util_wrapper.Year(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
chap_core.time_period.multi_resolution module¶
chap_core.time_period.period_assignment module¶
- class chap_core.time_period.period_assignment.PeriodAssignment(to_range: PeriodRange, from_range: PeriodRange)[source]¶
Bases:
objectMatches two period ranges with possibly different time deltas and gives assignments to each period in the first range.
chap_core.time_period.relationships module¶
- chap_core.time_period.relationships.previous(period: TimePeriod) TimePeriod[source]¶
Module contents¶
- class chap_core.time_period.Day(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.Month(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.PeriodRange(start_timestamp: TimeStamp, end_timestamp: TimeStamp, time_delta: TimeDelta)[source]¶
Bases:
BNPDataClass- concatenate(other: PeriodRange) PeriodRange[source]¶
- property delta¶
- property end_timestamp¶
- classmethod from_time_periods(start_period: TimePeriod, end_period: TimePeriod)[source]¶
- classmethod from_timestamps(start_timestamp: TimeStamp, end_timestamp: TimeStamp, time_delta: TimeDelta)[source]¶
- property month¶
- searchsorted(period: TimePeriod, side='left')[source]¶
Find the index where the period would be inserted to maintain order
- property shape¶
- property start_timestamp¶
- todict()[source]¶
Convert the data into a dictionary with the field names as keys and the corresponding data as values.
Returns¶
dict[str, ArrayLike]
- tolist()[source]¶
Convert the data into a list of entries from the corrsponding dataclass with normal python types. Similar to np.tolist and pd.tolist. This is good for debugging, but for real applications requires a lot of memory allocation. For iterating over the data, use toiter instead.
Returns¶
list[cls.dataclass]
- topandas()[source]¶
Convert the data into a pandas DataFrame with the fields as columns
Returns¶
pandas.DataFrame
- property week¶
- property year¶
- class chap_core.time_period.TimePeriod(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
object- property end_timestamp¶
- property id¶
- property last_day¶
- property n_days¶
- property start_timestamp¶
- class chap_core.time_period.Week(date, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- class chap_core.time_period.Year(date: datetime | Number, *args, **kwargs)[source]¶
Bases:
TimePeriod- property id¶
- chap_core.time_period.get_period_range(start_period: TimePeriod, end_period: TimePeriod)¶