finam.data.prepare#
- finam.data.prepare(data, info, time_entries=1, force_copy=False, report_conversion=False)[source]#
Prepares data in FINAM’s internal transmission format.
Checks tha shape of the data. Checks or adds units and time dimension.
- Parameters:
data (arraylike) – The input data.
info (Info) – Info associated with the data.
time_entries (int, optional) – Number of time slices in the data. Default 1.
force_copy (bool, optional) – Forces the result to be a copy of the passed data. Default
False
.If not used, the result is a view of the data if no units conversion needs to be done.
report_conversion (bool, optional) – If true, returns a tuple with the second element indicating the unit conversion if it was required.
- Returns:
The prepared data as a numpy array, wrapped into a
pint.Quantity
.If
report_conversion
isTrue
, a tuple is returned with the second element indicating the unit conversion if it was required.The second element is
None
if no conversion was required, and a tuple of twopint.Unit
objects otherwise.- Return type:
pint.Quantity or tuple(pint.Quantity, tuple(pint.Unit, pint.Unit) or None)
- Raises:
FinamDataError – If the data doesn’t match its info.