Taos
Taos

Reputation: 23

Getting rid of Timestamp in order to insert data into sql table

I am having issues inserting this dataframe into a sql table due to the 'DATE' variable. I need to get rid of the Timestamp that shows up when I change it to a tuple

enter image description here

enter image description here

Getting tuple from df to use in sql insert

enter image description here

What is the best way to get rid of the 'Timestamp('DATE') and have only 'DATE'? Thanks!

Upvotes: 0

Views: 87

Answers (1)

Mohsen_Fatemi
Mohsen_Fatemi

Reputation: 3401

One of the possible ways of doing this is to convert datetime64 to String that contains only 'DATE', in order to do this you can use datetime_as_string function from numpy :

import numpy as np

df['DATE'] = np.datetime_as_string(df['DATE'], unit='D')

then your code will work correctly.

Upvotes: 1

Related Questions