diff --git a/dios/dios.py b/dios/dios.py index 0597d08680a2cb538a35a0fce5ca9588655dbded..30311070d9ed969e2f8d877b021d8688074808be 100644 --- a/dios/dios.py +++ b/dios/dios.py @@ -63,8 +63,6 @@ class DictOfSeries: - ``dios.loc[..]`` loc[cation] based indexing, work on row and/or columns `labels`, align, return dios - ``dios.iloc[..]`` i[nteger]loc[cation] based indexing, work on row and/or columns, align, return dios - Todos: - ----- """ def __init__(self, data=None, columns=None, itype=MixedItype, downcast_policy='save'): @@ -192,9 +190,7 @@ class DictOfSeries: new = self.copy_empty(columns=False) for k in self.columns: - # bug-fix: must be .loc, simple - # ser[key] may work positional! - new._data.at[k] = self._data.at[k].loc[key] + new._data.at[k] = self._data.at[k][key] return new def _getitem_bool_dios(self, key): @@ -209,7 +205,7 @@ class DictOfSeries: raise ValueError("Must pass DictOfSeries with boolean values only") # align rows idx = boolser[boolser].index.intersection(ser.index) - new._data.at[k] = ser.loc[idx] + new._data.at[k] = ser[idx] return new def _getitem_bool_listlike(self, key): @@ -239,7 +235,7 @@ class DictOfSeries: for k in data.columns: s = data._data.at[k] s[:] = value - self._data.at[k].loc[s.index] = s + self._data.at[k][s.index] = s def _setitem_dios(self, data, value): keys = self.columns.intersection(data.columns) diff --git a/test/test__getitem__.py b/test/test__getitem__.py index 9b0ee84b6798ddb52ab098dc372da560c559a827..78ab3333893ee78759ed9ec4be41a5ef5c342e8f 100644 --- a/test/test__getitem__.py +++ b/test/test__getitem__.py @@ -1,5 +1,6 @@ from dios import * from test.test_setup import * +from pandas.core.dtypes.common import is_scalar # s1 = pd.Series(range(10), index=range(10)) # s2 = pd.Series(range(5, 10), index=range(5, 10)) diff --git a/test/test_df_like.py b/test/test_df_like.py index 17ee9a671d7e16267d9d44b6e170ecaa8dfd57b1..77d661c3cda4d7f93230db2675ce5afa5fd44b60 100644 --- a/test/test_df_like.py +++ b/test/test_df_like.py @@ -3,6 +3,7 @@ import pytest from dios import * import pandas as pd +from pandas.core.dtypes.common import is_dict_like, is_nested_list_like import numpy as np from copy import deepcopy