Question about the practice question (working with date and time)

Screen Link:

answer :

import datetime as dt

def write_csv(file_name, rows):
import csv
f = open(file_name, ‘w’)
writer = csv.writer(f)
for row in rows:

Write your solution below

import csv

f = open(‘session_log.csv’)
reader = csv.reader(f)
rows = list(reader)[1:]

Clean and the new rows

clean_rows = [[‘user_id’, ‘session_start’, ‘session_end’]]
for row in rows:
user_id = row[0]
# Conver row data to integers
row = [int(x) for x in row]
start = dt.datetime(row[1], row[2], row[3], row[4], row[5])
end = dt.datetime(row[6], row[7], row[8], row[9], row[10])
session_start = start.strftime("%Y/%m/%d %H:%M")
session_end = end.strftime("%Y/%m/%d %H:%M")
clean_rows.append([user_id, session_start, session_end])

write_csv(‘session_log_clean.csv’, clean_rows)
Replace this line with your code

What I expected to happen:
 may i know what does this time mean? 
row = [int(x) for x in row]

What actually happened: 

Replace this line with the output/error

<!--Enter other details below: -->


Hi @samantha:

In future, it would be greatly appreciated if you could format your code and surround them using 3 backticks (below the Esc key on a US keyboard).

As in the comments of the suggested solution:

# Convert row data to integers
    row = [int(x) for x in row]

When we read from the dataset, the default type is of string. Since we would want to use datetime functions like datetime, which requires them to be of type integer (int) we will need to convert them in order to satisfy this requirement. This structure is called a list conprehension or an in-line for loop. You may read more about this here.