# HG changeset patch # User Aurélien Campéas # Date 1724318343 -7200 # Thu Aug 22 11:19:03 2024 +0200 # Node ID 17f960c26c57c5d49c3d43f6dbd6252d085dad74 # Parent 928ee34c09fba6c06f7ee6213454cf420ab07416 api/update: fix the documentation diff --git a/test/test_tsio.py b/test/test_tsio.py --- a/test/test_tsio.py +++ b/test/test_tsio.py @@ -1103,6 +1103,14 @@ ) +def test_empty_update(engine, tsh): + ts = genserie(datetime(2010, 1, 1), 'D', 11) + d1 = tsh.update(engine, ts, 'empty-update', 'Babar') + assert len(d1) + d2 = tsh.update(engine, ts, 'empty-update', 'Babar') + assert not len(d2) + + def test_point_deletion(engine, tsh): ts_begin = genserie(datetime(2010, 1, 1), 'D', 11) ts_begin.iloc[-1] = np.nan diff --git a/tshistory/api.py b/tshistory/api.py --- a/tshistory/api.py +++ b/tshistory/api.py @@ -119,10 +119,12 @@ the new version. A series made of the changed points is returned. If there was - no change, None is returned and no new version is created. + no change, an empty series is returned and no new version is + created. - New points are added, changed points are changed, - points with NaN are _erased_. + New points are added, changed points are changed, points with + NaN are dropped if `keepnans` is False (by default) or + _erased_ if True. The `author` is mandatory. The `metadata` dictionary allows to associate any metadata @@ -131,10 +133,6 @@ It is possible to force an `insertion_date`, which can only be higher than the previous `insertion_date`. - The `keepnans` flag will treat, if true, the Nans values as - erasures. If false, we do a dropna() call on the series before - the actual update. - .. highlight:: python .. code-block:: python