Skip to content

CLN: remove __unicode__ from pandas.core.dtypes #26415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,11 @@ class PandasExtensionDtype(ExtensionDtype):
isnative = 0
_cache = {} # type: Dict[str_type, 'PandasExtensionDtype']

def __unicode__(self):
return self.name

def __str__(self):
"""
Return a string representation for a particular Object
"""
return self.__unicode__()
return self.name

def __bytes__(self):
"""
Expand All @@ -142,7 +139,7 @@ def __bytes__(self):
from pandas._config import get_option

encoding = get_option("display.encoding")
return self.__unicode__().encode(encoding, 'replace')
return str(self).encode(encoding, 'replace')

def __repr__(self):
"""
Expand Down Expand Up @@ -707,7 +704,7 @@ def construct_from_string(cls, string):

raise TypeError("Could not construct DatetimeTZDtype")

def __unicode__(self):
def __str__(self):
return "datetime64[{unit}, {tz}]".format(unit=self.unit, tz=self.tz)

@property
Expand Down Expand Up @@ -837,12 +834,12 @@ def construct_from_string(cls, string):
pass
raise TypeError("could not construct PeriodDtype")

def __unicode__(self):
return str(self.name)
def __str__(self):
return self.name

@property
def name(self):
return str("period[{freq}]".format(freq=self.freq.freqstr))
return "period[{freq}]".format(freq=self.freq.freqstr)

@property
def na_value(self):
Expand Down Expand Up @@ -1007,7 +1004,7 @@ def construct_from_string(cls, string):
def type(self):
return Interval

def __unicode__(self):
def __str__(self):
if self.subtype is None:
return "interval"
return "interval[{subtype}]".format(subtype=self.subtype)
Expand Down