There are essentially two ways of setting values of a structured array - assign values field by field (which you do), and using a list of tuples, which I'll demonstrate:
In [180]: all_content
Out[180]:
{'SYM': ['this_string', 'this_string', 'this_string'],
'DATE': ['NaN', 'NaN', 'NaN'],
'YEST': ['NaN', 'NaN', 'NaN'],
'other_DATE': ['NaN', 'NaN', 'NaN'],
'SIZE': ['NaN', 'NaN', 'NaN'],
'ACTIVITY': ['2019-09-27 14:18:28.000700 UTC',
'2019-09-27 14:18:28.000700 UTC',
'2019-09-27 14:18:28.000600 UTC']}
Make an object dtype array, mainly for the 'column' indexing convenience.
In [181]: arr = np.array(list(all_content.items()))
In [182]: arr
Out[182]:
array([['SYM', list(['this_string', 'this_string', 'this_string'])],
['DATE', list(['NaN', 'NaN', 'NaN'])],
['YEST', list(['NaN', 'NaN', 'NaN'])],
['other_DATE', list(['NaN', 'NaN', 'NaN'])],
['SIZE', list(['NaN', 'NaN', 'NaN'])],
['ACTIVITY',
list(['2019-09-27 14:18:28.000700 UTC', '2019-09-27 14:18:28.000700 UTC', '2019-09-27 14:18:28.000600 UTC'])]],
dtype=object)
Define the dtype - as you do, or with:
In [183]: dt = np.dtype(list(zip(arr[:,0],['O']*arr.shape[0])))
In [184]: dt
Out[184]: dtype([('SYM', 'O'), ('DATE', 'O'), ('YEST', 'O'), ('other_DATE', 'O'), ('SIZE', 'O'), ('ACTIVITY', 'O')])
List 'transpose' produces a list of tuples:
In [185]: list(zip(*arr[:,1]))
Out[185]:
[('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000700 UTC'),
('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000700 UTC'),
('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000600 UTC')]
This list is suitable as the data input:
In [186]: np.array(list(zip(*arr[:,1])),dtype=dt)
Out[186]:
array([('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000700 UTC'),
('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000700 UTC'),
('this_string', 'NaN', 'NaN', 'NaN', 'NaN', '2019-09-27 14:18:28.000600 UTC')],
dtype=[('SYM', 'O'), ('DATE', 'O'), ('YEST', 'O'), ('other_DATE', 'O'), ('SIZE', 'O'), ('ACTIVITY', 'O')])
You can simplify getting the number of keys/fields with:
In [187]: len(all_content)
Out[187]: 6
Another way to get the number of 'records' is
In [188]: first,*rest=all_content.values()
In [189]: first
Out[189]: ['this_string', 'this_string', 'this_string']
Your next(iter...)
is probably as good.