Simplify band-aid code
This commit is contained in:
parent
6191288ff9
commit
4e2f06fe9c
@ -12,7 +12,7 @@ import psutil
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from dateutil.tz import tzlocal
|
||||
from numpy import NAN, inf, int64, mean
|
||||
from pandas import DataFrame, isnull
|
||||
from pandas import DataFrame, NaT
|
||||
|
||||
from freqtrade import __version__
|
||||
from freqtrade.configuration.timerange import TimeRange
|
||||
@ -973,16 +973,9 @@ class RPC:
|
||||
# replace NaT with empty string,
|
||||
# because if replaced with `None`
|
||||
# it will be casted into NaT again
|
||||
dataframe[date_column] = dataframe[date_column].apply(
|
||||
lambda x: '' if isnull(x) else x)
|
||||
dataframe[date_column] = dataframe[date_column].astype(object).replace({NaT: None})
|
||||
|
||||
"""
|
||||
try this if above pandas Issue#45836 is fixed:
|
||||
https://github.com/pandas-dev/pandas/issues/45836
|
||||
"""
|
||||
# dataframe = dataframe.replace({NaT: None})
|
||||
dataframe = dataframe.replace([inf, -inf], NAN)
|
||||
dataframe = dataframe.replace({NAN: None})
|
||||
dataframe = dataframe.replace({inf: None, -inf: None, NAN: None})
|
||||
|
||||
res = {
|
||||
'pair': pair,
|
||||
|
@ -1193,7 +1193,7 @@ def test_api_pair_candles(botclient, ohlcv_history):
|
||||
assert_response(rc)
|
||||
assert (rc.json()['data'] ==
|
||||
[['2017-11-26 08:50:00', 8.794e-05, 8.948e-05, 8.794e-05, 8.88e-05, 0.0877869,
|
||||
None, 0, None, '', 1511686200000, None, None],
|
||||
None, 0, None, None, 1511686200000, None, None],
|
||||
['2017-11-26 08:55:00', 8.88e-05, 8.942e-05, 8.88e-05,
|
||||
8.893e-05, 0.05874751, 8.886500000000001e-05, 1, 0.0, '2017-11-26 08:55:00',
|
||||
1511686500000, 8.893e-05, None],
|
||||
|
Loading…
Reference in New Issue
Block a user