@@ -93,13 +93,13 @@ def f(self, other):
93
93
if not self .ordered :
94
94
if op in ["__lt__" , "__gt__" , "__le__" , "__ge__" ]:
95
95
raise TypeError (
96
- "Unordered Categoricals can only compare " " equality or not"
96
+ "Unordered Categoricals can only compare equality or not"
97
97
)
98
98
if isinstance (other , Categorical ):
99
99
# Two Categoricals can only be be compared if the categories are
100
100
# the same (maybe up to ordering, depending on ordered)
101
101
102
- msg = "Categoricals can only be compared if " " 'categories' are the same."
102
+ msg = "Categoricals can only be compared if 'categories' are the same."
103
103
if len (self .categories ) != len (other .categories ):
104
104
raise TypeError (msg + " Categories are different lengths" )
105
105
elif self .ordered and not (self .categories == other .categories ).all ():
@@ -109,7 +109,7 @@ def f(self, other):
109
109
110
110
if not (self .ordered == other .ordered ):
111
111
raise TypeError (
112
- "Categoricals can only be compared if " " 'ordered' is the same"
112
+ "Categoricals can only be compared if 'ordered' is the same"
113
113
)
114
114
if not self .ordered and not self .categories .equals (other .categories ):
115
115
# both unordered and different order
@@ -387,7 +387,7 @@ def __init__(
387
387
388
388
# FIXME
389
389
raise NotImplementedError (
390
- "> 1 ndim Categorical are not " " supported at this time"
390
+ "> 1 ndim Categorical are not supported at this time"
391
391
)
392
392
393
393
# we're inferring from values
@@ -694,7 +694,7 @@ def from_codes(cls, codes, categories=None, ordered=None, dtype=None):
694
694
raise ValueError (msg )
695
695
696
696
if len (codes ) and (codes .max () >= len (dtype .categories ) or codes .min () < - 1 ):
697
- raise ValueError ("codes need to be between -1 and " " len(categories)-1" )
697
+ raise ValueError ("codes need to be between -1 and len(categories)-1" )
698
698
699
699
return cls (codes , dtype = dtype , fastpath = True )
700
700
@@ -1019,7 +1019,7 @@ def reorder_categories(self, new_categories, ordered=None, inplace=False):
1019
1019
inplace = validate_bool_kwarg (inplace , "inplace" )
1020
1020
if set (self .dtype .categories ) != set (new_categories ):
1021
1021
raise ValueError (
1022
- "items in new_categories are not the same as in " " old categories"
1022
+ "items in new_categories are not the same as in old categories"
1023
1023
)
1024
1024
return self .set_categories (new_categories , ordered = ordered , inplace = inplace )
1025
1025
@@ -1481,7 +1481,7 @@ def put(self, *args, **kwargs):
1481
1481
"""
1482
1482
Replace specific elements in the Categorical with given values.
1483
1483
"""
1484
- raise NotImplementedError (("'put' is not yet implemented " " for Categorical" ))
1484
+ raise NotImplementedError (("'put' is not yet implemented for Categorical" ))
1485
1485
1486
1486
def dropna (self ):
1487
1487
"""
@@ -1827,7 +1827,7 @@ def fillna(self, value=None, method=None, limit=None):
1827
1827
value = np .nan
1828
1828
if limit is not None :
1829
1829
raise NotImplementedError (
1830
- "specifying a limit for fillna has not " " been implemented yet"
1830
+ "specifying a limit for fillna has not been implemented yet"
1831
1831
)
1832
1832
1833
1833
codes = self ._codes
@@ -1963,7 +1963,7 @@ def take_nd(self, indexer, allow_fill=None, fill_value=None):
1963
1963
if fill_value in self .categories :
1964
1964
fill_value = self .categories .get_loc (fill_value )
1965
1965
else :
1966
- msg = "'fill_value' ('{}') is not in this Categorical's " " categories."
1966
+ msg = "'fill_value' ('{}') is not in this Categorical's categories."
1967
1967
raise TypeError (msg .format (fill_value ))
1968
1968
1969
1969
codes = take (self ._codes , indexer , allow_fill = allow_fill , fill_value = fill_value )
@@ -2168,12 +2168,12 @@ def __setitem__(self, key, value):
2168
2168
# in a 2-d case be passd (slice(None),....)
2169
2169
if len (key ) == 2 :
2170
2170
if not com .is_null_slice (key [0 ]):
2171
- raise AssertionError ("invalid slicing for a 1-ndim " " categorical" )
2171
+ raise AssertionError ("invalid slicing for a 1-ndim categorical" )
2172
2172
key = key [1 ]
2173
2173
elif len (key ) == 1 :
2174
2174
key = key [0 ]
2175
2175
else :
2176
- raise AssertionError ("invalid slicing for a 1-ndim " " categorical" )
2176
+ raise AssertionError ("invalid slicing for a 1-ndim categorical" )
2177
2177
2178
2178
# slicing in Series or Categorical
2179
2179
elif isinstance (key , slice ):
@@ -2561,9 +2561,7 @@ def __init__(self, data):
2561
2561
@staticmethod
2562
2562
def _validate (data ):
2563
2563
if not is_categorical_dtype (data .dtype ):
2564
- raise AttributeError (
2565
- "Can only use .cat accessor with a " "'category' dtype"
2566
- )
2564
+ raise AttributeError ("Can only use .cat accessor with a 'category' dtype" )
2567
2565
2568
2566
def _delegate_property_get (self , name ):
2569
2567
return getattr (self ._parent , name )
@@ -2607,7 +2605,7 @@ def name(self):
2607
2605
# need to be updated. `name` will need to be removed from
2608
2606
# `ok_for_cat`.
2609
2607
warn (
2610
- "`Series.cat.name` has been deprecated. Use `Series.name` " " instead." ,
2608
+ "`Series.cat.name` has been deprecated. Use `Series.name` instead." ,
2611
2609
FutureWarning ,
2612
2610
stacklevel = 2 ,
2613
2611
)
@@ -2619,7 +2617,7 @@ def index(self):
2619
2617
# need to be updated. `index` will need to be removed from
2620
2618
# ok_for_cat`.
2621
2619
warn (
2622
- "`Series.cat.index` has been deprecated. Use `Series.index` " " instead." ,
2620
+ "`Series.cat.index` has been deprecated. Use `Series.index` instead." ,
2623
2621
FutureWarning ,
2624
2622
stacklevel = 2 ,
2625
2623
)
0 commit comments