bug fix: empty row handling

dev
Steve Nyemba 2 years ago
parent 23b3c52230
commit 7ad0016617

@ -265,7 +265,7 @@ class Input :
_values = np.array( list(self._map.values())) _values = np.array( list(self._map.values()))
_matrix = pd.DataFrame(_matrix) #if type(_matrix) != pd.DataFrame else _matrix _matrix = pd.DataFrame(_matrix) #if type(_matrix) != pd.DataFrame else _matrix
# x = _matrix.apply(lambda row: _values[row.values == 1 ].tolist()[0] if row.values.sum() > 0 else None, axis=1).tolist() # x = _matrix.apply(lambda row: _values[row.values == 1 ].tolist()[0] if row.values.sum() > 0 else None, axis=1).tolist()
x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else None ,axis=1).tolist() 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()
return pd.DataFrame(x,columns=columns) return pd.DataFrame(x,columns=columns)

Loading…
Cancel
Save