1
0
mirror of https://github.com/balkian/tsih.git synced 2024-12-22 14:08:13 +00:00

remove pandas deprecation warnings

This commit is contained in:
J. Fernando Sánchez 2023-03-23 12:16:42 +01:00
parent 92c5c219bd
commit 4e0e95fbe7

View File

@ -10,7 +10,7 @@ import tempfile
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__version__ = '0.1.6' __version__ = '0.1.8'
from collections import UserDict, namedtuple from collections import UserDict, namedtuple
@ -400,9 +400,9 @@ class Records():
return sum(1 for i in self._filter if i is not None) == 3 return sum(1 for i in self._filter if i is not None) == 3
def __iter__(self): def __iter__(self):
for column, series in self._df.iteritems(): for column, series in self._df.items():
key, dict_id = column key, dict_id = column
for t_step, value in series.iteritems(): for t_step, value in series.items():
r = Record(t_step=t_step, r = Record(t_step=t_step,
dict_id=dict_id, dict_id=dict_id,
key=key, key=key,
@ -414,7 +414,7 @@ class Records():
f = self._filter f = self._filter
try: try:
i = self._df[f.key][str(f.dict_id)] i = self._df[f.key][str(f.dict_id)]
ix = i.index.get_loc(f.t_step, method='ffill') ix = i.index.get_indexer([f.t_step], method='ffill')[0]
return i.iloc[ix] return i.iloc[ix]
except KeyError as ex: except KeyError as ex:
return self.dtypes[f.key][2]() return self.dtypes[f.key][2]()