Skip to content

ENH: Add a unit conversion method for Pandas Series #41641

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
normansimonr opened this issue May 24, 2021 · 1 comment
Closed

ENH: Add a unit conversion method for Pandas Series #41641

normansimonr opened this issue May 24, 2021 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request Enhancement Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@normansimonr
Copy link

I wish I could use pandas to do unit conversion between miles/kilometres, inches/centimetres, feet/metres, etc, in a single line of code. I was thinking of something that someone could use like this:

my_series_in_kilometres = my_series_in_miles.convert_units(from="mi", to="km")
my_series_in_feet = my_series_in_metres.convert_units(from="m", to="ft")

I think this feature could potentially ease the lives of people who have to do a lot of data munging with pandas. I don't know if this already exists (pandas is so vast!) but after having searched on Google and having found nothing, I decided to open an issue. I am aware that you can do this with simple arithmetic operations, but perhaps it'd be nice to have a built-in method that saves you the looking up in conversion tables. Thank you!

@normansimonr normansimonr added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels May 24, 2021
@jreback
Copy link
Contributor

jreback commented May 24, 2021

see #10349

this was an inspiration for extension arrays; there is some preliminary support for pint

@jreback jreback added this to the No action milestone May 24, 2021
@jreback jreback added the Duplicate Report Duplicate issue or pull request label May 24, 2021
@jreback jreback closed this as completed May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Enhancement Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants