Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Data Science by (17.6k points)

I have a pandas column of Timestamp data

In [27]: train["Original_Quote_Date"][6] 

Out[27]: Timestamp('2013-12-25 00:00:00')

How can check equivalence of these objects to datetime.date objects of the type

datetime.date(2013, 12, 25)

1 Answer

0 votes
by (41.4k points)

Converting Timestamp to datetime.date using .date method::

t = pd.Timestamp('2013-12-25 00:00:00')

t.date()

datetime.date(2013, 12, 25)

t.date() == datetime.date(2013, 12, 25)

Output:

True

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...