Skip to content

Commit

Permalink
CLN: remove __unicode__ from pandas.core.dtypes (pandas-dev#26415)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored and jreback committed May 15, 2019
1 parent c891431 commit 241af3d
Showing 1 changed file with 7 additions and 10 deletions.
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

0 comments on commit 241af3d

Please sign in to comment.