Skip to content

Commit e5f6976

Browse files
committed
wip
1 parent ebadf6f commit e5f6976

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pandas/core/arrays/base.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import operator
1111

12-
from pandas.core.base import StringMixin
1312
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
1413
from pandas.errors import AbstractMethodError
1514
from pandas.compat.numpy import function as nv
@@ -20,7 +19,7 @@
2019
_not_implemented_message = "{} does not implement {}."
2120

2221

23-
class ExtensionArray(StringMixin):
22+
class ExtensionArray(object):
2423
"""Abstract base class for custom 1-D array types.
2524
2625
pandas will recognize instances of this class as proper arrays
@@ -50,7 +49,7 @@ class ExtensionArray(StringMixin):
5049
by overriding:
5150
5251
* _formatter
53-
* __unicode__
52+
* __repr__
5453
5554
Some methods require casting the ExtensionArray to an ndarray of Python
5655
objects with ``self.astype(object)``, which may be expensive. When
@@ -658,7 +657,7 @@ def copy(self, deep=False):
658657
# ------------------------------------------------------------------------
659658
# Printing
660659
# ------------------------------------------------------------------------
661-
def __unicode__(self):
660+
def __repr__(self):
662661
from pandas.io.formats.printing import format_object_summary
663662

664663
template = (
@@ -686,18 +685,22 @@ def _formatter(self, formatter=None):
686685
Parameters
687686
----------
688687
formatter: GenericArrayFormatter, optional
689-
The formatter this array is being rendered with. The formatter
690-
may have a `.formatter` method already defined. By default, this
691-
will be used if a `formatter` is passed, otherwise the formatter
692-
is ``str``.
688+
The formatter this array is being rendered with. This will be
689+
passed when the ExtensionArray is being rendered inside of a
690+
Series, Index, or DataFrame. This will be ``None`` when called
691+
from a top-level ``repr(array)``.
692+
693+
By default, when ``formatter`` is passed, the return value
694+
is ``formatter.formatter``. Otherwise, the default formatter
695+
is ``repr``.
693696
694697
Returns
695698
-------
696699
Callable[[Any], str]
697700
A callable that gets instances of the scalar type and
698701
returns a string.
699702
"""
700-
return getattr(formatter, 'formatter', None) or str
703+
return getattr(formatter, 'formatter', None) or repr
701704

702705
def _formatting_values(self):
703706
# type: () -> np.ndarray

0 commit comments

Comments
 (0)