pycatflow/input.py
def read_file(filepath,
              columns=None,
              nodes=None,
              categories=None,
              column_order=None,
              orientation="horizontal",
              delimiter=None,
              line_delimiter=None,
              prefix=""):
    """
    Loads data from file and returns structured data for visualisation.
    
    Parameters:
    filepath (str): Path to file
    columns (str): Name of the column with temporal data (leave None if orientation="vertical")
    nodes (str): Name of the column containing the node data
    categories (str): Name of the column containing optional categories of nodes
    column_order (str): Optionally provide the name of a column determining the order of the columns
    orientation (str): Horizontal if the temporal data are in one columns, vertical if the temporal data are the name of the column
    delimiter (str): Otpionally specify the delimiter, if None it will try to autodetect
    line_delimiter (str): optionally define the line_delimiter separator, by default \n
    prefix (str): delete an unwanted prefix out of the data

    Returns:
    (dict): Dictionary of parsed data
    """

    with open(filepath, "rb") as f:
        data = f.read()
    if delimiter is None:
        delimiter = find_delimiter(data)
    else:
        delimiter = delimiter
    if line_delimiter is None:
        line_delimiter = "\n"
    else:
        line_delimiter = line_delimiter
    headers = data.decode("utf-8-sig").split(line_delimiter)[0].split(delimiter)
    lines = data.decode("utf-8-sig").split(line_delimiter)[1:]
    lines = [line for line in lines if line != '']
    data = {}
    for h in headers:
        data[h.replace('\r', '')] = [line.split(delimiter)[headers.index(h)].replace('\r', '') for line in lines]
    
    data = prepare_data(data, columns, nodes, categories, orientation, column_order, prefix)
    return data

    Loads data from file and returns structured data for visualisation.
    
    Parameters:
    filepath (str): Path to file
    columns (str): Name of the column with temporal data (leave None if orientation="vertical")
    nodes (str): Name of the column containing the node data
    categories (str): Name of the column containing optional categories of nodes
    column_order (str): Optionally provide the name of a column determining the order of the columns
    orientation (str): Horizontal if the temporal data are in one columns, vertical if the temporal data are the name of the column
    delimiter (str): Otpionally specify the delimiter, if None it will try to autodetect
    line_delimiter (str): optionally define the line_delimiter separator, by default \n
    prefix (str): delete an unwanted prefix out of the data

    Returns:
    (dict): Dictionary of parsed data
    
Loads data from file and returns structured data for visualisation.

Dictionary of parsed data
Loads data from file and returns structured data for visualisation . Dictionary of parsed data
def read_file(filepath,
              columns=None,
              nodes=None,
              categories=None,
              column_order=None,
              orientation="horizontal",
              delimiter=None,
              line_delimiter=None,
              prefix=""):
    with open(filepath, "rb") as f:
        data = f.read()
    if delimiter is None:
        delimiter = find_delimiter(data)
    else:
        delimiter = delimiter
    if line_delimiter is None:
        line_delimiter = "\n"
    else:
        line_delimiter = line_delimiter
    headers = data.decode("utf-8-sig").split(line_delimiter)[0].split(delimiter)
    lines = data.decode("utf-8-sig").split(line_delimiter)[1:]
    lines = [line for line in lines if line != '']
    data = {}
    for h in headers:
        data[h.replace('\r', '')] = [line.split(delimiter)[headers.index(h)].replace('\r', '') for line in lines]
    data = prepare_data(data, columns, nodes, categories, orientation, column_order, prefix)
    return data
def read_file ( filepath , columns = None , nodes = None , categories = None , column_order = None , orientation = "horizontal" , delimiter = None , line_delimiter = None , prefix = "" ) : with open ( filepath , "rb" ) as f : data = f . read ( ) if delimiter is None : delimiter = find_delimiter ( data ) else : delimiter = delimiter if line_delimiter is None : line_delimiter = "\n" else : line_delimiter = line_delimiter headers = data . decode ( "utf-8-sig" ) . split ( line_delimiter ) [ 0 ] . split ( delimiter ) lines = data . decode ( "utf-8-sig" ) . split ( line_delimiter ) [ 1 : ] lines = [ line for line in lines if line != '' ] data = { } for h in headers : data [ h . replace ( '\r' , '' ) ] = [ line . split ( delimiter ) [ headers . index ( h ) ] . replace ( '\r' , '' ) for line in lines ] data = prepare_data ( data , columns , nodes , categories , orientation , column_order , prefix ) return data
Loads data from file and returns structured data for visualisation.
Loads data from file and returns structured data for visualisation .
"""
    Loads data from file and returns structured data for visualisation.
    
    Parameters:
    filepath (str): Path to file
    columns (str): Name of the column with temporal data (leave None if orientation="vertical")
    nodes (str): Name of the column containing the node data
    categories (str): Name of the column containing optional categories of nodes
    column_order (str): Optionally provide the name of a column determining the order of the columns
    orientation (str): Horizontal if the temporal data are in one columns, vertical if the temporal data are the name of the column
    delimiter (str): Otpionally specify the delimiter, if None it will try to autodetect
    line_delimiter (str): optionally define the line_delimiter separator, by default \n
    prefix (str): delete an unwanted prefix out of the data

    Returns:
    (dict): Dictionary of parsed data
    """
filepath
columns
nodes
categories
column_order
orientation
delimiter
line_delimiter
prefix