From d526a3a483909e87abe04b8e46576562f636939a Mon Sep 17 00:00:00 2001 From: perezgonzalez-irene <iregon@noc.ac.uk> Date: Thu, 5 Mar 2020 15:40:23 +0000 Subject: [PATCH] Added some docstrings --- common/converters.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/common/converters.py b/common/converters.py index f7e01a4..f0b8279 100644 --- a/common/converters.py +++ b/common/converters.py @@ -34,7 +34,33 @@ class df_converters(): self.numeric_scale = 1. if self.dtype in properties.numpy_floats else 1 self.numeric_offset = 0. if self.dtype in properties.numpy_floats else 0 def object_to_numeric(self, data, scale = None, offset = None): + """ + + Converts the object type elements of a pandas series to numeric type. + Right spaces are trated as ceros. Scale and offset can optionally be applied. + The final data type according to the class dtype. + Parameters + ---------- + self : dtype, numeric_scale and numeric_offset + Pandas dataframe with a column per report sections. + The sections in the columns as a block strings. + data : pandas.Series + Series with data to convert. Data must be object type + + Keyword Arguments + ----------------- + scale : numeric, optional + Scale to apply after conversion to numeric + offset : numeric, optional + Offset to apply after converion to numeric + + Returns + ------- + data : pandas.Series + Data series of type self.dtype + + """ scale = scale if scale else self.numeric_scale offset = offset if offset else self.numeric_offset # First do the appropriate managing of white spaces: -- GitLab