consider the below sample pandas DataFrame
df = pd.DataFrame({'date':[pd.to_datetime('2016-08-11 14:09:57.00'),pd.to_datetime('2016-08-11 15:09:57.00'),pd.to_datetime('2016-08-11 16:09:57.8700')]})
I can convert single instance into np.int64
type with
print(df.date[0].value)
1470924597000000000
or convert the entire columns iteratively
with
df.date.apply(lambda x: x.value)
How can I achieve this without using iteration
? something like
df.date.value
I would also want to convert back the np.int64
object to pd.Timestamp
object without using iteration. I got some insights from solutions posted here and here but it doesn't solve my problem.