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):
255255 inferred_dtype = lib .infer_dtype (values , skipna = True )
256256
257257 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+ )
259261 return inferred_dtype
260262
261263 def __getitem__ (self , key ):
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ def test_str_attribute(self):
1515
1616 # str accessor only valid with string values
1717 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 ):
1920 ser .str .repeat (2 )
2021
2122 def test_str_accessor_updates_on_inplace (self ):
You can’t perform that action at this time.
0 commit comments