M test/test_tsio.py +8 -0
@@ 1103,6 1103,14 @@ def test_infer_freq(engine, tsh):
)
+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
M tshistory/api.py +5 -7
@@ 119,10 119,12 @@ class mainsource:
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 @@ class mainsource:
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