Skip to content

Commit

Permalink
Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
DonBraulio committed Sep 20, 2023
1 parent 954541f commit 6f9632d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions temporian/core/event_set_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2503,8 +2503,8 @@ def where(
indexes: ...
events:
(3 events):
timestamps: [ 5. 9. 9.]
'f': ['hello', 'hello', 'goodbye']
timestamps: [5. 9. 9.]
'f': [b'hello' b'hello' b'goodbye']
...
```
Expand All @@ -2515,15 +2515,15 @@ def where(
>>> a = tp.event_set(timestamps=[5, 9, 10],
... features={'condition': [True, True, False],
... 'yes': [1, 2, 3],
... 'no': [-1, -2, -3])})
... 'no': [-1, -2, -3]})
>>> b = a['condition'].where(a['yes'], a['no'])
>>> b
indexes: ...
events:
(3 events):
timestamps: [ 5. 9. 10.]
'f': [1, 2, -3]
'condition': [ 1 2 -3]
...
```
Expand All @@ -2532,16 +2532,16 @@ def where(
```python
>>> a = tp.event_set(timestamps=[5, 6, 7, 8, 9],
... features={'f': [1, 2, -3, -4, 5],
... features={'f': [1, 2, -3, -4, 5]})
>>> # Set values < 0 to nan (cast to float to support nan)
>>> b = (a['f'] >= 0).where(a['f'].cast(float), np.nan)
>>> b
indexes: ...
events:
(5 events):
timestamps: [ 5. 6. 7. 8. 9.]
'f': [ 1., 2., nan, nan, 5.]
timestamps: [5. 6. 7. 8. 9.]
'f': [ 1. 2. nan nan 5.]
...
```
Expand Down
3 changes: 2 additions & 1 deletion temporian/core/operators/unique_timestamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


"""Unique timestamps operator class and public API function definitions."""

from temporian.core import operator_lib
from temporian.core.compilation import compile
from temporian.core.data.node import (
Expand All @@ -23,6 +22,7 @@
)
from temporian.core.operators.base import Operator
from temporian.core.typing import EventSetOrNode
from temporian.utils.typecheck import typecheck
from temporian.proto import core_pb2 as pb


Expand Down Expand Up @@ -56,6 +56,7 @@ def build_op_definition(cls) -> pb.OperatorDef:
operator_lib.register_operator(UniqueTimestamps)


@typecheck
@compile
def unique_timestamps(input: EventSetOrNode) -> EventSetOrNode:
assert isinstance(input, EventSetNode)
Expand Down
2 changes: 1 addition & 1 deletion temporian/core/operators/where.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


"""Where operator class and public API function definitions."""
from typing import Union, Any, Tuple
from typing import Union, Any

from temporian.core import operator_lib
from temporian.core.compilation import compile
Expand Down
3 changes: 1 addition & 2 deletions temporian/implementation/numpy/operators/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ py_library(
":timestamps",
":unary",
":unique_timestamps",
":where",
"//temporian/implementation/numpy/operators/binary:arithmetic",
"//temporian/implementation/numpy/operators/binary:logical",
"//temporian/implementation/numpy/operators/binary:relational",
Expand Down Expand Up @@ -396,5 +397,3 @@ py_library(
"//temporian/implementation/numpy/data:event_set",
],
)


1 change: 1 addition & 0 deletions temporian/implementation/numpy/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@
from temporian.implementation.numpy.operators import tick
from temporian.implementation.numpy.operators import timestamps
from temporian.implementation.numpy.operators import unique_timestamps
from temporian.implementation.numpy.operators import where

0 comments on commit 6f9632d

Please sign in to comment.