How to calculate difference in timestamp columns?

–1 vote

I have a data frame with following columns and both datatypes are strings :

"DateSubmitted" , "DateClosed",
8/1/2018 12:29 8/2/2018 16:47
8/1/2018 20:25 8/2/2018 20:28

How to calculate the difference between Date Closed and date Submitted?

Jan 18 in Python by digger
• 26,550 points
39 views

1 answer to this question.

0 votes

First, write the data in a csv file. Then you can use the pandas data frame to calculate the difference. Refer to the below code:

import pandas as pd
pd.read_csv("names.csv")
df_test['Difference'] = (df_test['CloseDate'] - df_test['SubmittedDate']).dt.days
answered Jan 18 by Omkar
• 67,660 points

Related Questions In Python

0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

answered Apr 2 in Python by anonymous
244 views
0 votes
1 answer

How to convert datetime.date to UTC timestamp in Python

In Python 3 (< 3.3) From the docs ...READ MORE

answered Oct 31, 2018 in Python by Priyaj
• 56,900 points
2,675 views
0 votes
1 answer

How to calculate time interval between two time strings in Python

Try doing this - It is efficient for ...READ MORE

answered Nov 29, 2018 in Python by Nymeria
• 3,520 points

edited Dec 11, 2018 by Nymeria 166 views
0 votes
1 answer

how to calculate modulus in python?

calculate modules in python mod = a % ...READ MORE

answered Apr 1 in Python by anonymous
57 views
0 votes
0 answers

try except is not working while using hdfs command

Hi,  I am trying to run following things ...READ MORE

Mar 6 in Python by anonymous
51 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
3,304 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
391 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,294 views
+3 votes
2 answers

how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

answered Aug 4, 2018 in Python by Omkar
• 67,660 points

edited Aug 8, 2018 by Omkar 1,118 views
0 votes
1 answer

How to check latest change time of each file using glob in python?

You can get the changing time from ...READ MORE

answered Jan 2 in Python by Omkar
• 67,660 points
73 views