pd.to_datetime returns a Series of datetime64 dtype, as described here:

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html

df['DATE'] = df['Date'].dt.date

or this:

df['Date'].map(datetime.datetime.date) 
Answer from Jose on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.to_datetime.html
pandas.to_datetime — pandas 3.0.3 documentation
>>> pd.to_datetime(1490195805, unit="s") Timestamp('2017-03-22 15:16:45') >>> pd.to_datetime(1490195805433502912, unit="ns") Timestamp('2017-03-22 15:16:45.433502912') ... For float arg, precision rounding might happen. To prevent unexpected behavior use a fixed-width exact type. ... >>> pd.to_datetime([1, 2, 3], unit="D", origin=pd.Timestamp("1960-01-01")) DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], dtype='datetime64[s]', freq=None)
Discussions

QST: How to convert dtype from datetime64[ns] to datetime
Research I have searched the [pandas] tag on StackOverflow for similar questions. I have asked my usage related question on StackOverflow. Link to question on StackOverflow https://stackoverflow.co... More on github.com
🌐 github.com
8
April 14, 2023
python - convert datetime64[ns, UTC] pandas column to datetime - Stack Overflow
I have a dataframe which has timestamp and its datatype is object. 0 2020-07-09T04:23:50.267Z 1 2020-07-09T11:21:55.536Z 2 2020-07-09T11:23:18.015Z 3 2020-07-09T04:03:28.581Z 4 2020-07- More on stackoverflow.com
🌐 stackoverflow.com
python - Keep only date part when using pandas.to_datetime - Stack Overflow
I use pandas.to_datetime to parse the dates in my data. Pandas by default represents the dates with datetime64[ns] even though the dates are all daily only. I wonder whether there is an elegant/cle... More on stackoverflow.com
🌐 stackoverflow.com
python - How to convert a Pandas data frame column from np.datetime64 to datetime? - Stack Overflow
I would like to put a Pandas Data Frame column into datetime format from datetime64. This works on an an individual basis. In particular the following works fine: t = dt['time'].values[0] datetime. More on stackoverflow.com
🌐 stackoverflow.com
May 21, 2016
🌐
Pandas
pandas.pydata.org › docs › user_guide › timeseries.html
Time series / date functionality — pandas 3.0.3 documentation
In [51]: pd.DatetimeIndex(["2018-01-01", "2018-01-03", "2018-01-05"], freq="infer") Out[51]: DatetimeIndex(['2018-01-01', '2018-01-03', '2018-01-05'], dtype='datetime64[us]', freq='2D') In most cases, parsing strings to datetimes (with any of to_datetime(), DatetimeIndex, or Timestamp) will produce objects with microsecond (“us”) unit. The exception to this rule is if your strings have nanosecond precision, in which case the result will have “ns” unit:
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Timestamp.to_datetime64.html
pandas.Timestamp.to_datetime64 — pandas 3.0.3 documentation
>>> ts = pd.Timestamp(year=2023, month=1, day=1, ... hour=10, second=15) >>> ts Timestamp('2023-01-01 10:00:15') >>> ts.to_datetime64() numpy.datetime64('2023-01-01T10:00:15.000000')
🌐
GitHub
github.com › pandas-dev › pandas › issues › 52664
QST: How to convert dtype from datetime64[ns] to datetime · Issue #52664 · pandas-dev/pandas
April 14, 2023 - https://stackoverflow.com/questions/39207640/python-pandas-how-do-i-convert-from-datetime64ns-to-datetime · df[column].astype('datetime64') doesnt convert "datetime64[ns]" to datetime · Reactions are currently unavailable · No one assigned · Needs TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team memberUsage Question ·
Author   pandas-dev
🌐
Google Groups
groups.google.com › g › pydata › c › gQSi0ws_3Lo
using astype('datetime64[ns]')
My guess is that astype('datetime64[ns]') goes through NumPy's datetime64 machinery, which only parses ISO-8601 strings. Possibly astype() in pandas should be adjusted to use to_datetime() when appropriate.
Find elsewhere
🌐
Towards Data Science
towardsdatascience.com › home › latest › dealing with date and time in pandas dataframes
Dealing with Date and Time in Pandas DataFrames | Towards Data Science
January 21, 2025 - Here’s a technique that you can use. First, extract the day of week from the Date column (a datetime64[ns] object) using the strftime() function:
🌐
Statology
statology.org › home › how to convert datetime to date in pandas
How to Convert Datetime to Date in Pandas
September 1, 2020 - #convert datetime column to just date df['time'] = pd.to_datetime(df['time']).dt.normalize() #view DataFrame print(df) sales time 0 4 2020-01-15 1 11 2020-01-18 #find dtype of each column in DataFrame df.dtypes sales int64 time datetime64[ns] dtype: object · Once again only the date is displayed, but the ‘time’ column is a datetime64 dtype. How to Convert Columns to DateTime in Pandas How to Convert Strings to Float in Pandas
🌐
Python for Data Science
python4data.science › en › 24.3.0 › workspace › pandas › date-time.html
Date and Time - Python for Data Science 24.3.0
DatetimeIndex(['2022-03-27 00:00:00', '2022-03-27 01:00:00', '2022-03-27 02:00:00', '2022-03-27 03:00:00', '2022-03-27 04:00:00', '2022-03-27 05:00:00'], dtype='datetime64[ns]', freq='h') ... DatetimeIndex(['2022-03-27 00:00:00+00:00', '2022-03-27 01:00:00+00:00', '2022-03-27 02:00:00+00:00', '2022-03-27 03:00:00+00:00', '2022-03-27 04:00:00+00:00', '2022-03-27 05:00:00+00:00'], dtype='datetime64[ns, UTC]', freq='h')
🌐
Dataquest
dataquest.io › blog › datetime-in-pandas
DateTime in Pandas: An Uncomplicated Guide – Dataquest
May 12, 2025 - Now, the data type of the datetime column is a datetime64[ns]object. The [ns] means the nano second-based time format that specifies the precision of the DateTime object. Also, we can let the pandas read_csv() method parse certain columns as ...
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 1.4.0 › user_guide › timeseries.html
Time series / date functionality — pandas 1.4.0 documentation
Using the NumPy datetime64 and timedelta64 dtypes, pandas has consolidated a large number of features from other Python libraries like scikits.timeseries as well as created a tremendous amount of new functionality for manipulating time series data. ... In [1]: import datetime In [2]: dti = pd.to_datetime( ...: ["1/1/2018", np.datetime64("2018-01-01"), datetime.datetime(2018, 1, 1)] ...: ) ...: In [3]: dti Out[3]: DatetimeIndex(['2018-01-01', '2018-01-01', '2018-01-01'], dtype='datetime64[ns]', freq=None)
🌐
AskPython
askpython.com › home › converting string to numpy datetime64 in a dataframe
Converting String to Numpy Datetime64 in a Dataframe - AskPython
April 12, 2023 - Here are a few methods to convert a string to numpy datetime64. The Pandas package contains many in-built functions which help in modifying the data; one such function is the to_datetime. The primary objective of this function is to convert the provided argument into a datetime format.
Top answer
1 of 2
8

