5. Package tools¶
Sub-package Dataframes¶
Provide tools to manage dataframes in the context of calibration.
Module dfdicts¶
Perform type-conversion and pretty-print operations for dictionaries.
- pvlab.dataframes.dfdicts.dict_to_df(dictionary: dict, columns: list) pandas.core.frame.DataFrame ¶
Re-arrange a dictionary to become a pandas dataframe.
It performs a type conversion of a dictionary ( e.g. a dictionary that represents valid time intervals, expressed in the form: *{‘START_1’: ([%Y], [%m], [%d], [%H], [%m], [%S]),
‘END_1’: ([%Y], [%m], [%d], [%H], [%m], [%S]), …, ‘START_j’: ([%Y], [%m], [%d], [%H], [%m], [%S]), ‘END_j’: ([%Y], [%m], [%d], [%H], [%m], [%S]), …, ‘START_n’: ([%Y], [%m], [%d], [%H], [%m], [%S]), ‘END_n’: ([%Y], [%m], [%d], [%H], [%m], [%S]), }*), returning a pandas DataFrame.
dictionary: DICT
- pvlab.dataframes.dfdicts.print_dict(dictionary: dict, columns: list, title: str = '') None ¶
Prettyprint a dictionary of dates, adding a title.
>>> dates = {'START_1': (2021,5,5,8,1,0), 'END_1': (2021,5,6,22,52,0)}
>>> columns = ['%Y', '%m', '%d', '%H', '%M', '%S']
>>> title = 'Valid time intervals'
>>> print_dict(dates, columns, title) Valid time intervals -------------------- %Y %m %d %H %M %S START_1 2021 5 5 8 1 0 END_1 2021 5 6 22 52 0
Math tools¶
Created on Sat Jun 19 20:00:33 2021
@author: josepedro
Contain the trigonometric function hypot, almost equal to math.hypot.
It supports n-dimensional coordinates, for compatibility with python versions older than 3.8.
In python 3.8, it was added support for n-dimensional points.
In python 3.10, accuracy was improved.
See https://docs.python.org/3/library/math.html#trigonometric-functions
Created on Mon May 31 06:59:06 2021
@author: josepedro
- pvlab.math.hypot.hypot(*coordinates)¶
Calculate the module of a vector, given its coordinates.
coordinates: VECTOR (list of floats) Vector of coordinates.
hypotenuse: FLOAT Hypotenuse.