Commit f5ad045e authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

tsio: do not crash when getting an empty series

Since it is possible to erase values, it is possible to have
a serie entirely void of values.

Closes #12.
parent 7f160392486e
......@@ -523,6 +523,12 @@ def test_deletion(engine):
2010-01-10 machin
""", tso.get(engine, 'ts_string_del'))
ts_string[ts_string.index] = np.nan
tso.insert(engine, ts_string, 'ts_string_del', 'test')
erased = tso.get(engine, 'ts_string_del')
assert len(erased) == 0
# first insertion with only nan
ts_begin = genserie(datetime(2010, 1, 1), 'D', 10, [np.nan])
......
......@@ -33,6 +33,9 @@ def tojson(ts):
def fromjson(jsonb, tsname):
if jsonb == '{}':
return pd.Series(name=tsname)
result = pd.read_json(jsonb, typ='series', dtype=False)
if isinstance(result.index, pd.DatetimeIndex):
return result
......
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