This is by design. Pandas specializes in vectorised operations facilitated by NumPy arrays.1 Hence Pandas can store a datetime
series in a contiguous memory block backed by integer (int64
) values. In contrast, a list of datetime.datetime
values will consist of a sequence of pointers to a number of different memory addresses.
Apart from better memory management, pd.Timestamp
supports the functionality available to datetime.datetime
objects and, in addition, useful Pandas-specific functionality.
In general, avoid import datetime
if you can when using Pandas. Not only is it usually unnecessary, but it will also likely be less efficient than working directly with pd.Timestamp
objects.
1 See this answer for more information on how precisely this works.