Skip to content

Commit f038c18

Browse files
author
pilkibun
committed
CLN: In DecimalArray make aliases as properties, _data may be assigned to
1 parent 0a8ef62 commit f038c18

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

pandas/tests/extension/decimal/array.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,28 @@ def __init__(self, values, dtype=None, copy=False, context=None):
5959
values = np.asarray(values, dtype=object)
6060

6161
self._data = values
62-
# Some aliases for common attribute names to ensure pandas supports
63-
# these
64-
self._items = self.data = self._data
65-
# those aliases are currently not working due to assumptions
66-
# in internal code (GH-20735)
67-
# self._values = self.values = self.data
6862
self._dtype = DecimalDtype(context)
6963

64+
# aliases for common attribute names, to ensure pandas supports these
65+
@property
66+
def _items(self):
67+
return self._data
68+
69+
@property
70+
def data(self):
71+
return self._data
72+
73+
# those aliases are currently not working due to assumptions
74+
# in internal code (GH-20735)
75+
# @property
76+
# def _values(self):
77+
# return self._data
78+
79+
# @property
80+
# def values(self):
81+
# return self._data
82+
# end aliases
83+
7084
@property
7185
def dtype(self):
7286
return self._dtype

0 commit comments

Comments
 (0)