-
Notifications
You must be signed in to change notification settings - Fork 483
Closed
Description
I'd like to suggest as an enhancement that support for Pandas be considered. I see the need for this is several places over the internet (this one, this one, this one and this one for example) and I also have discussed this need in personal communications.
Some points:
- I know that, with the huge amount of functionality that pandas has, full support is very hard, but maybe the main functions (mean, std, etc.) and multiplication/division functionality
- However, given that Numpy is already supported, an expansion to pandas wouldn't have to start from scratch, so there's that
- Furthermore, since I have a lot of interest in a Pandas-with-units extension for my own personal projects, I could help out with the development once we agree on how it should be done (as I'm sure other people would also like to do)
Some examples of how it could work would be:
df = pd.DataFrame(np.random.randn(6,3))
df = df * (ureg.m, ureg.km, ureg.cm)
df.sum().sum()
df.mean().sum()
Currently, probably because of the numpy support, df.sum().sum()
works, but df.mean().sum()
doesn't. Furthermore, in this way, each element has its own unit:
0 1 2
0 -1.14025689919 meter 2.09836283028 kilometer 0.979569146473 centimeter
1 1.00550215217 meter 0.447878034084 kilometer 0.831879097545 centimeter
2 -1.37479008756 meter 0.0440848611227 kilometer 1.2712599879 centimeter
3 0.250507523208 meter -1.12502135888 kilometer 0.262470368675 centimeter
4 -0.329479372063 meter -0.201112807862 kilometer 1.10957183866 centimeter
5 1.049932299 meter 0.109837949121 kilometer -1.42261917121 centimeter
Maybe a better way would be something like
<QuantitySet(
0 1 2
0 -1.140257 2.098363 0.979569
1 1.005502 0.447878 0.831879
2 -1.374790 0.044085 1.271260
3 0.250508 -1.125021 0.262470
4 -0.329479 -0.201113 1.109572
5 1.049932 0.109838 -1.422619
'meter', 'kilometer', 'centimeter')>
jondoesntgit, zaneselvans, Illviljan and slightlynybbled
Metadata
Metadata
Assignees
Labels
No labels