pandas
, numpy
( Python 3, S1 '' U1 ' Python 2):
npchrs = df.values.astype(str).view('U1')
# array([['A', 'A', 'V', 'F', 'D', '', '', '', '', '', '', '', '', '', ''],
# ['T', 'Y', 'U', '?', 'W', '_', 'Z', '', '', '', '', '', '', '', ''],
# ['S', 'o', 'm', 'e', 'O', 't', 'h', 'e', 'r', 'S', 't', 'r', 'i', 'n', 'g'],
# ['E', 'T', 'C', '.', '', '', '', '', '', '', '', '', '', '', '']],
# dtype='<U1')
None
pandas
, , df .
@COLDSPEED , , . :
npobjs = npchrs.astype(object)
npobjs[npobjs==''] = None
# array([['A', 'A', 'V', 'F', 'D', None, None, None, None, None, None, None,
# None, None, None],
# ['T', 'Y', 'U', '?', 'W', '_', 'Z', None, None, None, None, None,
# None, None, None],
# ['S', 'o', 'm', 'e', 'O', 't', 'h', 'e', 'r', 'S', 't', 'r', 'i', 'n', 'g'],
# ['E', 'T', 'C', '.', None, None, None, None, None, None, None, None,
# None, None, None]], dtype=object)