mindspore.dataset.Dataset.zip

Dataset.zip(datasets)[source]

Zip the datasets in the sense of input tuple of datasets. Columns in the input datasets must have different name.

Parameters

datasets (Union[Dataset, tuple[Dataset]]) – A tuple of datasets or a single class Dataset to be zipped together with this dataset.

Returns

Dataset, a new dataset with the above operation applied.

Raises

TypeError – The parameter is not dataset object or tuple of dataset objects.

Examples

>>> # Create a dataset which is the combination of dataset_1 and dataset_2
>>> import mindspore.dataset as ds
>>> dataset_1 = ds.GeneratorDataset([1, 2, 3], "column1")
>>> dataset_2 = ds.GeneratorDataset([1, 2, 3], "column2")
>>> dataset = dataset_1.zip(dataset_2)