@@ -231,6 +231,43 @@ returned if all the columns were dummy encoded, and a :class:`DataFrame` otherwi
231231Providing any ``SparseSeries `` or ``SparseDataFrame `` to :func: `concat ` will
232232cause a ``SparseSeries `` or ``SparseDataFrame `` to be returned, as before.
233233
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+
234271.. _whatsnew_0250.api_breaking.incompatible_index_unions
235272
236273 Incompatible Index Type Unions
@@ -331,7 +368,6 @@ This change is backward compatible for direct usage of Pandas, but if you subcla
331368Pandas objects *and * give your subclasses specific ``__str__ ``/``__repr__ `` methods,
332369you may have to adjust your ``__str__ ``/``__repr__ `` methods (:issue: `26495 `).
333370
334-
335371.. _whatsnew_0250.api_breaking.deps :
336372
337373Increased minimum versions for dependencies
@@ -537,7 +573,7 @@ Conversion
537573Strings
538574^^^^^^^
539575
540- -
576+ - Bug in the `` __name__ `` attribute of several methods of :class: ` Series.str `, which were set incorrectly ( :issue: ` 23551 `)
541577-
542578-
543579
0 commit comments