Ragnar API

This page contains a comprehensive list of all functions within ragnar. Docstrings should provide sufficient understanding for any individual function.

Stream

class ragnar.stream.Stream(value, **kwargs)[source]

Bases: object

This object brings together the advantages of generators and the functional programming paradigm. Stream is an object that allows accumulating actions to be applied to a dataset.

Parameters:repeatable (bool, optional) – This parameter is used to enable repeating iterations if ‘True’ allows to iterate as many times as required
do(func, chain=False)[source]

This method adds a function to apply to the execution stack.

Parameters:
  • func – method to be included in the execution stack
  • chain (bool, optional) – The results are merged into a single dataset. For example if you read multiple files the results are merged to loop like a single list.
filter(func)[source]

This method adds a filter to apply to the execution stack.

Parameters:func – method to be included in the execution stack. It must be a function that returns a boolean value, otherwise the filter is not applied.
ragnar.stream.func_cat(value, *forms)[source]

Objstream

class ragnar.objstream.ObjStream(value, **kwargs)[source]

Bases: ragnar.stream.Stream

This object inherits from the Stream object, specific for record-based data.

Parameters:
  • columns – Object headers.
  • skip_first – 0mits the first row (usually headers)
applyto(fields: Union[str, list], func, entire_object=False)[source]

This method adds a function to apply to the execution stack.

Parameters:
  • fields (typing.Union[list, str]) – fields where to apply the function.
  • func – method to be included in the execution stack
  • entire_object (bool, optional) – passing the field or the entire record as a dictionary to the function