You can convert Series of dtype datetime64[ns] to a NumPy array of datetime.datetime objects by calling the .dt.to_pydatetime() method:

In [75]: df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 252 entries, 0 to 251
Data columns (total 1 columns):
time    252 non-null datetime64[ns]<--the `time` column has dtype `datetime64[ns]`
dtypes: datetime64ns
memory usage: 2.0 KB

In [77]: df.head()
Out[77]: 
        time
0 2009-01-02
1 2009-01-05
2 2009-01-06
3 2009-01-07
4 2009-01-08


In [76]: df['time'].dt.to_pydatetime()[:5]
Out[76]: 
array([datetime.datetime(2009, 1, 2, 0, 0),
       datetime.datetime(2009, 1, 5, 0, 0),
       datetime.datetime(2009, 1, 6, 0, 0),
       datetime.datetime(2009, 1, 7, 0, 0),
       datetime.datetime(2009, 1, 8, 0, 0)], dtype=object)

Note that NDFrames (such as Series and DataFrames) can only hold datetime-like objects as objects of dtype datetime64[ns]. The automatic conversion of all datetime-likes to a common dtype simplifies subsequent date computations. But it makes it impossible to store, say, Python datetime.datetime objects in a DataFrame column. Pandas core developer, Jeff Reback explains,

"We don't allow direct conversions because its simply too complicated to keep anything other than datetime64[ns] internally (nor necessary at all)."

2 of 2
0

Without your data set, I have to guess at some things. But, you should be able to repeat the same thing as what you demonstrated as having worked.

dt['datetime'] = datetime.utcfromtimestamp(dt['time'].values.astype(int)/1000000000))
🌐
Codecademy
codecademy.com › docs › python:pandas › built-in functions › .to_datetime()
Python:Pandas | Built-in Functions | .to_datetime() | Codecademy
June 26, 2025 - This example shows how .to_datetime() automatically recognizes standard date formats and converts them to pandas datetime objects. The resulting Series has datetime64[ns] dtype, enabling time-based operations and analysis.
🌐
Apache
spark.apache.org › docs › latest › api › python › reference › pyspark.pandas › api › pyspark.pandas.to_datetime.html
pyspark.pandas.to_datetime — PySpark 4.1.2 documentation
>>> ps.to_datetime(1490195805, unit='s') Timestamp('2017-03-22 15:16:45') >>> ps.to_datetime(1490195805433502912, unit='ns') Timestamp('2017-03-22 15:16:45.433502912') Using a non-unix epoch origin · >>> ps.to_datetime([1, 2, 3], unit='D', origin=pd.Timestamp('1960-01-01')) DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], dtype='datetime64[ns]', freq=None) Show Source