I have two spreadsheets. One of them is about 20000 rows of patients entering an emergency room. Each row has a date/time column, along with separate date and separate time columns. Clearly multiple patients enter on the same day. The other spreadsheet has 366 dates and times of sunrises and sunsets for each day covered in the first spreadsheet.
What I want to do is create a column in the first spreadsheet called "is_night" and code each entry as a 0 if it's daytime (i.e. the time the patient entered is greater than the time of sunrise and less than the time of sunset corresponding to the patient's day of entry), and as a 1 if it's nighttime (the "else" condition)
What would be the simplest way to go about doing this? Doing time comparison is a pain in Excel and Python is giving me issues with parsing. Note that I have access to Python 3 (with Pandas), R, Excel, and Access. Thanks!
EDIT: Here are my column headings for each spreadsheet:
Patient Data: row_id day_of_week date_in time_in date_out time_out complaint mdassigned acuity_id elapsed_time triage disp_desc adm_dec adm_delay diagnosis icd date_time_in date_time_out
Sun Data: day_number sunrise_time sunset_time season month day year is_dst sunrise_time_dst sunset_time_dst date sunrise_date_time sunset_date_time sunrise_date_time_dst sunset_date_time_dst