コード例 #1
0
    def test_initialisation(self, data):
        # fails with plain array
        # works with PintArray
        strt = np.arange(100) * ureg.newton

        # it is sad this doesn't work
        with pytest.raises(ValueError):
            ser_fail = pd.Series(strt, dtype=ppi.PintType())
            assert all(ser_fail.values == strt)

        # This needs to be a list of scalar quantities to work :<
        ser = pd.Series([q for q in strt], dtype=ppi.PintType())
        assert all(ser.values == strt)
コード例 #2
0
def dtype():
    return ppi.PintType()