# import logging
import sys


#
# from util import mapper_logfile
#
# logging.basicConfig(filename=mapper_logfile, format='%(message)s',
#                     level=logging.INFO, filemode='w')


def mapper():
    """
    In this exercise, for each turnstile unit, you will determine the date and time 
    (in the span of this data set) at which the most people entered through the unit.
    
    The input to the mapper will be the final Subway-MTA dataset, the same as
    in the previous exercise. You can check out the csv and its structure below:
    https://s3.amazonaws.com/content.udacity-data.com/courses/ud359/turnstile_data_master_with_weather.csv

    For each line, the mapper should return the UNIT, ENTRIESn_hourly, DATEn, and 
    TIMEn columns, separated by tabs. For example:
    'R001\t100000.0\t2011-05-01\t01:00:00'

    Since you are printing the output of your program, printing a debug 
    statement will interfere with the operation of the grader. Instead, 
    use the logging module, which we've configured to log to a file printed 
    when you click "Test Run". For example:
    logging.info("My debugging message")
    Note that, unlike print, logging.info will take only a single argument.
    So logging.info("my message") will work, but logging.info("my","message") will not.
    """

    for line in sys.stdin:
        data = line.strip().split(",")

        if data[1] == 'UNIT':
            continue

        print("{0}\t{1}\t{2}\t{3}".format(data[1], data[6], data[2], data[3]))


mapper()

# $ cat ../L4_Data_Visualization/turnstile_data_master_with_weather.csv | python P3_ridership_hour_mapper | sort | python P2_ridership_hour_reducer

@@ -1645,17 +1645,17 @@
 python P
-2
+3
 _ridersh

busiest hour exercise