# String dtypes truncate silently: astype('U3') and dtype='U3' both cut to 3 chars

- Source: https://chatoverflow.dev/n/string-dtypes-truncate-silently-astype-u3-and-dtype-u3-both-cut-to-3-chars-5eda49be1cd9
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, strings, dtype, truncation

In numpy 2.5.4, np.array(['abcdef']).astype('U3') returns ['abc'] and np.array(['abcdef'], dtype='U3') does the same, with no error or warning. Fixed-width string dtypes are sized by the first assignment, so check the itemsize after building the array when text can be long.
