Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Added ability to remove nil from DataFrame and Series #102
DataSeries can remove nils using the method
This seems like a bad implementation:
DataFrameInternal >> removeRowsWithNilsAtColumn: columnNumber "Removes all rows having a nil value at the column columnNumber" | newContents rowsToDrop k | "rowsToDrop has 1 at i if i-th row needs to be dropped, else 0" rowsToDrop := (self columnAt: columnNumber) collect: [ :ele | (ele isNil) ifTrue: [ 1 ] ifFalse: [ 0 ] ]. newContents := Array2D rows: (self numberOfRows - (rowsToDrop select: [ :ele | ele = 1 ]) size) columns: (self numberOfColumns). 1 to: self numberOfColumns do: [ :j | k := 0. 1 to: self numberOfRows do: [ :i | (rowsToDrop at: i) = 1 ifTrue: [ k := k + 1 ] ifFalse: [ newContents at: i - k at: j put: (contents at: i at: j) ]]]. contents := newContents.
First you collect 0 and 1 (instead of true and false), then you check if element is equal to 1 (instead of having the boolean element). And so on