Skip to content

Commit

Permalink
Add policy to replace missing values with 0. (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
aadyotb committed Jul 14, 2022
1 parent 7047d12 commit e22b6d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions merlion/utils/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class AggregationPolicy(Enum):

class MissingValuePolicy(Enum):
"""
Missing value imputation policies. Values are partial functions for
``pd.Series`` methods.
Missing value imputation policies. Values are partial functions for ``pd.Series`` methods.
"""

FFill = partial(lambda df, *args, **kwargs: getattr(df, "ffill")(*args, **kwargs))
Expand All @@ -57,6 +56,8 @@ class MissingValuePolicy(Enum):
"""Replace missing value with the value closest to it."""
Interpolate = partial(lambda df, *args, **kwargs: getattr(df, "interpolate")(*args, **kwargs), method="time")
"""Fill in missing values by linear interpolation."""
ZFill = partial(lambda df, *args, **kwargs: getattr(df, "replace")(*args, **kwargs), to_replace=np.nan, value=0)
"""Replace missing values with zeros."""


def to_pd_datetime(timestamp):
Expand Down

0 comments on commit e22b6d6

Please sign in to comment.