From d8aad070eeea60d7ed3f59340386287e8ec01c1e Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 10 Aug 2022 17:30:28 -0500 Subject: [PATCH] bug fix: random empty values --- data/maker/prepare/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/maker/prepare/__init__.py b/data/maker/prepare/__init__.py index a19fd31..15cbe99 100644 --- a/data/maker/prepare/__init__.py +++ b/data/maker/prepare/__init__.py @@ -268,8 +268,9 @@ class Input : #@TODO: Provide random values for things that are missing # x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else np.repeat(None,len(self._columns)) ,axis=1).tolist() - - x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else _values[np.random.choice(_values.size,1 )].tolist() ,axis=1).tolist() + novalues = _values[np.random.choice(_values.size,1)[0]].tolist() + # novalues = np.repeat(None,len(self._columns)) + x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else novalues ,axis=1).tolist() return pd.DataFrame(x,columns=columns)