aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-11-16 19:55:27 +0100
committerThéo de la Hogue2022-11-16 19:55:27 +0100
commitfbec2667e4905fb65ad034fee7c0d4094e96d634 (patch)
tree4d80c6e94de3e84fd91fdfb3b5e2288b267a49b7
parent2f9a19eec8dd729b0134190b00b52e82c780f12b (diff)
downloadargaze-fbec2667e4905fb65ad034fee7c0d4094e96d634.zip
argaze-fbec2667e4905fb65ad034fee7c0d4094e96d634.tar.gz
argaze-fbec2667e4905fb65ad034fee7c0d4094e96d634.tar.bz2
argaze-fbec2667e4905fb65ad034fee7c0d4094e96d634.tar.xz
Replacing __str__ by __repr__. Removing save_as_csv.
-rw-r--r--src/argaze/DataStructures.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/argaze/DataStructures.py b/src/argaze/DataStructures.py
index 6502091..5bbd47e 100644
--- a/src/argaze/DataStructures.py
+++ b/src/argaze/DataStructures.py
@@ -46,10 +46,10 @@ class TimeStampedBuffer(collections.OrderedDict):
super().__setitem__(ts, data)
- def __str__(self):
+ def __repr__(self):
"""String representation"""
- return json.dumps(self, default=vars)
+ return json.dumps(self, ensure_ascii = False, default=vars)
def append(self, timestamped_buffer: TimeStampedBufferType) -> TimeStampedBufferType:
"""Append a timestamped buffer."""
@@ -153,25 +153,6 @@ class TimeStampedBuffer(collections.OrderedDict):
return df
- def save_as_csv(self, filepath, exclude=[]):
- """Write into a csv file."""
-
- try:
- self.as_dataframe(exclude=exclude).to_csv(filepath, index=True)
-
- except:
- raise RuntimeError(f'Can\' write {filepath}')
-
- def save_as_json(self, filepath):
- """Write into a json file."""
-
- try:
- with open(filepath, 'w', encoding='utf-8') as jsonfile:
- json.dump(self, jsonfile, ensure_ascii = False, default=vars)
-
- except:
- raise RuntimeError(f'Can\' write {filepath}')
-
def plot(self, names=[], colors=[], split={}, samples=None) -> list:
"""Plot as [matplotlib](https://matplotlib.org/) time chart."""