I am trying to append data to a DolphinDB table using MultithreadTableWriter provided by DolphinDB Python API.
timestring=datetime.strptime(str(futures_[i].nActionDay)+""+str(futures_[i].nTime).zfill(9),'%Y%m%d%H%M%S%f')
writer.insert(futures_[i].szWindCode.decode('utf-8'), timestring,futures_[i].nMatch)
But an error message is reported: Data conversion error: unsupported type [<class ‘datetime.datetime'>].
Can anyone provide guidance on how to fix this issue? Thanks in advance.
The error lies in that the DolphinDB Python API doesn’t support the datetime.datetime data type. You need to convert it to np.datetime64 using the function
pd.to_datetime.Refer to the following example: