daft.read_csv
daft.read_csv#
- daft.read_csv(path: Union[str, List[str]], schema_hints: Optional[Dict[str, daft.datatype.DataType]] = None, fs: Optional[fsspec.spec.AbstractFileSystem] = None, has_headers: bool = True, column_names: Optional[List[str]] = None, delimiter: str = ',') daft.dataframe.dataframe.DataFrame [source]#
Creates a DataFrame from CSV file(s)
Example
>>> df = daft.read_csv("/path/to/file.csv") >>> df = daft.read_csv("/path/to/directory") >>> df = daft.read_csv("/path/to/files-*.csv") >>> df = daft.read_csv("s3://path/to/files-*.csv")
- Parameters
path (str) – Path to CSV (allows for wildcards)
schema_hints (dict[str, DataType]) – A mapping between column names and datatypes - passing this option will disable all schema inference on data being read, and throw an error if data being read is incompatible.
fs (fsspec.AbstractFileSystem) – fsspec FileSystem to use for reading data. By default, Daft will automatically construct a FileSystem instance internally.
has_headers (bool) – Whether the CSV has a header or not, defaults to True
delimiter (Str) – Delimiter used in the CSV, defaults to “,”
- Returns
parsed DataFrame
- Return type