Commit 0711eb8d authored by Arnaud Campeas's avatar Arnaud Campeas
Browse files

tsio: coerce to float for all kinds of int

parent 0192259477c1
......@@ -91,32 +91,32 @@ def test_differential(engine):
tso.insert(engine, ts_begin, 'ts_test', 'test')
assert """
2010-01-01 0
2010-01-02 1
2010-01-03 2
2010-01-04 3
2010-01-05 4
2010-01-06 5
2010-01-07 6
2010-01-08 7
2010-01-09 8
2010-01-10 9
2010-01-01 0.0
2010-01-02 1.0
2010-01-03 2.0
2010-01-04 3.0
2010-01-05 4.0
2010-01-06 5.0
2010-01-07 6.0
2010-01-08 7.0
2010-01-09 8.0
2010-01-10 9.0
""".strip() == tso.get(engine, 'ts_test').to_string().strip()
# we should detect the emission of a message
tso.insert(engine, ts_begin, 'ts_test', 'babar')
assert """
2010-01-01 0
2010-01-02 1
2010-01-03 2
2010-01-04 3
2010-01-05 4
2010-01-06 5
2010-01-07 6
2010-01-08 7
2010-01-09 8
2010-01-10 9
2010-01-01 0.0
2010-01-02 1.0
2010-01-03 2.0
2010-01-04 3.0
2010-01-05 4.0
2010-01-06 5.0
2010-01-07 6.0
2010-01-08 7.0
2010-01-09 8.0
2010-01-10 9.0
""".strip() == tso.get(engine, 'ts_test').to_string().strip()
ts_slight_variation = ts_begin.copy()
......@@ -125,16 +125,16 @@ def test_differential(engine):
tso.insert(engine, ts_slight_variation, 'ts_test', 'celeste')
assert """
2010-01-01 0
2010-01-02 1
2010-01-03 2
2010-01-04 0
2010-01-05 4
2010-01-06 5
2010-01-07 0
2010-01-08 7
2010-01-09 8
2010-01-10 9
2010-01-01 0.0
2010-01-02 1.0
2010-01-03 2.0
2010-01-04 0.0
2010-01-05 4.0
2010-01-06 5.0
2010-01-07 0.0
2010-01-08 7.0
2010-01-09 8.0
2010-01-10 9.0
""".strip() == tso.get(engine, 'ts_test').to_string().strip()
ts_longer = pd.Series(range(15))
......
......@@ -72,7 +72,7 @@ class TimeSerie(object):
assert isinstance(newts, pd.Series)
assert not newts.index.duplicated().any()
if newts.dtype == 'int64':
if str(newts.dtype).startswith('int'):
newts = newts.astype('float64')
newts = newts[~newts.isnull()] # wipe the the NaNs
if not len(newts):
......
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