pycatflow/input.py
def read(data,
         columns=None,
         nodes=None,
         categories=None,
         column_order=None,
         orientation="horizontal",
         delimiter=None,
         line_delimiter=None,
         prefix=""):
    """
    Parses a string into structured data for visualization.

    Parameters:
    data (str): String with records divided by line_delimiter and fields divided by delimiter; list of lists with the first element as list of headers; dictionary with headers as keys and values as lists
    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
    """

    if type(data) == str:
        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.split(line_delimiter)[0].split(delimiter)
        lines = data.split(line_delimiter)[1:]
        data = {}
        for h in headers:
            # data[h] = [line.split(delimiter)[headers.index(h)] for line in lines]
            data[h.replace('\r', '')] = [line.split(delimiter)[headers.index(h)].replace('\r', '') for line in lines]
    if type(data) == list:
        headers = data[0]
        lines = data[1:]
        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

    Parses a string into structured data for visualization.

    Parameters:
    data (str): String with records divided by line_delimiter and fields divided by delimiter; list of lists with the first element as list of headers; dictionary with headers as keys and values as lists
    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
    
Parses a string into structured data for visualization.

Dictionary of parsed data
Parses a string into structured data for visualization . Dictionary of parsed data
def read(data,
         columns=None,
         nodes=None,
         categories=None,
         column_order=None,
         orientation="horizontal",
         delimiter=None,
         line_delimiter=None,
         prefix=""):
    if type(data) == str:
        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.split(line_delimiter)[0].split(delimiter)
        lines = data.split(line_delimiter)[1:]
        data = {}
        for h in headers:
            data[h.replace('\r', '')] = [line.split(delimiter)[headers.index(h)].replace('\r', '') for line in lines]
    if type(data) == list:
        headers = data[0]
        lines = data[1:]
        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 ( data , columns = None , nodes = None , categories = None , column_order = None , orientation = "horizontal" , delimiter = None , line_delimiter = None , prefix = "" ) : if type ( data ) == str : 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 . split ( line_delimiter ) [ 0 ] . split ( delimiter ) lines = data . split ( line_delimiter ) [ 1 : ] data = { } for h in headers : data [ h . replace ( '\r' , '' ) ] = [ line . split ( delimiter ) [ headers . index ( h ) ] . replace ( '\r' , '' ) for line in lines ] if type ( data ) == list : headers = data [ 0 ] lines = data [ 1 : ] 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
Parses a string into structured data for visualization.
Parses a string into structured data for visualization .
"""
    Parses a string into structured data for visualization.

    Parameters:
    data (str): String with records divided by line_delimiter and fields divided by delimiter; list of lists with the first element as list of headers; dictionary with headers as keys and values as lists
    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
    """ # data[h] = [line.split(delimiter)[headers.index(h)] for line in lines]

data
columns
nodes
categories
column_order
orientation
delimiter
line_delimiter
prefix