maxframe.liteframe.read_csv#

maxframe.liteframe.read_csv(path, usecols=None, dtype=None, names=None, sep=',', header='infer', default_index_type=None, storage_options=None, chunk_bytes='64M', merge_small_files=True, compression='infer', head_bytes='100k', session=None, **kwargs)[source]#

Read a CSV file into a LiteFrame with Arrow dtypes.

Local (file:// or bare path) files are read with pandas and wrapped via from_local_df(). Remote paths are read in chunks by the MaxFrame backend; when a session is available the schema is inferred remotely, otherwise the tiler infers types at execution time.

Parameters:
  • path (str or list of str) – Path or list of paths to the CSV file(s) to read. Local paths and remote URIs are both supported.

  • usecols (list of str, optional) – Column names to select. If None, all columns are read.

  • dtype (dict or pandas.Series, optional) – Mapping of column name to dtype. Overrides inferred types for the given columns.

  • names (list of str, optional) – Custom column names. Used when the file has no header.

  • sep (str, default ',') – Field delimiter.

  • header (int, 'infer', or None, default 'infer') – Row number to use as column names, or 'infer' to detect automatically, or None with explicit names.

  • default_index_type (str, optional) – Index type for the resulting LiteFrame. If None, a default is chosen by the backend.

  • storage_options (dict, optional) – Extra options for the storage backend (e.g. credentials).

  • chunk_bytes (str, default '64M') – Target chunk size in bytes for splitting remote files.

  • merge_small_files (bool, default True) – Whether to merge small files into larger chunks.

  • compression (str, default 'infer') – Compression of the input file (e.g. 'gzip', 'infer').

  • head_bytes (str, default '100k') – Number of bytes to read from the file head for schema inference.

  • session (Session, optional) – Session to use for remote schema inference and execution. If None, the default session is used when available.

  • **kwargs – Additional keyword arguments forwarded to the CSV reader.

Returns:

A lazy LiteFrame with Arrow dtypes representing the CSV data. Call .execute() to materialize the results.

Return type:

LiteFrame

See also

LiteFrame.to_csv

Write a LiteFrame to a CSV file.

read_parquet

Read a Parquet file into a LiteFrame.

read_json

Read a JSON file into a LiteFrame.