Skip to content

Conversation

petern48
Copy link
Contributor

@petern48 petern48 commented Jul 14, 2025

Copied over from the issue for convenience

    dtype : str, numpy.dtype, or ExtensionDtype, optional
        Data type for the output Series. If not specified, this will be
        inferred from `data`.
        See the :ref:`user guide <basics.dtypes>` for more usages.
        If ``data`` is Series then is ignored.

The last line here is incorrect. specifying a dtype will override the default behavior. See this example

>>> import pandas as pd
>>> ser = pd.Series([1,2,3])
>>> ser
0    1
1    2
2    3
dtype: int64
>>> pd.Series(ser, dtype=float)
0    1.0
1    2.0
2    3.0
dtype: float64

@petern48 petern48 marked this pull request as ready for review July 14, 2025 02:58
@arthurlw arthurlw added the Docs label Jul 14, 2025
@jbrockmendel jbrockmendel merged commit bc6ad14 into pandas-dev:main Jul 14, 2025
47 checks passed
@jbrockmendel
Copy link
Member

thanks @petern48

@petern48 petern48 deleted the series_init branch July 17, 2025 03:36
eicchen pushed a commit to eicchen/pandas that referenced this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: Series.__init__ doc incorrectly says dtype is ignored if data is a Series

3 participants