In numpy/numpy#9883 (part of numpy 1.14) the behavior of the formatting of 0d numpy arrays was changed. This unfortunately broke support for formatting (magnitude + unit) quantities using str.format:
In [2]: "{}".format(3*pq.m)
Out[2]: '3.0'
whereas with an older version of numpy (< 1.14) the unit is included in the formatted string:
In [2]: "{}".format(3*pq.m)
Out[2]: '3.0 m'
My current workaround is to use the !s conversion flag:
In [2]: "{!s}".format(3*pq.m)
Out[2]: '3.0 m'
Apparently unyt doesn't have this problem:
yt-project/unyt#89
In numpy/numpy#9883 (part of numpy 1.14) the behavior of the formatting of 0d numpy arrays was changed. This unfortunately broke support for formatting (magnitude + unit) quantities using
str.format:whereas with an older version of numpy (< 1.14) the unit is included in the formatted string:
My current workaround is to use the
!sconversion flag:Apparently unyt doesn't have this problem:
yt-project/unyt#89