I have imported some timestamps into a Pandas frame (via MongoDBclient). They are to the microseconds. I'd like a way to round to the Day. I've seen a previous question about using np.round
while converting to ints and back again, but this doesn't work (I tried inlining a div by 3600 x 24 x 100000 but that didn't work).
I have this rather plain version, but it seems REALLY inefficient. What am I missing in either to_datetime
, or the np.round
example.
df['doa'] = df['doa'].map(lambda x: x.strftime("%Y-%m-%d")
pd.to_datetime(df['doa'])
Note, these are not INDEXES so I can't use the frequency trick.