def _convert_string_array(data, encoding, errors, itemsize=None):
<EOL>if encoding is not None and len(data):<EOL><INDENT>data = Series(data.ravel()).str.encode(<EOL>encoding, errors).values.reshape(data.shape)<EOL><DEDENT>if itemsize is None:<EOL><INDENT>ensured = ensure_object(data.ravel())<EOL>itemsize = max(<NUM_LIT:1>, libwriters.max_len_string_array(ensured))<EOL><DEDENT>data = np.asarray(data, dtype="<STR_LIT>".format(size=itemsize))<EOL>return data<EOL>
we take a string-like that is object dtype and coerce to a fixed size
string type

Parameters
----------
data : a numpy array of object dtype
encoding : None or string-encoding
errors : handler for encoding errors
itemsize : integer, optional, defaults to the max length of the strings

Returns
-------
data in a fixed-length string dtype, encoded to bytes if needed