Skip to content
Snippets Groups Projects
Commit 16dbb699 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

fixed bool-dios indexing align bug

parent 6d8a0cdc
No related branches found
No related tags found
No related merge requests found
......@@ -243,10 +243,9 @@ class DictOfSeries:
def _setitem_dios(self, data, value):
keys = self.columns.intersection(data.columns)
for k in keys:
l = self._data.at[k]
r = value[k]
idx = l.index.intersection(r.index)
l[idx] = r[idx]
idx = data._data.at[k].index.intersection(r.index)
self._data.at[k][idx] = r[idx]
@property
def loc(self):
......
......@@ -55,7 +55,8 @@ class _LocIndexer(_Indexer):
data = self._data.loc[colkey].copy()
# .loc[any, scalar]
# .loc[any, scalar] -> (a single) series
# .loc[scalar, scalar] -> (a single) value
if _is_hashable(colkey):
new = data.loc[rowkey]
......@@ -63,8 +64,12 @@ class _LocIndexer(_Indexer):
else:
for k in data.index:
data.at[k] = data.at[k].loc[rowkey]
# .loc[scalar, non-scalar] -> column-indexed series
if _is_hashable(rowkey):
new = data
# .loc[non-scalar, non-scalar] -> dios
else:
new = self._dios.copy_empty(columns=False)
new._data = data
......@@ -106,16 +111,21 @@ class _iLocIndexer(_Indexer):
data = self._data.iloc[colkey].copy()
# .iloc[any, scalar]
# .iloc[any, int] -> single series
# .iloc[int, int] -> single value
if _is_integer(colkey):
new = data.iloc[rowkey]
# .iloc[any, non-scalar]
# .iloc[any, non-int]
else:
for k in data.index:
data.at[k] = data.at[k].iloc[rowkey]
# .iloc[int, non-int] -> column-indexed series
if _is_integer(rowkey):
new = data
# .iloc[non-int, non-int] -> dios
else:
new = self._dios.copy_empty(columns=False)
new._data = data
......@@ -127,11 +137,11 @@ class _iLocIndexer(_Indexer):
if _is_dios_like(rowkey) or _is_dios_like(colkey):
raise ValueError("Cannot index with multidimensional key")
# .iloc[any, scalar]
# .iloc[any, int]
if _is_integer(colkey):
self._data.iat[colkey].iloc[rowkey] = value
# .iloc[any, non-scalar]
# .iloc[any, non-int]
else:
for s in self._data.iloc[colkey]:
s.iloc[rowkey] = value
......@@ -211,7 +221,7 @@ class _aLocIndexer(_Indexer):
for i, c in enumerate(colkeys):
l = self._data.at[c]
r = value[c]
idx = l.index.intersection(r.index)
idx = l.loc[rowkeys[i]].index.intersection(r.index)
l[idx] = r[idx]
# row align - align given series to every series in ourself
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment