kedro.io.LambdaDataSet¶
-
class
kedro.io.
LambdaDataSet
(load, save, exists=None)[source]¶ LambdaDataSet
loads and saves data to a data set. It relies on delegating to specific implementation such as csv, sql, etc.LambdaDataSet
class captures Exceptions while performing operations on composedDataSet
implementations. The composed data set is responsible for providing information on how to resolve the issue when possible. This information should be available through str(error).Example:
from kedro.io import LambdaDataSet import pandas as pd file_name = "test.csv" def load() -> pd.DataFrame: raise FileNotFoundError("'{}' csv file not found." .format(file_name)) data_set = LambdaDataSet(load, None)
-
__init__
(load, save, exists=None)[source]¶ Creates a new instance of
LambdaDataSet
with references to the required input/output data set methods.Parameters: - load (
Optional
[Callable
[[],Any
]]) – Method to load data from a data set. - save (
Optional
[Callable
[[Any
],None
]]) – Method to save data to a data set. - exists (
Optional
[Callable
[[],bool
]]) – Method to check whether output data already exists. If None, no exists method is added.
Raises: DataSetError
– If load and/or save is specified, but is not a Callable.- load (
Methods
__init__
(load, save[, exists])Creates a new instance of LambdaDataSet
with references to the required input/output data set methods.from_config
(name, config[, load_version, …])Create a data set instance using the configuration provided. load
()Loads data by delegation to the provided load method. save
(data)Saves data by delegation to the provided save method. -