def fromlist(items, accessor=None, index=None, labels=None, dtype=None, npartitions=None, engine=None):
    """
    Load series data from a list with an optional accessor function.

    Will call accessor function on each item from the list,
    providing a generic interface for data loading.

    Parameters
    ----------
    items : list
        A list of items to load.

    accessor : function, optional, default = None
        A function to apply to each item in the list during loading.

    index : array, optional, default = None
        Index for records, if not provided will use (0,1,...,N)
        where N is the length of each record.

    labels : array, optional, default = None
        Labels for records. If provided, should have same length as items.

    dtype : string, default = None
        Data numerical type (if provided will avoid check)

    npartitions : int, default = None
        Number of partitions for parallelization (Spark only)

    engine : object, default = None
        Computational engine (e.g. a SparkContext for Spark)
    """
    if spark and isinstance(engine, spark):
        if dtype is None:
            dtype = accessor(items[0]).dtype if accessor else items[0].dtype
        nrecords = len(items)
        keys = map(lambda k: (k, ), range(len(items)))
        if not npartitions:
            npartitions = engine.defaultParallelism
        items = zip(keys, items)
        rdd = engine.parallelize(items, npartitions)
        if accessor:
            rdd = rdd.mapValues(accessor)
        return fromrdd(rdd, nrecords=nrecords, index=index, labels=labels, dtype=dtype, ordered=True)

    else:
        if accessor:
            items = [accessor(i) for i in items]
        return fromarray(items, index=index, labels=labels)
def fromlist ( items , accessor = None , index = None , labels = None , dtype = None , npartitions = None , engine = None ) : if spark and isinstance ( engine , spark ) : if dtype is None : dtype = accessor ( items [ 0 ] ) . dtype if accessor else items [ 0 ] . dtype nrecords = len ( items ) keys = map ( lambda k : ( k , ) , range ( len ( items ) ) ) if not npartitions : npartitions = engine . defaultParallelism items = zip ( keys , items ) rdd = engine . parallelize ( items , npartitions ) if accessor : rdd = rdd . mapValues ( accessor ) return fromrdd ( rdd , nrecords = nrecords , index = index , labels = labels , dtype = dtype , ordered = True ) else : if accessor : items = [ accessor ( i ) for i in items ] return fromarray ( items , index = index , labels = labels )
Load series data from a list with an optional accessor function.

    Will call accessor function on each item from the list,
    providing a generic interface for data loading.

    Parameters
    ----------
    items : list
        A list of items to load.

    accessor : function, optional, default = None
        A function to apply to each item in the list during loading.

    index : array, optional, default = None
        Index for records, if not provided will use (0,1,...,N)
        where N is the length of each record.

    labels : array, optional, default = None
        Labels for records. If provided, should have same length as items.

    dtype : string, default = None
        Data numerical type (if provided will avoid check)

    npartitions : int, default = None
        Number of partitions for parallelization (Spark only)

    engine : object, default = None
        Computational engine (e.g. a SparkContext for Spark)