Am I doing something wrong here?
>>> import numpy as np
>>> dt = np.dtype({"names": ["First"],
"formats": [np.uint32],
"offsets": [3],
"itemsize": 8})
>>> dt.itemsize
7
It looks like a bug to me. But if you just need n bytes of padding at the end a composite type may help:
import numpy as np
dt = np.dtype({"names": ["First", "_"],
"formats": [np.uint32, (np.void,1)],
"offsets": [3,7],
})
arr = np.empty( (5,), dtype=dt )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With