コード例 #1
0
    def __init__(self, obj, **kwargs):
        if not checks.is_pandas(obj):  # parent accessor
            obj = obj._obj

        checks.assert_dtype(obj, np.bool)

        GenericAccessor.__init__(self, obj, **kwargs)
コード例 #2
0
    def __init__(self, obj: tp.SeriesFrame, **kwargs) -> None:
        if not checks.is_pandas(obj):  # parent accessor
            obj = obj._obj

        checks.assert_dtype(obj, np.bool_)

        GenericAccessor.__init__(self, obj, **kwargs)
コード例 #3
0
    def __init__(self, obj, year_freq=None, **kwargs):
        if not checks.is_pandas(obj):  # parent accessor
            obj = obj._obj

        GenericAccessor.__init__(self, obj, **kwargs)

        # Set year frequency
        self._year_freq = year_freq
コード例 #4
0
ファイル: accessors.py プロジェクト: floatinghotpot/vectorbt
    def __init__(self,
                 obj: tp.SeriesFrame,
                 year_freq: tp.Optional[tp.FrequencyLike] = None,
                 **kwargs) -> None:
        if not checks.is_pandas(obj):  # parent accessor
            obj = obj._obj

        GenericAccessor.__init__(self, obj, **kwargs)

        # Set year frequency
        self._year_freq = year_freq
コード例 #5
0
ファイル: accessors.py プロジェクト: ag-ds-bubble/vectorbt
    def empty(cls, *args, fill_value=False, **kwargs):
        """`vectorbt.base.accessors.BaseAccessor.empty` with `fill_value=False`.

        ## Example

        ```python-repl
        >>> pd.Series.vbt.signals.empty(5, index=sig.index, name=sig['a'].name)
        2020-01-01    False
        2020-01-02    False
        2020-01-03    False
        2020-01-04    False
        2020-01-05    False
        Name: a, dtype: bool

        >>> pd.DataFrame.vbt.signals.empty((5, 3), index=sig.index, columns=sig.columns)
                        a      b      c
        2020-01-01  False  False  False
        2020-01-02  False  False  False
        2020-01-03  False  False  False
        2020-01-04  False  False  False
        2020-01-05  False  False  False
        ```
        """
        return GenericAccessor.empty(*args,
                                     fill_value=fill_value,
                                     dtype=bool,
                                     **kwargs)
コード例 #6
0
ファイル: accessors.py プロジェクト: ag-ds-bubble/vectorbt
    def empty_like(cls, *args, fill_value=False, **kwargs):
        """`vectorbt.base.accessors.BaseAccessor.empty_like` with `fill_value=False`.

        ## Example

        ```python-repl
        >>> pd.Series.vbt.signals.empty_like(sig['a'])
        2020-01-01    False
        2020-01-02    False
        2020-01-03    False
        2020-01-04    False
        2020-01-05    False
        Name: a, dtype: bool

        >>> pd.DataFrame.vbt.signals.empty_like(sig)
                        a      b      c
        2020-01-01  False  False  False
        2020-01-02  False  False  False
        2020-01-03  False  False  False
        2020-01-04  False  False  False
        2020-01-05  False  False  False
        ```
        """
        return GenericAccessor.empty_like(*args,
                                          fill_value=fill_value,
                                          dtype=bool,
                                          **kwargs)