Skip to content

Commit 9e81c90

Browse files
DOC: add whatsnew note about __module__ changes for the public API (#62784)
1 parent 4e21bc3 commit 9e81c90

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,22 @@ If we had passed ``pd.Int64Dtype()`` or ``"int64[pyarrow]"`` for the dtype in th
515515

516516
With ``"mode.nan_is_na"`` set to ``False``, ``ser.to_numpy()`` (and ``frame.values`` and ``np.asarray(obj)``) will convert to ``object`` dtype if :class:`NA` entries are present, where before they would coerce to ``NaN``. To retain a float numpy dtype, explicitly pass ``na_value=np.nan`` to :meth:`Series.to_numpy`.
517517

518+
The ``__module__`` attribute now points to public modules
519+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
520+
521+
The ``__module__`` attribute on functions and classes in the public API has been
522+
updated to refer to the preferred public module from which to access the object,
523+
rather than the module in which the object happens to be defined (:issue:`55178`).
524+
525+
This produces more informative displays in the Python console for classes, e.g.,
526+
instead of ``<class 'pandas.core.frame.DataFrame'>`` you now see
527+
``<class 'pandas.DataFrame'>``, and in interactive tools such as IPython, e.g.,
528+
instead of ``<function pandas.io.parsers.readers.read_csv(...)>`` you now see
529+
``<function pandas.read_csv(...)>``.
530+
531+
This may break code that relies on the previous ``__module__`` values (e.g.
532+
doctests inspecting the ``type()`` of a DataFrame object).
533+
518534
.. _whatsnew_300.api_breaking.deps:
519535

520536
Increased minimum version for Python

0 commit comments

Comments
 (0)