Function readCSVStream

  • Read a stream into a Dataframe.

    Warning: this is much slower than scanCSV or readCSV

    This will consume the entire stream into a single buffer and then call readCSV Only use it when you must consume from a stream, or when performance is not a major consideration


    Parameters

    • stream: Readable

      readable stream containing csv data

    • Optional options: Partial<ReadCsvOptions>

    Returns Promise<pl.DataFrame>

    Promise

    Example

    >>> const readStream = new Stream.Readable({read(){}});
    >>> readStream.push(`a,b\n`);
    >>> readStream.push(`1,2\n`);
    >>> readStream.push(`2,2\n`);
    >>> readStream.push(`3,2\n`);
    >>> readStream.push(`4,2\n`);
    >>> readStream.push(null);

    >>> pl.readCSVStream(readStream).then(df => console.log(df));
    shape: (4, 2)
    ┌─────┬─────┐
    ab
    │ --- ┆ --- │
    i64i64
    ╞═════╪═════╡
    12
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    22
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    32
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    42
    └─────┴─────┘