@@ -50,91 +50,126 @@ def peakmem_cat_frame_construction(self, dtype):
5050
5151
5252class Methods :
53- def setup (self ):
54- self .s = Series (tm .makeStringIndex (10 ** 5 ))
53+ params = ["str" , "string" , "arrow_string" ]
54+ param_names = ["dtype" ]
55+
56+ def setup (self , dtype ):
57+ from pandas .core .arrays .string_arrow import ArrowStringDtype # noqa: F401
5558
56- def time_center (self ):
59+ try :
60+ self .s = Series (tm .makeStringIndex (10 ** 5 ), dtype = dtype )
61+ except ImportError :
62+ raise NotImplementedError
63+
64+ def time_center (self , dtype ):
5765 self .s .str .center (100 )
5866
59- def time_count (self ):
67+ def time_count (self , dtype ):
6068 self .s .str .count ("A" )
6169
62- def time_endswith (self ):
70+ def time_endswith (self , dtype ):
6371 self .s .str .endswith ("A" )
6472
65- def time_extract (self ):
73+ def time_extract (self , dtype ):
6674 with warnings .catch_warnings (record = True ):
6775 self .s .str .extract ("(\\ w*)A(\\ w*)" )
6876
69- def time_findall (self ):
77+ def time_findall (self , dtype ):
7078 self .s .str .findall ("[A-Z]+" )
7179
72- def time_find (self ):
80+ def time_find (self , dtype ):
7381 self .s .str .find ("[A-Z]+" )
7482
75- def time_rfind (self ):
83+ def time_rfind (self , dtype ):
7684 self .s .str .rfind ("[A-Z]+" )
7785
78- def time_get (self ):
86+ def time_get (self , dtype ):
7987 self .s .str .get (0 )
8088
81- def time_len (self ):
89+ def time_len (self , dtype ):
8290 self .s .str .len ()
8391
84- def time_join (self ):
92+ def time_join (self , dtype ):
8593 self .s .str .join (" " )
8694
87- def time_match (self ):
95+ def time_match (self , dtype ):
8896 self .s .str .match ("A" )
8997
90- def time_normalize (self ):
98+ def time_normalize (self , dtype ):
9199 self .s .str .normalize ("NFC" )
92100
93- def time_pad (self ):
101+ def time_pad (self , dtype ):
94102 self .s .str .pad (100 , side = "both" )
95103
96- def time_partition (self ):
104+ def time_partition (self , dtype ):
97105 self .s .str .partition ("A" )
98106
99- def time_rpartition (self ):
107+ def time_rpartition (self , dtype ):
100108 self .s .str .rpartition ("A" )
101109
102- def time_replace (self ):
110+ def time_replace (self , dtype ):
103111 self .s .str .replace ("A" , "\x01 \x01 " )
104112
105- def time_translate (self ):
113+ def time_translate (self , dtype ):
106114 self .s .str .translate ({"A" : "\x01 \x01 " })
107115
108- def time_slice (self ):
116+ def time_slice (self , dtype ):
109117 self .s .str .slice (5 , 15 , 2 )
110118
111- def time_startswith (self ):
119+ def time_startswith (self , dtype ):
112120 self .s .str .startswith ("A" )
113121
114- def time_strip (self ):
122+ def time_strip (self , dtype ):
115123 self .s .str .strip ("A" )
116124
117- def time_rstrip (self ):
125+ def time_rstrip (self , dtype ):
118126 self .s .str .rstrip ("A" )
119127
120- def time_lstrip (self ):
128+ def time_lstrip (self , dtype ):
121129 self .s .str .lstrip ("A" )
122130
123- def time_title (self ):
131+ def time_title (self , dtype ):
124132 self .s .str .title ()
125133
126- def time_upper (self ):
134+ def time_upper (self , dtype ):
127135 self .s .str .upper ()
128136
129- def time_lower (self ):
137+ def time_lower (self , dtype ):
130138 self .s .str .lower ()
131139
132- def time_wrap (self ):
140+ def time_wrap (self , dtype ):
133141 self .s .str .wrap (10 )
134142
135- def time_zfill (self ):
143+ def time_zfill (self , dtype ):
136144 self .s .str .zfill (10 )
137145
146+ def time_isalnum (self , dtype ):
147+ self .s .str .isalnum ()
148+
149+ def time_isalpha (self , dtype ):
150+ self .s .str .isalpha ()
151+
152+ def time_isdecimal (self , dtype ):
153+ self .s .str .isdecimal ()
154+
155+ def time_isdigit (self , dtype ):
156+ self .s .str .isdigit ()
157+
158+ def time_islower (self , dtype ):
159+ self .s .str .islower ()
160+
161+ def time_isnumeric (self , dtype ):
162+ self .s .str .isnumeric ()
163+
164+ def time_isspace (self , dtype ):
165+ self .s .str .isspace ()
166+
167+ def time_istitle (self , dtype ):
168+ self .s .str .istitle ()
169+
170+ def time_isupper (self , dtype ):
171+ self .s .str .isupper ()
172+
138173
139174class Repeat :
140175
@@ -178,13 +213,18 @@ def time_cat(self, other_cols, sep, na_rep, na_frac):
178213
179214class Contains :
180215
181- params = [True , False ]
182- param_names = ["regex" ]
216+ params = (["str" , "string" , "arrow_string" ], [True , False ])
217+ param_names = ["dtype" , "regex" ]
218+
219+ def setup (self , dtype , regex ):
220+ from pandas .core .arrays .string_arrow import ArrowStringDtype # noqa: F401
183221
184- def setup (self , regex ):
185- self .s = Series (tm .makeStringIndex (10 ** 5 ))
222+ try :
223+ self .s = Series (tm .makeStringIndex (10 ** 5 ), dtype = dtype )
224+ except ImportError :
225+ raise NotImplementedError
186226
187- def time_contains (self , regex ):
227+ def time_contains (self , dtype , regex ):
188228 self .s .str .contains ("A" , regex = regex )
189229
190230
0 commit comments