0

I want to define an array containing fuel consumption data for a genset. The x-axis will have units of 'kW' and the y-axis 'gal/hr'. Is there a way to create a Numpy compatible Quantity Array with Pint or a similar library that has different dimensions in each axis?

Darko
  • 589
  • 1
  • 7
  • 18
  • Your question isn't clear. `different units in each dimension`? `different dimensions in each axis`? Plotting `kW` on the x-axis, and `gal/hr` on the y makes some sense, but that's plotting two 1d arrays against each other, not a 2d array. – hpaulj Apr 20 '20 at 21:47

1 Answers1

0

The best approach I've found is to use the experimental pint-pandas library and storing the data as a data-frame.

consumption_data = pd.DataFrame({
    "power": pd.Series([5, 10, 15, 20], dtype="pint[kW]"),
    "consumption": pd.Series([0.6, 0.9, 1.3, 1.6], dtype="pint[gal/hr]")})
Darko
  • 589
  • 1
  • 7
  • 18