How to read an Engauge CSV file with multiple separate tables into a list of Pandas Series

This How-To shows how to read a CSV-file with multiple tables separated by a new line (as generated by Engauge ) into a list of ‘ Pandas Series’.

import pandas as pd
import numpy as np
import pdb
def read_engauge_csv(fileName):
    """Reads a CSV file with multiple arrays stored by Engauge.
    Returns a list of series with names, x and y given by Engauge curves."""
    with open (fileName, "r") as dataFile:
        dataStrings =
    dataStrings = dataStrings.replace('\n\n', "BREAK")
    dataStrings = dataStrings.replace('\n',',')
    dataStrings = dataStrings.split("BREAK")
    # Remove the "," put by Engauge at the end of the last line.
    dataStrings[-1] = dataStrings[-1].rstrip(',')
    dataSeries = []
    for dataString in dataStrings:
        dataList = dataString.split(",")
        dataName = dataList[1]
        data = np.array(dataList[2:])
        data = data.astype(np.float64)
        data = data.reshape(-1,2) # Reshape to pairs
    return dataSeries

See also