Skip to content

pd.DataFrame.astype should allow dict as argument #12801

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

Closed
maxnoe opened this issue Apr 5, 2016 · 1 comment
Closed

pd.DataFrame.astype should allow dict as argument #12801

maxnoe opened this issue Apr 5, 2016 · 1 comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request

Comments

@maxnoe
Copy link

maxnoe commented Apr 5, 2016

Currently pd.DataFrame.astype only allows for one type.

I would like it to support a dict mapping column names to dtypes.
Like for example the dtype argument of pd.read_json.

df = pd.DataFrame({'a': [1, 2, 3], 'b': [1, 2, 3]})
df = df.astype({'a': 'int16', 'b': 'float32'})
@jreback
Copy link
Contributor

jreback commented Apr 5, 2016

dupe of #7271

PR is #12086

welcome to have you pick it up.

@jreback jreback closed this as completed Apr 5, 2016
@jreback jreback added Duplicate Report Duplicate issue or pull request Dtype Conversions Unexpected or buggy dtype conversions labels Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants