From 15e53cb6569eec301a3eb75637f7233a9c8a6ee4 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 13 Apr 2022 11:19:36 -0500 Subject: [PATCH] bug fix (exception handling) --- data/maker/prepare/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/data/maker/prepare/__init__.py b/data/maker/prepare/__init__.py index bc316e9..f7ae3f7 100644 --- a/data/maker/prepare/__init__.py +++ b/data/maker/prepare/__init__.py @@ -91,9 +91,11 @@ class Input : # # We will look into the count and make a judgment call try: - _df = pd.DataFrame(self.df.apply(lambda col: col.dropna().unique().size )).T - MIN_SPACE_SIZE = 2 - self._columns = cols if cols else _df.apply(lambda col:None if col[0] == row_count or col[0] < MIN_SPACE_SIZE else col.name).dropna().tolist() + # _df = pd.DataFrame(self.df.apply(lambda col: col.dropna().unique().size )).T + # MIN_SPACE_SIZE = 2 + # self._columns = cols if cols else _df.apply(lambda col:None if col[0] == row_count or col[0] < MIN_SPACE_SIZE else col.name).dropna().tolist() + # self._io = _df.to_dict(orient='records') + _df = self.df.nunique().T / self.df.shape[0] self._io = _df.to_dict(orient='records') except Exception as e: print (e)