From 2ebe773a5137048b013ee43e4ad4651e69ddc9bd Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 20 Apr 2022 19:03:15 +0200 Subject: Starting to work on csv export. --- src/argaze/DataStructures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/argaze/DataStructures.py b/src/argaze/DataStructures.py index 7409192..146978e 100644 --- a/src/argaze/DataStructures.py +++ b/src/argaze/DataStructures.py @@ -3,6 +3,7 @@ import collections import json import bisect +import pandas class DictObject(): """Convert dictionnary into object""" @@ -113,4 +114,16 @@ class TimeStampedBuffer(collections.OrderedDict): except: raise RuntimeError(f'Can\' write {filepath}') + def export_as_csv(self, filepath): + """Write buffer content into a csv file""" + try: + + #series = pandas.Series(self) + #print(series) + + df = pandas.DataFrame.from_dict(self, orient='index', columns=['data']) + df.to_csv(filepath, index=True) + + except: + raise RuntimeError(f'Can\' write {filepath}') -- cgit v1.1