Beispiel #1
0
def broadcast_ts(ts, params_len, new_columns):
    """Broadcast time series `ts` to match the length of `new_columns` through tiling."""
    if checks.is_series(ts) or len(new_columns) > ts.shape[1]:
        return ts.vbt.wrap(reshape_fns.tile(ts.values, params_len, axis=1),
                           columns=new_columns)
    else:
        return ts.vbt.wrap(ts, columns=new_columns)
Beispiel #2
0
 def tile(self, n, as_columns=None):
     tiled = reshape_fns.tile(self._obj, n, along_axis=1)
     if as_columns is not None:
         new_columns = index_fns.combine(
             as_columns,
             reshape_fns.to_2d(self._obj).columns)
         return self.wrap_array(tiled.values, columns=new_columns)
     return tiled
Beispiel #3
0
    def tile(self, n, as_columns=None):
        """See `vectorbt.utils.reshape_fns.tile`.

        Use `as_columns` as a top-level column level."""
        tiled = reshape_fns.tile(self._obj, n, axis=1)
        if as_columns is not None:
            new_columns = index_fns.combine_indexes(as_columns, self.columns)
            return self.wrap_array(tiled.values, columns=new_columns)
        return tiled