Possible Duplicate:
Pythonic way to add datetime.date and datetime.time objects
This question seems quite simple for me but I can't find the answer.
I have a datetime.date()
to which I'd like to add a datetime.time()
.
>>> import datetime
>>> my_time = datetime.time(9, 30)
>>> my_date = datetime.date(2012, 10, 2)
I tried
>>> my_time + my_date
I would have liked to get a
datetime.datetime(2012, 10, 2, 9, 30)
But the operand is not supported.
What is the best way to add my_time
to my_date
?
pd.merge(df1,df2) pd. merge() automatically detects the common column between two datasets and combines them on this column. In this case pd. merge() used the default settings and returned a final dataset which contains only the common rows from both the datasets.
Pandas Combine() Function combine() function which allows us to take a date and time string values and combine them to a single Pandas timestamp object. The function accepts two main parameters: Date – refers to the datetime. date object denoting the date string.
We can join columns from two Dataframes using the merge() function. This is similar to the SQL 'join' functionality. A detailed discussion of different join types is given in the SQL lesson. You specify the type of join you want using the how parameter.
datetime.datetime.combine(datetime.date(2011, 01, 01), datetime.time(10, 23))
http://docs.python.org/release/2.6/library/datetime.html#datetime.datetime.combine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With