From 6b7ddc7a33b533b2c558be3f2dc3b95b0c2d1f5e Mon Sep 17 00:00:00 2001 From: dmt <> Date: Thu, 10 Oct 2019 18:00:08 +0200 Subject: [PATCH] Get the correct length and not the # columns. --- cml/ports/source_adapters.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cml/ports/source_adapters.py b/cml/ports/source_adapters.py index 2415b69..537491f 100644 --- a/cml/ports/source_adapters.py +++ b/cml/ports/source_adapters.py @@ -99,7 +99,13 @@ class PandasBlock: @property def length(self): - return len(self.__data_block) + return self.__data_block.shape[0] + + def drop_row(self, index): + self.__data_block.drop(index, inplace=True) + + def get_column_values(self, column_name): + return self.__data_block[column_name] class PandasAdapter: @@ -113,7 +119,10 @@ class PandasAdapter: @property def length(self): - return len(self.__data_frame) + return self.__data_frame.shape[0] + + def get_block_via_index(self, indexes): + return PandasBlock(self.__data_frame.iloc[indexes]) def get_block(self, start, end=None, step=None): return PandasBlock(self.__data_frame[start:end:step]) -- GitLab