<s> from pandas . tseries . converter import DatetimeConverter <EOL> from . pandas_vb_common import * <EOL> import pandas as pd <EOL> from datetime import timedelta <EOL> import datetime as dt <EOL> try : <EOL> import pandas . tseries . holiday <EOL> except ImportError : <EOL> pass <EOL> from pandas . tseries . frequencies import infer_freq <EOL> import numpy as np <EOL> class dataframe_resample_max_numpy ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_max_numpy ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = np . max ) <EOL> class dataframe_resample_max_string ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_max_string ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class dataframe_resample_mean_numpy ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_mean_numpy ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = np . mean ) <EOL> class dataframe_resample_mean_string ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_mean_string ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class dataframe_resample_min_numpy ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_min_numpy ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = np . min ) <EOL> class dataframe_resample_min_string ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( <NUM_LIT> , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dataframe_resample_min_string ( self ) : <EOL> self . df . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class datetimeindex_add_offset ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT:T>' ) <EOL> def time_datetimeindex_add_offset ( self ) : <EOL> ( self . rng + timedelta ( minutes = <NUM_LIT:2> ) ) <EOL> class datetimeindex_converter ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> def time_datetimeindex_converter ( self ) : <EOL> DatetimeConverter . convert ( self . rng , None , None ) <EOL> class datetimeindex_infer_dst ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . dst_rng = date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT:S>' ) <EOL> self . index = date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT:S>' ) <EOL> self . index = self . index . append ( self . dst_rng ) <EOL> self . index = self . index . append ( self . dst_rng ) <EOL> self . index = self . index . append ( date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT:S>' ) ) <EOL> def time_datetimeindex_infer_dst ( self ) : <EOL> self . index . tz_localize ( '<STR_LIT>' , infer_dst = True ) <EOL> class datetimeindex_normalize ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT:S>' , tz = '<STR_LIT>' ) <EOL> def time_datetimeindex_normalize ( self ) : <EOL> self . rng . normalize ( ) <EOL> class datetimeindex_unique ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT:1000> , freq = '<STR_LIT:T>' ) <EOL> self . index = self . rng . repeat ( <NUM_LIT:10> ) <EOL> def time_datetimeindex_unique ( self ) : <EOL> self . index . unique ( ) <EOL> class dti_reset_index ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT:1000> , freq = '<STR_LIT:H>' ) <EOL> self . df = DataFrame ( np . random . randn ( len ( self . rng ) , <NUM_LIT:2> ) , self . rng ) <EOL> def time_dti_reset_index ( self ) : <EOL> self . df . reset_index ( ) <EOL> class dti_reset_index_tz ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT:1000> , freq = '<STR_LIT:H>' , tz = '<STR_LIT>' ) <EOL> self . df = DataFrame ( np . random . randn ( len ( self . rng ) , <NUM_LIT:2> ) , index = self . rng ) <EOL> def time_dti_reset_index_tz ( self ) : <EOL> self . df . reset_index ( ) <EOL> class period_setitem ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = period_range ( start = '<STR_LIT>' , freq = '<STR_LIT:S>' , periods = <NUM_LIT> ) <EOL> self . df = DataFrame ( index = range ( len ( self . rng ) ) ) <EOL> def time_period_setitem ( self ) : <EOL> self . df [ '<STR_LIT>' ] = self . rng <EOL> class timeseries_1min_5min_mean ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> def time_timeseries_1min_5min_mean ( self ) : <EOL> self . ts [ : <NUM_LIT> ] . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class timeseries_1min_5min_ohlc ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> def time_timeseries_1min_5min_ohlc ( self ) : <EOL> self . ts [ : <NUM_LIT> ] . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class timeseries_add_irregular ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . lindex = np . random . permutation ( self . N ) [ : ( self . N // <NUM_LIT:2> ) ] <EOL> self . rindex = np . random . permutation ( self . N ) [ : ( self . N // <NUM_LIT:2> ) ] <EOL> self . left = Series ( self . ts . values . take ( self . lindex ) , index = self . ts . index . take ( self . lindex ) ) <EOL> self . right = Series ( self . ts . values . take ( self . rindex ) , index = self . ts . index . take ( self . rindex ) ) <EOL> def time_timeseries_add_irregular ( self ) : <EOL> ( self . left + self . right ) <EOL> class timeseries_asof ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT>' ) <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . dates = date_range ( start = '<STR_LIT>' , periods = ( self . N * <NUM_LIT:10> ) , freq = '<STR_LIT>' ) <EOL> def time_timeseries_asof ( self ) : <EOL> self . ts . asof ( self . dates ) <EOL> class timeseries_asof_nan ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT>' ) <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . dates = date_range ( start = '<STR_LIT>' , periods = ( self . N * <NUM_LIT:10> ) , freq = '<STR_LIT>' ) <EOL> self . ts [ <NUM_LIT> : <NUM_LIT> ] = np . nan <EOL> def time_timeseries_asof_nan ( self ) : <EOL> self . ts . asof ( self . dates ) <EOL> class timeseries_asof_single ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT>' ) <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . dates = date_range ( start = '<STR_LIT>' , periods = ( self . N * <NUM_LIT:10> ) , freq = '<STR_LIT>' ) <EOL> def time_timeseries_asof_single ( self ) : <EOL> self . ts . asof ( self . dates [ <NUM_LIT:0> ] ) <EOL> class timeseries_custom_bday_apply ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_apply ( self ) : <EOL> self . cday . apply ( self . date ) <EOL> class timeseries_custom_bday_apply_dt64 ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_apply_dt64 ( self ) : <EOL> self . cday . apply ( self . dt64 ) <EOL> class timeseries_custom_bday_cal_decr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_cal_decr ( self ) : <EOL> ( self . date - ( <NUM_LIT:1> * self . cdayh ) ) <EOL> class timeseries_custom_bday_cal_incr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_cal_incr ( self ) : <EOL> ( self . date + ( <NUM_LIT:1> * self . cdayh ) ) <EOL> class timeseries_custom_bday_cal_incr_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_cal_incr_n ( self ) : <EOL> ( self . date + ( <NUM_LIT:10> * self . cdayh ) ) <EOL> class timeseries_custom_bday_cal_incr_neg_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_cal_incr_neg_n ( self ) : <EOL> ( self . date - ( <NUM_LIT:10> * self . cdayh ) ) <EOL> class timeseries_custom_bday_decr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_decr ( self ) : <EOL> ( self . date - self . cday ) <EOL> class timeseries_custom_bday_incr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bday_incr ( self ) : <EOL> ( self . date + self . cday ) <EOL> class timeseries_custom_bmonthbegin_decr_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bmonthbegin_decr_n ( self ) : <EOL> ( self . date - ( <NUM_LIT:10> * self . cmb ) ) <EOL> class timeseries_custom_bmonthbegin_incr_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bmonthbegin_incr_n ( self ) : <EOL> ( self . date + ( <NUM_LIT:10> * self . cmb ) ) <EOL> class timeseries_custom_bmonthend_decr_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bmonthend_decr_n ( self ) : <EOL> ( self . date - ( <NUM_LIT:10> * self . cme ) ) <EOL> class timeseries_custom_bmonthend_incr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bmonthend_incr ( self ) : <EOL> ( self . date + self . cme ) <EOL> class timeseries_custom_bmonthend_incr_n ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_custom_bmonthend_incr_n ( self ) : <EOL> ( self . date + ( <NUM_LIT:10> * self . cme ) ) <EOL> class timeseries_datetimeindex_offset_delta ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_datetimeindex_offset_delta ( self ) : <EOL> ( self . idx1 + self . delta_offset ) <EOL> class timeseries_datetimeindex_offset_fast ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_datetimeindex_offset_fast ( self ) : <EOL> ( self . idx1 + self . fast_offset ) <EOL> class timeseries_datetimeindex_offset_slow ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_datetimeindex_offset_slow ( self ) : <EOL> ( self . idx1 + self . slow_offset ) <EOL> class timeseries_day_apply ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_day_apply ( self ) : <EOL> self . day . apply ( self . date ) <EOL> class timeseries_day_incr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_day_incr ( self ) : <EOL> ( self . date + self . day ) <EOL> class timeseries_infer_freq ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:D>' , periods = <NUM_LIT> ) <EOL> self . a = self . rng [ : <NUM_LIT> ] . append ( self . rng [ <NUM_LIT> : ] ) <EOL> def time_timeseries_infer_freq ( self ) : <EOL> infer_freq ( self . a ) <EOL> class timeseries_is_month_start ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:B>' ) <EOL> def time_timeseries_is_month_start ( self ) : <EOL> self . rng . is_month_start <EOL> class timeseries_iter_datetimeindex ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . M = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . idx2 = period_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> def time_timeseries_iter_datetimeindex ( self ) : <EOL> self . iter_n ( self . idx1 ) <EOL> def iter_n ( self , iterable , n = None ) : <EOL> self . i = <NUM_LIT:0> <EOL> for _ in iterable : <EOL> self . i += <NUM_LIT:1> <EOL> if ( ( n is not None ) and ( self . i > n ) ) : <EOL> break <EOL> class timeseries_iter_datetimeindex_preexit ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . M = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . idx2 = period_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> def time_timeseries_iter_datetimeindex_preexit ( self ) : <EOL> self . iter_n ( self . idx1 , self . M ) <EOL> def iter_n ( self , iterable , n = None ) : <EOL> self . i = <NUM_LIT:0> <EOL> for _ in iterable : <EOL> self . i += <NUM_LIT:1> <EOL> if ( ( n is not None ) and ( self . i > n ) ) : <EOL> break <EOL> class timeseries_iter_periodindex ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . M = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . idx2 = period_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> def time_timeseries_iter_periodindex ( self ) : <EOL> self . iter_n ( self . idx2 ) <EOL> def iter_n ( self , iterable , n = None ) : <EOL> self . i = <NUM_LIT:0> <EOL> for _ in iterable : <EOL> self . i += <NUM_LIT:1> <EOL> if ( ( n is not None ) and ( self . i > n ) ) : <EOL> break <EOL> class timeseries_iter_periodindex_preexit ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . M = <NUM_LIT> <EOL> self . idx1 = date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> self . idx2 = period_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) <EOL> def time_timeseries_iter_periodindex_preexit ( self ) : <EOL> self . iter_n ( self . idx2 , self . M ) <EOL> def iter_n ( self , iterable , n = None ) : <EOL> self . i = <NUM_LIT:0> <EOL> for _ in iterable : <EOL> self . i += <NUM_LIT:1> <EOL> if ( ( n is not None ) and ( self . i > n ) ) : <EOL> break <EOL> class timeseries_large_lookup_value ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT:S>' ) <EOL> self . ts = Series ( <NUM_LIT:1> , index = self . rng ) <EOL> def time_timeseries_large_lookup_value ( self ) : <EOL> self . ts [ self . ts . index [ ( len ( self . ts ) // <NUM_LIT:2> ) ] ] <EOL> self . ts . index . _cleanup ( ) <EOL> class timeseries_period_downsample_mean ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = period_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT:T>' ) <EOL> self . ts = Series ( np . random . randn ( len ( self . rng ) ) , index = self . rng ) <EOL> def time_timeseries_period_downsample_mean ( self ) : <EOL> self . ts . resample ( '<STR_LIT:D>' , how = '<STR_LIT>' ) <EOL> class timeseries_resample_datetime64 ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT>' ) <EOL> self . int_ts = Series ( <NUM_LIT:5> , self . rng , dtype = '<STR_LIT>' ) <EOL> self . ts = self . int_ts . astype ( '<STR_LIT>' ) <EOL> def time_timeseries_resample_datetime64 ( self ) : <EOL> self . ts . resample ( '<STR_LIT>' , how = '<STR_LIT>' ) <EOL> class timeseries_series_offset_delta ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . s = Series ( date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_series_offset_delta ( self ) : <EOL> ( self . s + self . delta_offset ) <EOL> class timeseries_series_offset_fast ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . s = Series ( date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_series_offset_fast ( self ) : <EOL> ( self . s + self . fast_offset ) <EOL> class timeseries_series_offset_slow ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . s = Series ( date_range ( start = '<STR_LIT>' , freq = '<STR_LIT:T>' , periods = self . N ) ) <EOL> self . delta_offset = pd . offsets . Day ( ) <EOL> self . fast_offset = pd . offsets . DateOffset ( months = <NUM_LIT:2> , days = <NUM_LIT:2> ) <EOL> self . slow_offset = pd . offsets . BusinessDay ( ) <EOL> def time_timeseries_series_offset_slow ( self ) : <EOL> ( self . s + self . slow_offset ) <EOL> class timeseries_slice_minutely ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> def time_timeseries_slice_minutely ( self ) : <EOL> self . ts [ : <NUM_LIT> ] <EOL> class timeseries_sort_index ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:s>' ) <EOL> self . rng = self . rng . take ( np . random . permutation ( self . N ) ) <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> def time_timeseries_sort_index ( self ) : <EOL> self . ts . sort_index ( ) <EOL> class timeseries_timestamp_downsample_mean ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , freq = '<STR_LIT:T>' ) <EOL> self . ts = Series ( np . random . randn ( len ( self . rng ) ) , index = self . rng ) <EOL> def time_timeseries_timestamp_downsample_mean ( self ) : <EOL> self . ts . resample ( '<STR_LIT:D>' , how = '<STR_LIT>' ) <EOL> class timeseries_timestamp_tzinfo_cons ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , end = '<STR_LIT>' , tz = '<STR_LIT>' ) <EOL> def time_timeseries_timestamp_tzinfo_cons ( self ) : <EOL> self . rng [ <NUM_LIT:0> ] <EOL> class timeseries_to_datetime_YYYYMMDD ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT:D>' ) <EOL> self . strings = Series ( ( ( ( self . rng . year * <NUM_LIT> ) + ( self . rng . month * <NUM_LIT:100> ) ) + self . rng . day ) , dtype = np . int64 ) . apply ( str ) <EOL> def time_timeseries_to_datetime_YYYYMMDD ( self ) : <EOL> to_datetime ( self . strings , format = '<STR_LIT>' ) <EOL> class timeseries_to_datetime_iso8601 ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = <NUM_LIT> , freq = '<STR_LIT:H>' ) <EOL> self . strings = [ x . strftime ( '<STR_LIT>' ) for x in self . rng ] <EOL> self . strings_nosep = [ x . strftime ( '<STR_LIT>' ) for x in self . rng ] <EOL> self . strings_tz_space = [ x . strftime ( '<STR_LIT>' ) + '<STR_LIT>' <EOL> for x in self . rng ] <EOL> def time_timeseries_to_datetime_iso8601 ( self ) : <EOL> to_datetime ( self . strings ) <EOL> def time_timeseries_to_datetime_iso8601_nosep ( self ) : <EOL> to_datetime ( self . strings_nosep ) <EOL> def time_timeseries_to_datetime_iso8601_format ( self ) : <EOL> to_datetime ( self . strings , format = '<STR_LIT>' ) <EOL> def time_timeseries_to_datetime_iso8601_format_no_sep ( self ) : <EOL> to_datetime ( self . strings_nosep , format = '<STR_LIT>' ) <EOL> def time_timeseries_to_datetime_iso8601_tz_spaceformat ( self ) : <EOL> to_datetime ( self . strings_tz_space ) <EOL> class timeseries_with_format_no_exact ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . s = Series ( ( [ '<STR_LIT>' , '<STR_LIT>' ] * <NUM_LIT> ) ) <EOL> def time_timeseries_with_format_no_exact ( self ) : <EOL> to_datetime ( self . s , format = '<STR_LIT>' , exact = False ) <EOL> class timeseries_with_format_replace ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . s = Series ( ( [ '<STR_LIT>' , '<STR_LIT>' ] * <NUM_LIT> ) ) <EOL> def time_timeseries_with_format_replace ( self ) : <EOL> to_datetime ( self . s . str . replace ( '<STR_LIT>' , '<STR_LIT>' ) , format = '<STR_LIT>' ) <EOL> class timeseries_year_apply ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_year_apply ( self ) : <EOL> self . year . apply ( self . date ) <EOL> class timeseries_year_incr ( object ) : <EOL> goal_time = <NUM_LIT> <EOL> def setup ( self ) : <EOL> self . N = <NUM_LIT> <EOL> self . rng = date_range ( start = '<STR_LIT>' , periods = self . N , freq = '<STR_LIT:T>' ) <EOL> if hasattr ( Series , '<STR_LIT>' ) : <EOL> Series . resample = Series . convert <EOL> self . ts = Series ( np . random . randn ( self . N ) , index = self . rng ) <EOL> self . date = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . dt64 = np . datetime64 ( '<STR_LIT>' ) <EOL> self . hcal = pd . tseries . holiday . USFederalHolidayCalendar ( ) <EOL> self . day = pd . offsets . Day ( ) <EOL> self . year = pd . offsets . YearBegin ( ) <EOL> self . cday = pd . offsets . CustomBusinessDay ( ) <EOL> self . cmb = pd . offsets . CustomBusinessMonthBegin ( calendar = self . hcal ) <EOL> self . cme = pd . offsets . CustomBusinessMonthEnd ( calendar = self . hcal ) <EOL> self . cdayh = pd . offsets . CustomBusinessDay ( calendar = self . hcal ) <EOL> def time_timeseries_year_incr ( self ) : <EOL> ( self . date + self . year ) </s>
