mlx.data.stream_csv_reader#
- mlx.data.stream_csv_reader(file: object, sep: str = ', ', quote: str = '"', *, local_prefix: str = '', file_fetcher: mlx::data::core::FileFetcher = None, file_fetcher_handle: mlx::data::core::FileFetcherHandle = None) mlx.data._c.Stream #
Stream samples from a csv file.
The file can be given as a filename or any python object that has a
read()
and aseek()
method. Optionally a file fetcher can be passed to fetch the file from a remote location.In the case that a file object was created from a file fetched by an MLX file fetcher, then a handle can be passed (the return value of fetch) to ensure that the file is kept on disk for the lifetime of the stream.
- Parameters:
file (str or python readable object) – The file to read the csv from.
sep (str) – The field separator in the csv file. (default: ‘,’)
quote (str) – The quotation character in the csv file. (default: ‘”’)
local_prefix (str) – The filepath prefix to use to read the files. (default: ‘’)
file_fetcher (mlx.data.core.FileFetcher, optional) – A file fetcher to read the csv files possibly from a remote location.
file_fetcher_handle (mlx.data.core.FileFetcherHandle, optional) – A handle to ensure that the file is kept on disk if a stream is passed instead of a filename.