File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ module DataFrame.Operations.Subset where
1010
1111import qualified Data.List as L
1212import qualified Data.Map as M
13+ import qualified Data.Set as S
1314import qualified Data.Text as T
1415import qualified Data.Vector as V
1516import qualified Data.Vector.Generic as VG
@@ -295,9 +296,10 @@ byIndexRange = ColumnIndexRange
295296
296297-- | O(n) select columns by column predicate name.
297298selectBy :: [SelectionCriteria ] -> DataFrame -> DataFrame
298- selectBy xs df = select columnsWithProperties df
299+ selectBy xs df = select finalSelection df
299300 where
300- columnsWithProperties = L. foldl' columnWithProperty [] xs
301+ finalSelection = Prelude. filter (`S.member` columnsWithProperties) (columnNames df)
302+ columnsWithProperties = S. fromList (L. foldl' columnWithProperty [] xs)
301303 columnWithProperty acc (ColumnName name) = acc ++ [name]
302304 columnWithProperty acc (ColumnNameProperty f) = acc ++ L. filter f (columnNames df)
303305 columnWithProperty acc (ColumnTextRange (from, to)) =
You can’t perform that action at this time.
0 commit comments