From ffe8fbbd7b1439939e5f1e87a45f5aad343713a2 Mon Sep 17 00:00:00 2001 From: Bert Palm <bert.palm@ufz.de> Date: Tue, 25 Feb 2020 07:39:59 +0100 Subject: [PATCH] fixed pandas bug --- dios/dios.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dios/dios.py b/dios/dios.py index 7a6638a..7b1b41c 100644 --- a/dios/dios.py +++ b/dios/dios.py @@ -190,7 +190,7 @@ class DictOfSeries: else: # work on columns new = self.copy_empty(columns=False) - new._data = self._data[key] + new._data = self._data.loc[key] return new def _slice(self, key): @@ -200,7 +200,9 @@ class DictOfSeries: new = self.copy_empty(columns=False) for k in self.columns: - new._data.at[k] = self._data.at[k][key] + # bug-fix: must be .loc, simple + # ser[key] may work positional! + new._data.at[k] = self._data.at[k].loc[key] return new def _getitem_bool_dios(self, key): @@ -235,7 +237,7 @@ class DictOfSeries: if isinstance(value, pd.Series): self._insert(key, value) else: - self._data.at[key].loc[:] = value + self._data.at[key][:] = value else: data = self.__getitem__(key) -- GitLab