Created
June 5, 2015 15:12
-
-
Save Mengyuz/7d6948354a6c8b0ca564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas | |
| def time_to_hour(time): | |
| ''' | |
| Given an input variable time that represents time in the format of: | |
| "00:00:00" (hour:minutes:seconds) | |
| Write a function to extract the hour part from the input variable time | |
| and return it as an integer. For example: | |
| 1) if hour is 00, your code should return 0 | |
| 2) if hour is 01, your code should return 1 | |
| 3) if hour is 21, your code should return 21 | |
| Please return hour as an integer. | |
| ''' | |
| hour = int(time[0:2]) | |
| # your code here | |
| return hour |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment