From 51757dac5425d5c277b1e04f16172cca120c5193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Tue, 2 Oct 2018 11:35:25 +0200 Subject: [PATCH 1/4] Fix bug for datetime + add main for example of usage --- load_data.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/load_data.py b/load_data.py index 13180bb..af4b3ad 100644 --- a/load_data.py +++ b/load_data.py @@ -38,7 +38,7 @@ def extract_charge_items(charge, battery_nb, charge_nb): df_charge['charge_nb'] = [charge_nb] * len( charge['voltage_measured']) df_charge['datetime'] = pd.Timestamp( - charge['datetime']) + pd.to_timedelta(charge['time'][0], + charge['datetime']) + pd.to_timedelta(charge['time'], unit='s') return df_charge @@ -188,3 +188,11 @@ def get_datas( ) return set_labels_Y(df_training), set_labels_Y(df_validation), set_labels_Y(df_test) + +def main(): + # Example of use + df_train, df_validation, df_test = get_datas() + + +if __name__ == '__main__': + main() -- GitLab From 3954983db85a8ecd32f29b5937bb2058ff355db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Tue, 2 Oct 2018 11:44:55 +0200 Subject: [PATCH 2/4] Flake8 convention --- load_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/load_data.py b/load_data.py index af4b3ad..11efbfa 100644 --- a/load_data.py +++ b/load_data.py @@ -189,6 +189,7 @@ def get_datas( return set_labels_Y(df_training), set_labels_Y(df_validation), set_labels_Y(df_test) + def main(): # Example of use df_train, df_validation, df_test = get_datas() -- GitLab From 3c78bc18aa6dda016eb96b0160c178be7805a1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Fri, 5 Oct 2018 09:18:46 +0200 Subject: [PATCH 3/4] Rename main function to example --- load_data.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/load_data.py b/load_data.py index 11efbfa..6e1f881 100644 --- a/load_data.py +++ b/load_data.py @@ -190,10 +190,5 @@ def get_datas( return set_labels_Y(df_training), set_labels_Y(df_validation), set_labels_Y(df_test) -def main(): - # Example of use +def example(): df_train, df_validation, df_test = get_datas() - - -if __name__ == '__main__': - main() -- GitLab From b00e150f49ee480722cbb886cc8bd3e23725e1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Fri, 5 Oct 2018 09:20:34 +0200 Subject: [PATCH 4/4] Add __main__ call --- load_data.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/load_data.py b/load_data.py index 6e1f881..988cfb2 100644 --- a/load_data.py +++ b/load_data.py @@ -192,3 +192,7 @@ def get_datas( def example(): df_train, df_validation, df_test = get_datas() + + +if __name__ == '__main__': + example() -- GitLab