I am trying For each RDD, remove the header row and parse each comma-delimited line into a Row object with each column following the data type given in the jupyter notebook cell. Please convert some columns into the preferred format. Columns that should be converted into integer : 'YEAR', 'MONTH', 'DAY','DAY_OF_WEEK', 'FLIGHT_NUMBER'. Column that should be converted into float data type : 'DEPARTURE_DELAY', 'ARRIVAL_DELAY', 'ELAPSED_TIME', 'AIR_TIME', 'DISTANCE', 'TAXI_IN', and 'TAXI_OUT'. While the rest are kept as string format.
Currently this is my code
def import_csv_rdd(data):
rdd = sc.textFile(data)
rdd_header =
# 1. Split each line separated by comma into a list
bank_rdd1 = bank_rdd.map(lambda line: line.split(','))
# 2. Remove the header
header = bank_rdd1.first()
bank_rdd1 = bank_rdd1.filter(lambda row: row != header) #filter out header
^ the above code is not finished and needs some adaptation however, i would like to get some clarification in how to "parse each comma-delimited line into a Row object"