That's very odd. There's something else going on, it's not just you being new to Pandas.
Here are some other suggestions:
Using "as_df=True"
In the initial query, include "as_df=True", rather than subsequently calling ".sdf" on the featureset. Then your query comes out directly into a dataframe. Saves you a step and an intermediate output as well, even if it doesn't solve the problem.
I've noticed a few differences between the two methods of generating a spatially-enabled dataframes, and I use both, depending on the situation.
Get the Integer First
It seems it's converting your field to a datetime64[ns] at the initial conversion to a dataframe.
If we're starting form a datetime instead of an integer, converting that to other datetime types would change the underlying integer value, but remain representative of the same timestamp.
So what we need to do is get the integer that it thinks are in nanoseconds, and call "astype" on that. It seems rather inelegant, but as long as we get the right data in the end, I suppose.
spdf['DATUM_AANLEG'].astype('int').astype('datetime64[ms]')
Doing some Math
If that second suggestion doesn't work, you could try to convert your timestamps into nanosecond integers. 1 ms = 1 * 10^6 ns.
(spdf['DATUM_AANLEG'].astype('int') * 10**6).astype('datetime64[ns]')
I hope at least one of those things works!
- Josh Carlson
Kendall County GIS