datetime in pandas showing the wrong value

Question:

import numpy as np
import pandas as pd
from datetime import datetime

Made variables assigned with the time:
year_= 2019
month_= 8
day_= 7
hour_= 6
sec_= 15

time_= datetime(year_,month_,day_,hour_,sec_)

But when i call time_.second it returns 0 in jupyter notebook

time_.second
0

Asked By: Moha

||

Answers:

This is because the 5th number is minutes. Not seconds.

Try:

year_= 2019
month_= 8
day_= 7
hour_= 6
min_ = 34
sec_= 15

time_= datetime(year_,month_,day_,hour_,min_,sec_)
time_.second
15

I have added the figure for minutes.

Answered By: gtomer
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.