from subprocess import check_output

import datetime

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
import datetime
from subprocess import check_output
def dateparse(x):
    try:
        return pd.datetime.strptime(x, '%Y-%m-%d %H:%M:%S')
    except TypeError as err:
        return None
d = pd.read_csv('../input/trainView.csv', header=0, names=['train_id', 'status', 'next_station', 'service', 'dest', 'lon', 'lat', 'source', 'track_change', 'track', 'date', 'timeStamp0', 'timeStamp1'], dtype={'train_id': str, 'status': str, 'next_station': str, 'service': str, 'dest': str, 'lon': str, 'lat': str, 'source': str, 'track_change': str, 'track': str, 'date': str, 'timeStamp0': datetime.datetime, 'timeStamp1': datetime.datetime})

d.head()
d['timeStamp0'] = pd.to_datetime(d['timeStamp0'], format='%Y-%m-%d %H:%M:%S')
d['timeStamp1'] = pd.to_datetime(d['timeStamp1'], format='%Y-%m-%d %H:%M:%S', errors='coerce')
d.head()