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

damn pandas revert bugfixes

parent 1f7332de
No related branches found
No related tags found
No related merge requests found
...@@ -63,8 +63,6 @@ class DictOfSeries: ...@@ -63,8 +63,6 @@ class DictOfSeries:
- ``dios.loc[..]`` loc[cation] based indexing, work on row and/or columns `labels`, align, return dios - ``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 - ``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'): def __init__(self, data=None, columns=None, itype=MixedItype, downcast_policy='save'):
...@@ -192,9 +190,7 @@ class DictOfSeries: ...@@ -192,9 +190,7 @@ class DictOfSeries:
new = self.copy_empty(columns=False) new = self.copy_empty(columns=False)
for k in self.columns: for k in self.columns:
# bug-fix: must be .loc, simple new._data.at[k] = self._data.at[k][key]
# ser[key] may work positional!
new._data.at[k] = self._data.at[k].loc[key]
return new return new
def _getitem_bool_dios(self, key): def _getitem_bool_dios(self, key):
...@@ -209,7 +205,7 @@ class DictOfSeries: ...@@ -209,7 +205,7 @@ class DictOfSeries:
raise ValueError("Must pass DictOfSeries with boolean values only") raise ValueError("Must pass DictOfSeries with boolean values only")
# align rows # align rows
idx = boolser[boolser].index.intersection(ser.index) idx = boolser[boolser].index.intersection(ser.index)
new._data.at[k] = ser.loc[idx] new._data.at[k] = ser[idx]
return new return new
def _getitem_bool_listlike(self, key): def _getitem_bool_listlike(self, key):
...@@ -239,7 +235,7 @@ class DictOfSeries: ...@@ -239,7 +235,7 @@ class DictOfSeries:
for k in data.columns: for k in data.columns:
s = data._data.at[k] s = data._data.at[k]
s[:] = value s[:] = value
self._data.at[k].loc[s.index] = s self._data.at[k][s.index] = s
def _setitem_dios(self, data, value): def _setitem_dios(self, data, value):
keys = self.columns.intersection(data.columns) keys = self.columns.intersection(data.columns)
......
from dios import * from dios import *
from test.test_setup import * from test.test_setup import *
from pandas.core.dtypes.common import is_scalar
# s1 = pd.Series(range(10), index=range(10)) # s1 = pd.Series(range(10), index=range(10))
# s2 = pd.Series(range(5, 10), index=range(5, 10)) # s2 = pd.Series(range(5, 10), index=range(5, 10))
......
...@@ -3,6 +3,7 @@ import pytest ...@@ -3,6 +3,7 @@ import pytest
from dios import * from dios import *
import pandas as pd import pandas as pd
from pandas.core.dtypes.common import is_dict_like, is_nested_list_like
import numpy as np import numpy as np
from copy import deepcopy from copy import deepcopy
......
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