def repeat(self, n, keys=None): """See `vectorbt.base.reshape_fns.repeat`. Use `keys` as the outermost level.""" repeated = reshape_fns.repeat(self._obj, n, axis=1) if keys is not None: new_columns = index_fns.combine_indexes(self.columns, keys) return self.wrap(repeated.values, columns=new_columns) return repeated
def repeat(self, n, keys=None, axis=1): """See `vectorbt.base.reshape_fns.repeat`. Set `axis` to 1 for columns and 0 for index. Use `keys` as the outermost level.""" repeated = reshape_fns.repeat(self._obj, n, axis=axis) if keys is not None: if axis == 1: new_columns = index_fns.combine_indexes(self.wrapper.columns, keys) return repeated.vbt.wrapper.wrap(repeated.values, columns=new_columns) else: new_index = index_fns.combine_indexes(self.wrapper.index, keys) return repeated.vbt.wrapper.wrap(repeated.values, index=new_index) return repeated
def repeat(self, n: int, keys: tp.Optional[tp.IndexLike] = None, axis: int = 1, wrap_kwargs: tp.KwargsLike = None) -> tp.SeriesFrame: """See `vectorbt.base.reshape_fns.repeat`. Set `axis` to 1 for columns and 0 for index. Use `keys` as the outermost level.""" repeated = reshape_fns.repeat(self.obj, n, axis=axis) if keys is not None: if axis == 1: new_columns = index_fns.combine_indexes([self.wrapper.columns, keys]) return ArrayWrapper.from_obj(repeated).wrap( repeated.values, **merge_dicts(dict(columns=new_columns), wrap_kwargs)) else: new_index = index_fns.combine_indexes([self.wrapper.index, keys]) return ArrayWrapper.from_obj(repeated).wrap( repeated.values, **merge_dicts(dict(index=new_index), wrap_kwargs)) return repeated