better quantities support · Issue #2494 · pandas-dev/pandas (original) (raw)

I want to use the quantities package and pandas to process scientific data. However, pandas strips the unit(s) of the data stored in numpy arrays if I create a dataframe out of them:

a = np.random.rand(10)*pq.s b = np.random.rand(10)*pq.A df = pd.DataFrame({'current':b, 't':a}, columns=['t','current'])

In [1]: df Out[1]: t current 0 0.663397 0.435423 1 0.038498 0.101763 2 0.960983 0.091785 3 0.262863 0.364734 4 0.154440 0.274169 5 0.953129 0.052678 6 0.389961 0.272535 7 0.961604 0.559451 8 0.747192 0.438268 9 0.789207 0.568685

What do you think, should pandas have support for writing the unit of each column in the corresponding columnname if the column is a quantities array, or should it be part of the quantities package.

In [1]: df Out[1]: t [s] current [A] 0 0.663397 0.435423 1 0.038498 0.101763 2 0.960983 0.091785 ....