12
Konversi antara datetime, Timestamp dan datetime64
Bagaimana cara mengonversi numpy.datetime64objek ke datetime.datetime(atau Timestamp)? Dalam kode berikut, saya membuat objek datetime, timestamp dan datetime64. import datetime import numpy as np import pandas as pd dt = datetime.datetime(2012, 5, 1) # A strange way to extract a Timestamp object, there's surely a better way? ts = pd.DatetimeIndex([dt])[0] dt64 …