You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slicing of single row in XDataFrame does not work, probably because it tries to return a series which does not work as types are heterogeneous, so instead one may want to return a XDataFrame with a single row.
import pandas as pd
from xpandas.data_container import XDataFrame
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
iris.iloc[0] # works
irisx = XDataFrame(iris)
irisx.iloc[0] # breaks
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-32-b46ce52f9af0> in <module>
----> 1 irisx.iloc[0]
~/.conda/envs/sktime/lib/python3.7/site-packages/pandas/core/indexing.py in __getitem__(self, key)
1476
1477 maybe_callable = com._apply_if_callable(key, self.obj)
-> 1478 return self._getitem_axis(maybe_callable, axis=axis)
1479
1480 def _is_scalar_access(self, key):
~/.conda/envs/sktime/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
2102 self._validate_integer(key, axis)
2103
-> 2104 return self._get_loc(key, axis=axis)
2105
2106 def _convert_to_indexer(self, obj, axis=None, is_setter=False):
~/.conda/envs/sktime/lib/python3.7/site-packages/pandas/core/indexing.py in _get_loc(self, key, axis)
143 if axis is None:
144 axis = self.axis
--> 145 return self.obj._ixs(key, axis=axis)
146
147 def _slice(self, obj, axis=None, kind=None):
~/.conda/envs/sktime/lib/python3.7/site-packages/pandas/core/frame.py in _ixs(self, i, axis)
2624 index=self.columns,
2625 name=self.index[i],
-> 2626 dtype=new_values.dtype)
2627 result._set_is_copy(self, copy=copy)
2628 return result
~/.conda/envs/sktime/lib/python3.7/site-packages/xpandas/data_container/data_container.py in __init__(self, *args, **kwargs)
71 check_result, data_type = _check_all_elements_have_the_same_property(data, type)
72 if not check_result:
---> 73 raise ValueError('Not all elements the same type')
74
75 if data_type is not None:
ValueError: Not all elements the same type
The text was updated successfully, but these errors were encountered:
Slicing of single row in XDataFrame does not work, probably because it tries to return a series which does not work as types are heterogeneous, so instead one may want to return a XDataFrame with a single row.
The text was updated successfully, but these errors were encountered: