Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想定义一个包含发电机组燃料消耗数据的数组。x 轴的单位为“kW”,y 轴的单位为“gal/hr”。有没有办法用 Pint 或在每个轴上具有不同维度的类似库创建一个 Numpy 兼容的数量数组?
我发现的最佳方法是使用实验性 pint-pandas 库并将数据存储为数据框。
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]")})