Commit 9517dab7 authored by Arnaud Campeas's avatar Arnaud Campeas
Browse files

tsio: the nan (deletion orders) are now stored in the snapshot

They are removed just before being served to the user instead during `_apply_diff`.

This change has no effect on the roundtrip, but the snapshot cary more
information, namely

* if a data is missing because it was erased (thanks to the presence
  of a Nan)

* or because it was never here (with no data at this date).
parent 01cf73a83ff2
......@@ -609,7 +609,7 @@ Freq: D
2010-01-03 2.0
2010-01-09 NaN
2010-01-12 11.0
2010-01-13 12.0""", diff)
2010-01-13 12.0""", diff.sort_index())
# value on nan => value
# nan on value => nan
# nan on nan => Nothing
......
......@@ -172,6 +172,7 @@ class TimeSerie(object):
if current is not None:
current.name = name
current = current[~current.isnull()]
return current
def get_group(self, cn, name, revision_date=None):
......@@ -439,9 +440,12 @@ class TimeSerie(object):
(like in tots - fromts).
"""
if fromts is None or not len(fromts):
if fromts is None:
return tots
fromts = fromts[~fromts.isnull()]
if not len(fromts):
return tots
mask_overlap = tots.index.isin(fromts.index)
fromts_overlap = fromts[tots.index[mask_overlap]]
tots_overlap = tots[mask_overlap]
......@@ -472,7 +476,6 @@ class TimeSerie(object):
result_ts = pd.Series([0.0], index=base_ts.index.union(new_ts.index))
result_ts[base_ts.index] = base_ts
result_ts[new_ts.index] = new_ts
result_ts = result_ts[~result_ts.isnull()]
result_ts.sort_index(inplace=True)
result_ts.name = base_ts.name
return result_ts
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment