Example like this.
>>> import numpy as np >>> >>> dtype = [('date', 'datetime64[D]'), ('value', 'float64'), ('code', 'U3')] >>> n = np.array([('2024-03-22', 71.0, 'ceh'), ('2024-03-23', 63.0, 'abc')], dtype=dtype) >>> n array([('2024-03-22', 71., 'ceh'), ('2024-03-23', 63., 'abc')], dtype=[('date', '<M8[D]'), ('value', '<f8'), ('code', '<U3')])String of up to 3 characters
<U3
.>>> n = np.array([('2024-03-22', 71.0, 'cehar'), ('2024-03-23', 63.0, 'abchhhhhhhhhh')], dtype=dtype) >>> n array([('2024-03-22', 71., 'ceh'), ('2024-03-23', 63., 'abc')], dtype=[('date', '<M8[D]'), ('value', '<f8'), ('code', '<U3')])To Pandas dataFrame,as Panda i build on NumPy in bottom it seamlessly transfer over.
>>> import pandas as pd >>> >>> df = pd.DataFrame(n) >>> df date value code 0 2024-03-22 71.0 ceh 1 2024-03-23 63.0 abc