My goal is to create an output that has a Series datatype and following output:
I tried to achieve this by using the code below:
series_structure = pd.Series()
for i in table_dtypes[0]:
if i == "object":
type_dict = {'type': 'categorical'}
series_structure.append(type_dict)
elif i == "boolean":
type_dict = {'type': 'boolean'}
series_structure.append(type_dict)
elif i == "datetime64": # revisit here
type_dict = {'type': 'datetime', 'format': '%Y-%m-%d'}
series_structure.append(type_dict)
elif i == "int64":
type_dict = {'type': 'id', 'subtype': 'integer'}
series_structure.append(type_dict)
elif i == "float64": # revisit here
type_dict = {'type': 'numerical', 'subtype': 'float'}
series_structure.append(type_dict)
But I get the error below:
TypeError: cannot concatenate object of type '<class 'dict'>'; only Series and DataFrame objs are valid
For reference my input dataset looks like this (table_dtypes):
What can I do?