Created
September 2, 2015 06:10
-
-
Save danabauer/d98fb2088136d88c4378 to your computer and use it in GitHub Desktop.
more date parsing of OSS sign-up data
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 datetime | |
| import csv | |
| if __name__ == '__main__': | |
| from_raw = raw_input('\nEnter FROM Date (e.g. 01-Nov-14) :') | |
| from_date = datetime.date(from_raw.split('-')) | |
| print 'From date: = ' + str(from_date) | |
| to_raw = raw_input('\nEnter TO Date (e.g. 25-Nov-14) :') | |
| to_date = datetime.date(to_raw.split('-')) | |
| in_file = 'Opensrc_disc_signups_11-10-14.csv' | |
| for line in in_file: | |
| fields = line.split(',') | |
| #found_date = datetime.date(*map(int, fields[0].split(' ')[0].split('-'))) | |
| found_date = datetime.datetime.strptime(fields[0], "%d-%b-%Y" ) | |
| if from_date <= found_date <= to_date: | |
| print line | |
| in_file.close() | |
| # The oss program dates are in this format 06-OCT-2014 %d-%b-%y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment