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 19, 2019 in Python by digger
• 26,740 points
849 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 19, 2019 by Omkar
• 69,220 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
5,859 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,020 points
9,936 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,560 points

edited Dec 11, 2018 by Nymeria 3,349 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
1,596 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
11,029 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
2,538 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
108,836 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,612 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 5, 2018 in Python by Omkar
• 69,220 points

edited Aug 8, 2018 by Omkar 8,150 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,220 points
1,559 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP