-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: make clear that DataFrame.astype
supports Series
input
#49508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Supporting import pandas as pd
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
df = df.astype(df.dtypes) |
@randolf-scholz can I do the fix in the documentation |
@ramvikrams Of course. |
mroeschke
pushed a commit
that referenced
this issue
Nov 11, 2022
codamuse
pushed a commit
to codamuse/pandas
that referenced
this issue
Nov 12, 2022
…49556) * for pandas-dev#49508 changing Doc for DataFrame.astype added the series in input in the doc of DataFrame.astype * up * up2 * up3 * up4 * up5
mliu08
pushed a commit
to mliu08/pandas
that referenced
this issue
Nov 27, 2022
…49556) * for pandas-dev#49508 changing Doc for DataFrame.astype added the series in input in the doc of DataFrame.astype * up * up2 * up3 * up4 * up5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.astype.html
Documentation problem
Currently, the parameter specification
does not mention that Series are natively supported.
Suggested fix for documentation
Something along the lines of
One might also want to add: (#43837)
I also noticed that the relevant code
pandas/pandas/core/dtypes/inference.py
Lines 266 to 295 in 91111fd
essentially is a weaker version of
isinstance(obj, collections.abc.Mapping)
that I guess was introduced to also catchSeries
.I would propose to think about replacing this with
isinstance(obj, Mapping | Series)
when appropriate.Related: pandas-dev/pandas-stubs#410
The text was updated successfully, but these errors were encountered: