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, 2019 in Python by digger
• 26,680 points
72 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, 2019 by Omkar
• 69,030 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, 2019 in Python by anonymous
722 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
• 57,700 points
6,738 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 1,032 views
0 votes
1 answer

how to calculate modulus in python?

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

answered Apr 1, 2019 in Python by anonymous
354 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, 2019 in Python by anonymous
188 views
+1 vote
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,950 points
6,118 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,950 points
933 views
+1 vote
11 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
39,537 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
• 69,030 points

edited Aug 8, 2018 by Omkar 4,526 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, 2019 in Python by Omkar
• 69,030 points
210 views