import csv


def _import_dat(file_name):
    """Imports two tables of coordinates from a .dat file."""
    x = []
    y = []
    with open(file_name) as csv_file:
        reader = csv.reader(csv_file, delimiter=' ')
        for row in reader:              
            x.append(float(row[0]))
            # Some .dat files have two spaces instead of one, in which case
            # row[1] is empty
            if row[1]=="": 
                y.append(float(row[2]))
            else:
                y.append(float(row[1]))
    return x, y