docarray.array.mixins.io.from_gen module#
- class docarray.array.mixins.io.from_gen.FromGeneratorMixin(*args, **kwargs)[source]#
Bases:
object
Provide helper functions filling a
DocumentArray
-like object with a generator.- classmethod from_ndarray(array: np.ndarray, axis: int = 0, size: Optional[int] = None, shuffle: bool = False, *args, **kwargs) T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T
- classmethod from_files(patterns: Union[str, List[str]], recursive: bool = True, size: Optional[int] = None, sampling_rate: Optional[float] = None, read_mode: Optional[str] = None, to_dataturi: bool = False, exclude_regex: Optional[str] = None, *args, **kwargs) T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T
- classmethod from_csv(file: Union[str, TextIO], field_resolver: Optional[Dict[str, str]] = None, size: Optional[int] = None, sampling_rate: Optional[float] = None, dialect: Union[str, csv.Dialect] = 'excel') T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T
- classmethod from_huggingface_datasets(dataset_path: str, field_resolver: Optional[Dict[str, str]] = None, size: Optional[int] = None, sampling_rate: Optional[float] = None, filter_fields: bool = False, **datasets_kwargs) T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T
- classmethod from_ndjson(fp: Iterable[str], field_resolver: Optional[Dict[str, str]] = None, size: Optional[int] = None, sampling_rate: Optional[float] = None) T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T
- classmethod from_lines(lines: Optional[Iterable[str]] = None, filepath: Optional[str] = None, read_mode: str = 'r', line_format: str = 'json', field_resolver: Optional[Dict[str, str]] = None, size: Optional[int] = None, sampling_rate: Optional[float] = None) T [source]#
# noqa: DAR101 # noqa: DAR102 # noqa: DAR201
- Return type:
T