Processor
A data processor for loading, processing, and saving data.
Usage
Processor()Parameters
name: str-
The name of the processor.
Examples
>>> p = Processor("csv")
>>> p.report()
{'name': 'csv', 'loaded': False}Methods
| Name | Description |
|---|---|
| __init__() | Initialize the processor. |
| load() | Load data from a source. |
| process() | Process the loaded data. |
| report() | Generate a report on the processor state. |
| save() | Save processed data to a destination. |
| validate() | Validate the loaded data. |
__init__()
Initialize the processor.
Usage
__init__(name)Parameters
name: str-
The name of the processor.
load()
Load data from a source.
Usage
load(source)Parameters
source: str-
The path or URI of the data source.
Returns
None
Examples
>>> p = Processor("csv")
>>> p.load("data.csv")process()
Process the loaded data.
Usage
process()Returns
list-
The processed data as a list.
Examples
>>> p = Processor("csv")
>>> p.load("data.csv")
>>> p.process()
['data.csv']report()
Generate a report on the processor state.
Usage
report()Returns
dict-
A dictionary with the processor status.
save()
Save processed data to a destination.
Usage
save(destination)Parameters
destination: str-
The path to save data to.
Returns
None
validate()
Validate the loaded data.
Usage
validate()Returns
bool-
True if data is valid, False otherwise.