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,700 points
80 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,130 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
950 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
• 58,080 points
7,172 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,293 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
433 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
226 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
• 11,380 points
6,616 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
• 11,380 points
1,042 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
44,867 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,130 points

edited Aug 8, 2018 by Omkar 5,047 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,130 points
258 views