Commit 447313ea authored by Arnaud Campeas's avatar Arnaud Campeas
Browse files

tsio: precise the behavior with a full erase by NaNs

With this implementation, there is no more type validation when the series
has been totaly erased. It means that a new type can be inserted after this operation
parent 64036da617d4
......@@ -615,6 +615,27 @@ Freq: D
# nan on nan => Nothing
# nan on nothing=> Nothing
## full erasing
# numeric
ts_begin = genserie(datetime(2010, 1, 1), 'D', 4)
tso.insert(engine, ts_begin, 'ts_full_del', 'test')
ts_begin.iloc[:]= np.nan
tso.insert(engine, ts_begin, 'ts_full_del', 'test')
ts_end = genserie(datetime(2010, 1, 1), 'D', 4)
tso.insert(engine, ts_end, 'ts_full_del', 'test')
# string
ts_begin = genserie(datetime(2010, 1, 1), 'D', 4, ['text'])
tso.insert(engine, ts_begin, 'ts_full_del_str', 'test')
ts_begin.iloc[:] = np.nan
tso.insert(engine, ts_begin, 'ts_full_del_str', 'test')
ts_end = genserie(datetime(2010, 1, 1), 'D', 4, ['text'])
tso.insert(engine, ts_end, 'ts_full_del_str', 'test')
def test_multi_index(engine):
tso = TimeSerie()
......
......@@ -341,7 +341,9 @@ class TimeSerie(object):
)
def _validate_type(self, oldts, newts, name):
if (oldts is None or newts.isnull().all()):
if (oldts is None or
oldts.isnull().all() or
newts.isnull().all()):
return
old_type = oldts.dtype
new_type = newts.dtype
......
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