diff options
author | Théo de la Hogue | 2023-02-13 13:48:36 +0100 |
---|---|---|
committer | Théo de la Hogue | 2023-02-13 13:48:36 +0100 |
commit | 21e0860e12485d2c7f9f46251107b3dfb16b9944 (patch) | |
tree | 1b0dcae8436fc6c124ff44e2177f3d9ca6629192 | |
parent | f5eaba8165fff2a915bcffc8cf6230fd12082a69 (diff) | |
download | argaze-21e0860e12485d2c7f9f46251107b3dfb16b9944.zip argaze-21e0860e12485d2c7f9f46251107b3dfb16b9944.tar.gz argaze-21e0860e12485d2c7f9f46251107b3dfb16b9944.tar.bz2 argaze-21e0860e12485d2c7f9f46251107b3dfb16b9944.tar.xz |
Checking split dict size.
-rw-r--r-- | src/argaze/DataStructures.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/argaze/DataStructures.py b/src/argaze/DataStructures.py index 7fb8cd8..fcd91e1 100644 --- a/src/argaze/DataStructures.py +++ b/src/argaze/DataStructures.py @@ -232,24 +232,27 @@ class TimeStampedBuffer(collections.OrderedDict): df.drop(exclude, inplace=True, axis=True) # Split columns - splited_columns = [] - for column in df.columns: + if len(split) > 0: - if column in split.keys(): + splited_columns = [] + + for column in df.columns: + + if column in split.keys(): - df[split[column]] = pandas.DataFrame(df[column].tolist(), index=df.index) - df.drop(column, inplace=True, axis=True) + df[split[column]] = pandas.DataFrame(df[column].tolist(), index=df.index) + df.drop(column, inplace=True, axis=True) - for new_column in split[column]: + for new_column in split[column]: - splited_columns.append(new_column) + splited_columns.append(new_column) - else: + else: - splited_columns.append(column) + splited_columns.append(column) - # Reorder splited columns - df = df[splited_columns] + # Reorder splited columns + df = df[splited_columns] # Append timestamps as index column df['timestamp'] = self.keys() |