date_time#
- predict_backend.utils.date_time.create_cron_description(schedule_meta, use_24hour_time_format=True)#
Creates a cron description in plain English
- Parameters:
schedule_meta (
Dict
) – dict, a ScheduleSchema objectuse_24hour_time_format (
bool
) – bool, whether to use 24-hour time format, default True
- Returns:
A string of the cron description, for example: ‘At 12:00 only on Sunday’
- predict_backend.utils.date_time.create_date_range_data_frame(start_date, end_date, interval_length_seconds=3600, interval_column_name='time', zero_minutes=True, zero_seconds=True)#
Creates a data range from provided start and end dates, with custom intervals
- Parameters:
start_date (
datetime
) – datetime, the start date of the rangeend_date (
datetime
) – datetime, the end date of the rangeinterval_length_seconds (
Optional
[int
]) – the interval length in seconds, default 3600interval_column_name (
Optional
[str
]) – the interval column ame, default “time”zero_minutes (
Optional
[bool
]) – bool, whether to start the start date seconds and microseconds at 0 seconds, default Truezero_seconds (
Optional
[bool
]) – bool, whether to start the start date at minute 0, default True
- Returns:
A Pandas dataframe
- predict_backend.utils.date_time.cron_string_from_kwargs(use_seconds, second, minute, hour, day, month, day_of_week, year, **kwargs)#
Gets a cron formatted string from args
- Parameters:
use_seconds (:param) – bool, Whether to have seconds at the start of the cron string
second (
str
) – str, the second of the cron stringminute (
str
) – str, the minute of the cron stringhour (
str
) – str, the hour of the cron stringday (
str
) – str, the day of the cron stringmonth (
str
) – str, the month of the cron stringday_of_week (
str
) – str, the day of the week of the cron stringyear (
str
) – str, the year of the cron string**kwargs –
Allows providing the time args as a dict instead of individual arguments
:return:A cron formatted string
- predict_backend.utils.date_time.get_unix_ms_series(series, timezone='UTC', remove_local=False)#
Takes a data series and converts the timezone to the provided one, and can remove the local timezone if needed
- Parameters:
series – Pandas dataframe series, for example data_frame[col]
timezone – str, The timezone to translate to
remove_local – bool, whether to set the time to naive local time
- Returns:
A data series