0

I am looking for a way to clean a time input. Currently, it is a really messy one. Are there any methods to do that?

For example, I have a different types of time inputs such as 13, 13:00, 2pm, 1800 etc. and would like to compare this column with the entry time to see how many hours gone so need to normalize them. And I am sure it needs to be a method for it but can't really find anything.

I have two columns. One have generated time from the computer and the second was inputted by respondents of the survey in a various formats. So I am trying to compare both columns to see how many hours gone between entry and the exit. However, I have used timestamp and it doesn't work because of wrong inputs. So I am looking for an idea how to normalize time inputs.

DNW9555
  • 21
  • 2
  • So, what did you try? Also, there are no magic tools for this - can you make the question more specific: what exactly does not work? – FObersteiner Mar 18 '22 at 13:18
  • I have two columns. One have generated time from the computer and the second was inputted by respondents of the survey in a various formats. So I am trying to compare both columns to see how many hours gone between entry and the exit. However, I have used timestamp and it doesn't work because of wrong inputs. So I am looking for an idea how to normalize time inputs.. – DNW9555 Mar 18 '22 at 13:54
  • 1
    Can you add that info to the question? See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – FObersteiner Mar 18 '22 at 14:00
  • There is no great way of doing this. The correct way is to validate your form input when people are entering it to ensure it is entered in a single format. You'll have to clean your data in order to do this comparison. – JNevill Mar 18 '22 at 14:50

0 Answers0