@@ -231,6 +231,43 @@ returned if all the columns were dummy encoded, and a :class:`DataFrame` otherwi
231
231
Providing any ``SparseSeries `` or ``SparseDataFrame `` to :func: `concat ` will
232
232
cause a ``SparseSeries `` or ``SparseDataFrame `` to be returned, as before.
233
233
234
+ The ``.str ``-accessor performs stricter type checks
235
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
236
+
237
+ Due to the lack of more fine-grained dtypes, :attr: `Series.str ` so far only checked whether the data was
238
+ of ``object `` dtype. :attr: `Series.str ` will now infer the dtype data *within * the Series; in particular,
239
+ ``'bytes' ``-only data will raise an exception (except for :meth: `Series.str.decode `, :meth: `Series.str.get `,
240
+ :meth: `Series.str.len `, :meth: `Series.str.slice `), see :issue: `23163 `, :issue: `23011 `, :issue: `23551 `.
241
+
242
+ *Previous Behaviour *:
243
+
244
+ .. code-block :: python
245
+
246
+ In [1 ]: s = pd.Series(np.array([' a' , ' ba' , ' cba' ], ' S' ), dtype = object )
247
+
248
+ In [2 ]: s
249
+ Out[2 ]:
250
+ 0 b ' a'
251
+ 1 b ' ba'
252
+ 2 b ' cba'
253
+ dtype: object
254
+
255
+ In [3 ]: s.str.startswith(b ' a' )
256
+ Out[3 ]:
257
+ 0 True
258
+ 1 False
259
+ 2 False
260
+ dtype: bool
261
+
262
+ *New Behaviour *:
263
+
264
+ .. ipython :: python
265
+ :okexcept:
266
+
267
+ s = pd.Series(np.array([' a' , ' ba' , ' cba' ], ' S' ), dtype = object )
268
+ s
269
+ s.str.startswith(b ' a' )
270
+
234
271
.. _whatsnew_0250.api_breaking.incompatible_index_unions
235
272
236
273
Incompatible Index Type Unions
@@ -331,7 +368,6 @@ This change is backward compatible for direct usage of Pandas, but if you subcla
331
368
Pandas objects *and * give your subclasses specific ``__str__ ``/``__repr__ `` methods,
332
369
you may have to adjust your ``__str__ ``/``__repr__ `` methods (:issue: `26495 `).
333
370
334
-
335
371
.. _whatsnew_0250.api_breaking.deps :
336
372
337
373
Increased minimum versions for dependencies
@@ -537,7 +573,7 @@ Conversion
537
573
Strings
538
574
^^^^^^^
539
575
540
- -
576
+ - Bug in the `` __name__ `` attribute of several methods of :class: ` Series.str `, which were set incorrectly ( :issue: ` 23551 `)
541
577
-
542
578
-
543
579
0 commit comments