File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,9 @@ def _validate(data):
255
255
inferred_dtype = lib .infer_dtype (values , skipna = True )
256
256
257
257
if inferred_dtype not in allowed_types :
258
- raise AttributeError ("Can only use .str accessor with string values!" )
258
+ raise AttributeError (
259
+ f"Can only use .str accessor with string values, not { inferred_dtype } "
260
+ )
259
261
return inferred_dtype
260
262
261
263
def __getitem__ (self , key ):
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ def test_str_attribute(self):
15
15
16
16
# str accessor only valid with string values
17
17
ser = Series (range (5 ))
18
- with pytest .raises (AttributeError , match = "only use .str accessor" ):
18
+ msg = "Can only use .str accessor with string values, not integer"
19
+ with pytest .raises (AttributeError , match = msg ):
19
20
ser .str .repeat (2 )
20
21
21
22
def test_str_accessor_updates_on_inplace (self ):
You can’t perform that action at this time.
0 commit comments