Skip to content

Commit

Permalink
Merge pull request #134 from zackdrescher/patch-1
Browse files Browse the repository at this point in the history
Added default calculations to TimeSeries.operation()
  • Loading branch information
stringertheory committed Feb 5, 2024
2 parents 2e14e14 + f53099b commit a568b17
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions traces/timeseries.py
Expand Up @@ -858,12 +858,14 @@ def operation(self, other, function, **kwargs):
"""
result = TimeSeries(**kwargs)
if isinstance(other, TimeSeries):
result.default = function(self.default, other.default)
for time, value in self:
result[time] = function(value, other[time])
for time, value in other:
result[time] = function(self[time], value)
else:
for time, value in self:
result.default = function(self.default, other)
result[time] = function(value, other)
return result

Expand Down

0 comments on commit a568b17

Please sign in to comment.