sensortoolkit.reference._ref_api_query.date_range_selector

date_range_selector(start_date, end_date)[source]

Generate two arrays (month_starts and month_ends) for which queries will be constructed in consecutive monthly segments.

Parameters
  • start_date (str) – Query period will begin on this date. Should be specified in a format accepted by pandas to_datetime module.

  • end_date (str) – Query period will end on this date. Should be specified in a format accepted by pandas to_datetime module.

Returns

two-element tuple containing:

  • month_starts (pandas datetimeindex): An array of monthly start dates.

    Example:

    DatetimeIndex(['2021-01-01', '2021-02-01',
                   '2021-03-01', '2021-04-01',
                   '2021-05-01', '2021-06-01'],
                   dtype='datetime64[ns]', freq='MS')
    
  • month_ends (pandas DateTimeIndex): An array of monthly end dates.

    Example:

    DatetimeIndex(['2021-01-31', '2021-02-28',
                   '2021-03-31', '2021-04-30',
                   '2021-05-31', '2021-06-30'],
                    dtype='datetime64[ns]', freq='M')
    

Return type

(tuple)