diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e912dfd9e5d..35ba065b957d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -588,6 +588,8 @@ - [Implemented `Table.expand_to_rows` for the in-memory backend.][8029] - [Added XML support for `.to Table` and `.expand_column`.][8083] - [Added `Previous_Value` option to `fill_nothing` and `fill_empty`.][8105] +- [Implemented new selector for when parameter in `filter_blank_rows`, + `select_blank_columns`, `remove_blank_columns`][7935] [debug-shortcuts]: https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug @@ -839,6 +841,7 @@ [8029]: https://github.com/enso-org/enso/pull/8029 [8083]: https://github.com/enso-org/enso/pull/8083 [8105]: https://github.com/enso-org/enso/pull/8105 +[7935]: https://github.com/enso-org/enso/pull/7935 #### Enso Compiler diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso index 41c7a41103c0..d039e5e27538 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso @@ -14,6 +14,7 @@ from Standard.Base.Widget_Helpers import make_delimiter_selector import Standard.Table.Data.Calculations.Column_Operation.Column_Operation import Standard.Table.Data.Column_Ref.Column_Ref import Standard.Table.Data.Constants.Previous_Value +import Standard.Table.Data.Blank_Selector.Blank_Selector import Standard.Table.Data.Expression.Expression import Standard.Table.Data.Expression.Expression_Error import Standard.Table.Data.Join_Condition.Join_Condition @@ -271,9 +272,9 @@ type Table rows are present, all columns are considered blank. Arguments: - - when_any: By default, only columns consisting of all blank cells are - selected. If set to `True`, columns with one or more blank values are - selected. + - when: By default, only columns consisting of all blank cells are + selected. If set to Blank_Selector.Any_Cell_Blank, columns with one or + more blank values are selected. - treat_nans_as_blank: specified whether `Number.nan` is considered as blank. By default, it is not. @@ -284,9 +285,9 @@ type Table Select completely blank columns from a table. table.select_blank_columns - select_blank_columns : Boolean -> Boolean -> Table - select_blank_columns self (when_any : Boolean = False) (treat_nans_as_blank : Boolean = False) = - new_columns = self.columns_helper.select_blank_columns_helper when_any treat_nans_as_blank + select_blank_columns : Blank_Selector -> Boolean -> Table + select_blank_columns self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) treat_nans_as_blank=False = + new_columns = self.columns_helper.select_blank_columns_helper when treat_nans_as_blank if new_columns.length == 0 then Error.throw (No_Output_Columns) else self.updated_columns new_columns @@ -297,9 +298,9 @@ type Table rows are present, all columns are considered blank. Arguments: - - when_any: By default, only columns consisting of all blank cells are - selected. If set to `True`, columns with one or more blank values are - selected. + - when: By default, only columns consisting of all blank cells are + selected. If set to Blank_Selector.Any_Cell_Blank, columns with one or + more blank values are selected. - treat_nans_as_blank: specified whether `Number.nan` is considered as blank. By default, it is not. @@ -310,9 +311,9 @@ type Table Remove completely blank columns from a table. table.remove_blank_columns - remove_blank_columns : Boolean -> Boolean -> Table - remove_blank_columns self (when_any : Boolean = False) (treat_nans_as_blank : Boolean = False) = - new_columns = self.columns_helper.select_blank_columns_helper when_any treat_nans_as_blank invert_selection=True + remove_blank_columns : Blank_Selector -> Boolean -> Table + remove_blank_columns self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) treat_nans_as_blank=False = + new_columns = self.columns_helper.select_blank_columns_helper when treat_nans_as_blank invert_selection=True if new_columns.length == 0 then Error.throw (No_Output_Columns) else self.updated_columns new_columns @@ -2111,15 +2112,16 @@ type Table Remove rows which are all blank or containing blank values. Arguments: - - when_any: If `True`, then remove any row containing any blank values. - If `False`, then only remove rows with all blank values. + - when: If Blank_Selector.Any_Cell_Blank, then remove any row containing + any blank values. + If Blank_Selector.All_Cells_Blank, then only remove rows with all blank values. - treat_nans_as_blank: If `True`, then `Number.nan` is considered as blank. ? Blank values Blank values are `Nothing`, `""` and depending on setting `Number.nan`. - filter_blank_rows : Boolean -> Boolean -> Table - filter_blank_rows self when_any=False treat_nans_as_blank=False = - Table_Helpers.filter_blank_rows self when_any treat_nans_as_blank + filter_blank_rows : Blank_Selector -> Boolean -> Table + filter_blank_rows self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) treat_nans_as_blank=False = + Table_Helpers.filter_blank_rows self when treat_nans_as_blank ## ALIAS count GROUP Standard.Base.Metadata diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Blank_Selector.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Blank_Selector.enso new file mode 100644 index 000000000000..25db6abff43a --- /dev/null +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Blank_Selector.enso @@ -0,0 +1,6 @@ +## TODO Documents +type Blank_Selector + ## Blank_Selector is used as a constructor for other functions. + Any_Cell_Blank + + All_Cells_Blank \ No newline at end of file diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso index 229495bf2da1..a54d27953aaa 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso @@ -15,6 +15,7 @@ from Standard.Base.Widget_Helpers import make_delimiter_selector import project.Data.Aggregate_Column.Aggregate_Column import project.Data.Calculations.Column_Operation.Column_Operation +import project.Data.Blank_Selector.Blank_Selector import project.Data.Column as Column_Module import project.Data.Column.Column import project.Data.Column_Ref.Column_Ref @@ -52,6 +53,7 @@ import project.Internal.Split_Tokenize import project.Internal.Table_Helpers import project.Internal.Table_Helpers.Table_Column_Helper import project.Internal.Widget_Helpers + from project.Data.Column import get_item_string, normalize_string_for_display from project.Data.Type.Value_Type import Auto, Value_Type from project.Errors import all @@ -412,9 +414,9 @@ type Table rows are present, all columns are considered blank. Arguments: - - when_any: By default, only columns consisting of all blank cells are - selected. If set to `True`, columns with one or more blank values are - selected. + - when: By default, only columns consisting of all blank cells are + selected. If set to Blank_Selector.Any_Cell_Blank, columns with one or + more blank values are selected. - treat_nans_as_blank: specifies whether `Number.nan` is considered as blank. By default, it is not. @@ -425,9 +427,9 @@ type Table Select completely blank columns from a table. table.select_blank_columns - select_blank_columns : Boolean -> Boolean -> Table ! No_Output_Columns - select_blank_columns self (when_any : Boolean = False) (treat_nans_as_blank : Boolean = False) = - new_columns = self.columns_helper.select_blank_columns_helper when_any treat_nans_as_blank + select_blank_columns : Blank_Selector -> Boolean -> Table ! No_Output_Columns + select_blank_columns self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) (treat_nans_as_blank : Boolean = False) = + new_columns = self.columns_helper.select_blank_columns_helper when treat_nans_as_blank if new_columns.length == 0 then Error.throw (No_Output_Columns) else Table.new new_columns @@ -438,8 +440,8 @@ type Table rows are present, all columns are considered blank. Arguments: - - when_any: By default, only columns consisting of all blank cells are - selected. If set to `True`, columns with one or more blank values are + - when By default, only columns consisting of all blank cells are + selected. If set to Blank_Selector.Any_Cell_Blank, columns with one or more blank values are selected. - treat_nans_as_blank: specified whether `Number.nan` is considered as blank. By default, it is not. @@ -451,9 +453,9 @@ type Table Remove completely blank columns from a table. table.remove_blank_columns - remove_blank_columns : Boolean -> Boolean -> Table ! No_Output_Columns - remove_blank_columns self (when_any : Boolean = False) (treat_nans_as_blank : Boolean = False) = - new_columns = self.columns_helper.select_blank_columns_helper when_any treat_nans_as_blank invert_selection=True + remove_blank_columns : Blank_Selector -> Boolean -> Table ! No_Output_Columns + remove_blank_columns self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) (treat_nans_as_blank : Boolean = False) = + new_columns = self.columns_helper.select_blank_columns_helper when treat_nans_as_blank invert_selection=True if new_columns.length == 0 then Error.throw (No_Output_Columns) else Table.new new_columns @@ -2004,15 +2006,16 @@ type Table Remove rows which are all blank or containing blank values. Arguments: - - when_any: If `True`, then remove any row containing any blank values. - If `False`, then only remove rows with all blank values. + - when: If Blank_Selector.Any_Cell_Blank, then remove any row containing + any blank values. + If Blank_Selector.All_Cells_Blank, then only remove rows with all blank values. - treat_nans_as_blank: If `True`, then `Number.nan` is considered as blank. ? Blank values Blank values are `Nothing`, `""` and depending on setting `Number.nan`. - filter_blank_rows : Boolean -> Boolean -> Table - filter_blank_rows self when_any=False treat_nans_as_blank=False = - Table_Helpers.filter_blank_rows self when_any treat_nans_as_blank + filter_blank_rows : Blank_Selector -> Boolean -> Table + filter_blank_rows self when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=False = + Table_Helpers.filter_blank_rows self when treat_nans_as_blank ## ALIAS count GROUP Standard.Base.Metadata diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Table_Helpers.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Table_Helpers.enso index 85980850954a..fb73a1e086f2 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Table_Helpers.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Table_Helpers.enso @@ -3,6 +3,7 @@ import Standard.Base.Errors.Illegal_Argument.Illegal_Argument import Standard.Base.Errors.Illegal_State.Illegal_State import project.Data.Aggregate_Column.Aggregate_Column +import project.Data.Blank_Selector.Blank_Selector import project.Data.Column.Column import project.Data.Position.Position import project.Data.Set_Mode.Set_Mode @@ -196,14 +197,15 @@ type Table_Column_Helper completely blank or have some blanks. Arguments: - - when_any: By default, only columns consisting of all blank cells are - selected. If set to `True`, columns with one or more blank values are + -TODO docs + - when: By default, only columns consisting of all blank cells are + selected. If set to Blank_Selector.Any_Cell_Blank, columns with one or more blank values are selected. - treat_nans_as_blank: If `True`, then `Number.nan` is considered as blank. - invert_selection: If `True`, then the selection is inverted. - select_blank_columns_helper : Boolean -> Boolean -> Boolean -> Vector - select_blank_columns_helper self when_any:Boolean treat_nans_as_blank:Boolean invert_selection:Boolean=False = + select_blank_columns_helper : Blank_Selector -> Boolean -> Boolean -> Vector + select_blank_columns_helper self (when:Blank_Selector = Blank_Selector.All_Cells_Blank) treat_nans_as_blank:Boolean invert_selection:Boolean=False = blanks = self.internal_columns.map_with_index ix-> internal_column-> column = self.make_column internal_column blank_indicator = column.is_blank treat_nans_as_blank @@ -222,7 +224,9 @@ type Table_Column_Helper just_indicators = table_with_blank_indicators.select_columns (blanks.map .name) on_problems=Problem_Behavior.Report_Error # Maximum is equivalent to Exists and Minimum is equivalent to Forall. - col_aggregate = if when_any then Aggregate_Column.Maximum _ else Aggregate_Column.Minimum _ + col_aggregate = case when of + Blank_Selector.Any_Cell_Blank -> Aggregate_Column.Maximum _ + Blank_Selector.All_Cells_Blank -> Aggregate_Column.Minimum _ aggregates = blanks.map blanks_col-> col_aggregate blanks_col.name aggregate_result = just_indicators.aggregate aggregates on_problems=Problem_Behavior.Report_Error @@ -440,14 +444,15 @@ resolve_order_by internal_columns column_selectors problem_builder = ## PRIVATE A helper method gathering the common logic for constructing expressions that can filter out blank rows. -filter_blank_rows : Table -> Boolean -> Boolean -> Table -filter_blank_rows table when_any treat_nans_as_blank = +filter_blank_rows : Table -> Blank_Selector -> Boolean -> Table +filter_blank_rows table when treat_nans_as_blank = cols = table.columns case cols.not_empty of True -> - merge = if when_any then (||) else (&&) - missing_mask = cols.map (_.is_blank treat_nans_as_blank) . reduce col1-> col2-> - merge col1 col2 . rename "blank_indicator" + merge = case when of + Blank_Selector.Any_Cell_Blank -> (||) + Blank_Selector.All_Cells_Blank -> (&&) + missing_mask = cols.map (_.is_blank treat_nans_as_blank) . reduce merge non_missing_mask = missing_mask.not table.filter non_missing_mask Filter_Condition.Is_True False -> table diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Main.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Main.enso index 16711b8c2e4a..486b2b102c79 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Main.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Main.enso @@ -2,6 +2,7 @@ from Standard.Base import all import project.Data.Aggregate_Column.Aggregate_Column import project.Data.Calculations.Column_Operation.Column_Operation +import project.Data.Blank_Selector.Blank_Selector import project.Data.Column.Column import project.Data.Column_Ref.Column_Ref import project.Data.Column_Vector_Extensions @@ -31,6 +32,7 @@ from project.Extensions.Table_Conversions import all export project.Data.Aggregate_Column.Aggregate_Column export project.Data.Calculations.Column_Operation.Column_Operation +export project.Data.Blank_Selector.Blank_Selector export project.Data.Column.Column export project.Data.Column_Ref.Column_Ref export project.Data.Column_Vector_Extensions diff --git a/test/Table_Tests/src/Common_Table_Operations/Missing_Values_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Missing_Values_Spec.enso index 51bd2fd7cf9a..458874e4c860 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Missing_Values_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Missing_Values_Spec.enso @@ -1,6 +1,6 @@ from Standard.Base import all -from Standard.Table import Value_Type, Column_Ref, Previous_Value +from Standard.Table import Value_Type, Column_Ref, Previous_Value, Blank_Selector from Standard.Table.Data.Aggregate_Column.Aggregate_Column import Count_Distinct from Standard.Table.Errors import all @@ -29,14 +29,14 @@ spec setup = table_builder [a, b, c, d, e, f] Test.specify "filter_blank_rows should drop rows that contain at least one missing cell" <| - d = t0.filter_blank_rows when_any=True + d = t0.filter_blank_rows when=Blank_Selector.Any_Cell_Blank d.row_count . should_equal 1 d.at "a" . to_vector . should_equal [5] d.at "b" . to_vector . should_equal [False] d.at "c" . to_vector . should_equal [" "] Test.specify "filter_blank_rows should drop rows that are all blank" <| - d2 = t0.filter_blank_rows when_any=False + d2 = t0.filter_blank_rows when=Blank_Selector.All_Cells_Blank d2.at "a" . to_vector . should_equal [0, 1, Nothing, 42, 5] d2.at "b" . to_vector . should_equal [True, Nothing, True, False, False] d2.at "c" . to_vector . should_equal ["", "foo", "bar", Nothing, " "] @@ -49,12 +49,12 @@ spec setup = t1.row_count . should_equal 3 t1.at "X" . to_vector . should_equal [Nothing, Nothing, Nothing] - t2 = t1.filter_blank_rows when_any=True + t2 = t1.filter_blank_rows when=Blank_Selector.Any_Cell_Blank t2.row_count . should_equal 0 t2.at "X" . to_vector . should_equal [] t3 = table_builder [["X", ["", "", Nothing]]] - t4 = t3.filter_blank_rows when_any=False + t4 = t3.filter_blank_rows when=Blank_Selector.All_Cells_Blank t4.row_count . should_equal 0 t4.at "X" . to_vector . should_equal [] @@ -72,7 +72,7 @@ spec setup = r1.columns.map .name . should_equal ["f"] r1.at "f" . to_vector . should_equal [Nothing, "", Nothing, ""] - r2 = t1.select_blank_columns when_any=True + r2 = t1.select_blank_columns when=Blank_Selector.Any_Cell_Blank r2.columns.map .name . should_equal ["a", "b", "d", "e", "f"] r2.at "d" . to_vector . should_equal [Nothing, True, False, True] @@ -81,7 +81,7 @@ spec setup = r1.columns.map .name . should_equal ["a", "b", "c", "d", "e"] r1.at "a" . to_vector . should_equal [1, Nothing, 3, 4] - r2 = t1.remove_blank_columns when_any=True + r2 = t1.remove_blank_columns when=Blank_Selector.Any_Cell_Blank r2.columns.map .name . should_equal ["c"] r2.at "c" . to_vector . should_equal [10, 20, 30, 40] @@ -93,12 +93,12 @@ spec setup = table_builder [c, g, h] if test_selection.is_nan_and_nothing_distinct then Test.specify "should not treat NaNs as blank by default" <| - r1 = t3.filter_blank_rows when_any=True + r1 = t3.filter_blank_rows when=Blank_Selector.Any_Cell_Blank # We cannot use `Vector.==` because `NaN != NaN`. r1.at "X" . to_vector . to_text . should_equal "[1.5, NaN]" r1.at "Y" . to_vector . should_equal [2.0, 5.0] - r2 = t3.filter_blank_rows when_any=False + r2 = t3.filter_blank_rows when=Blank_Selector.All_Cells_Blank r2.at "X" . to_vector . to_text . should_equal "[2.0, 1.5, NaN, NaN]" r2.at "Y" . to_vector . should_equal [Nothing, 2.0, Nothing, 5.0] @@ -106,37 +106,37 @@ spec setup = r3.columns.map .name . should_equal ["c", "g", "h"] r3.at "g" . to_vector . to_text . should_equal "[NaN, 1.0, 2.0, 3.4]" - r4 = t4.remove_blank_columns when_any=True + r4 = t4.remove_blank_columns when=Blank_Selector.Any_Cell_Blank r4.columns.map .name . should_equal ["c", "g"] r4.at "g" . to_vector . to_text . should_equal "[NaN, 1.0, 2.0, 3.4]" - r5 = t4.select_blank_columns when_any=True + r5 = t4.select_blank_columns when=Blank_Selector.Any_Cell_Blank r5.columns.map .name . should_equal ["h"] r5.at "h" . to_vector . to_text . should_equal "[NaN, Nothing, NaN, Nothing]" Test.specify "should allow to treat NaNs as blank if asked" <| - r1 = t3.filter_blank_rows when_any=True treat_nans_as_blank=True + r1 = t3.filter_blank_rows when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=True # We cannot use `Vector.==` because `NaN != NaN`. r1.at "X" . to_vector . should_equal [1.5] r1.at "Y" . to_vector . should_equal [2.0] - r2 = t3.filter_blank_rows when_any=False treat_nans_as_blank=True + r2 = t3.filter_blank_rows when=Blank_Selector.All_Cells_Blank treat_nans_as_blank=True r2.at "X" . to_vector . to_text . should_equal "[2.0, 1.5, NaN]" r2.at "Y" . to_vector . should_equal [Nothing, 2.0, 5.0] - r3 = t4.remove_blank_columns when_any=False treat_nans_as_blank=True + r3 = t4.remove_blank_columns when=Blank_Selector.All_Cells_Blank treat_nans_as_blank=True r3.columns.map .name . should_equal ["c", "g"] r3.at "g" . to_vector . to_text . should_equal "[NaN, 1.0, 2.0, 3.4]" - r4 = t4.select_blank_columns when_any=False treat_nans_as_blank=True + r4 = t4.select_blank_columns when=Blank_Selector.All_Cells_Blank treat_nans_as_blank=True r4.columns.map .name . should_equal ["h"] r4.at "h" . to_vector . to_text . should_equal "[NaN, Nothing, NaN, Nothing]" - r5 = t4.remove_blank_columns when_any=True treat_nans_as_blank=True + r5 = t4.remove_blank_columns when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=True r5.columns.map .name . should_equal ["c"] r5.at "c" . to_vector . should_equal [10, 20, 40, 30] - r6 = t4.select_blank_columns when_any=True treat_nans_as_blank=True + r6 = t4.select_blank_columns when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=True r6.columns.map .name . should_equal ["g", "h"] r6.at "h" . to_vector . to_text . should_equal "[NaN, Nothing, NaN, Nothing]" diff --git a/test/Table_Tests/src/Database/Codegen_Spec.enso b/test/Table_Tests/src/Database/Codegen_Spec.enso index ab271472dcf9..e3357bf6fa6d 100644 --- a/test/Table_Tests/src/Database/Codegen_Spec.enso +++ b/test/Table_Tests/src/Database/Codegen_Spec.enso @@ -1,7 +1,7 @@ from Standard.Base import all import Standard.Base.Errors.Illegal_State.Illegal_State -from Standard.Table import Sort_Column, Value_Type +from Standard.Table import Sort_Column, Value_Type, Blank_Selector from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last from Standard.Table.Errors import No_Input_Columns_Selected, Missing_Input_Columns, No_Such_Column @@ -81,10 +81,10 @@ spec = c.to_sql.prepare . should_equal ['SELECT CAST(COALESCE("T1"."B", ?) AS TEXT) AS "B" FROM "T1" AS "T1"', ["not-applicable"]] Test.specify "filter_blank_rows should drop rows that contain at least one missing column in a Table" <| - t2 = t1.filter_blank_rows when_any=True + t2 = t1.filter_blank_rows when=Blank_Selector.Any_Cell_Blank t2.to_sql.prepare . should_equal ['SELECT "T1"."A" AS "A", "T1"."B" AS "B", "T1"."C" AS "C" FROM "T1" AS "T1" WHERE (NOT ((("T1"."A" IS NULL) OR (("T1"."B" IS NULL) OR ("T1"."B" = \'\'))) OR ("T1"."C" IS NULL)))', []] - t3 = t1.filter_blank_rows when_any=False + t3 = t1.filter_blank_rows when=Blank_Selector.All_Cells_Blank t3.to_sql.prepare . should_equal ['SELECT "T1"."A" AS "A", "T1"."B" AS "B", "T1"."C" AS "C" FROM "T1" AS "T1" WHERE (NOT ((("T1"."A" IS NULL) AND (("T1"."B" IS NULL) OR ("T1"."B" = \'\'))) AND ("T1"."C" IS NULL)))', []] Test.group "[Codegen] Sorting" <| diff --git a/test/Table_Tests/src/In_Memory/Table_Spec.enso b/test/Table_Tests/src/In_Memory/Table_Spec.enso index 5f166d0932ca..698873f13648 100644 --- a/test/Table_Tests/src/In_Memory/Table_Spec.enso +++ b/test/Table_Tests/src/In_Memory/Table_Spec.enso @@ -4,7 +4,7 @@ import Standard.Base.Errors.Common.Index_Out_Of_Bounds import Standard.Base.Errors.Common.Type_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument -from Standard.Table import Table, Column, Sort_Column, Aggregate_Column +from Standard.Table import Table, Column, Sort_Column, Aggregate_Column, Blank_Selector from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last import Standard.Table.Data.Type.Value_Type.Value_Type from Standard.Table.Errors import Invalid_Column_Names, Duplicate_Output_Column_Names, No_Input_Columns_Selected, Missing_Input_Columns, No_Such_Column, Floating_Point_Equality, Invalid_Value_Type, Row_Count_Mismatch @@ -305,7 +305,7 @@ spec = Test.group "Dropping Missing Values" <| Test.specify "should correctly handle NaNs with mixed type columns" <| t = Table.new [["X", [1, 2, 3, 4, 5]], ["Y", ["A", "", Nothing, Number.nan, 0]]] - t1 = t.filter_blank_rows when_any=True treat_nans_as_blank=False + t1 = t.filter_blank_rows when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=False t1.at "X" . to_vector . should_equal [1, 4, 5] # Comparing text value because `Number.nan != Number.nan`. t1.at "Y" . to_vector . to_text . should_equal "[A, NaN, 0]" @@ -314,7 +314,7 @@ spec = c.to_vector . should_equal [False, True, True, True, False] c.value_type . should_equal Value_Type.Boolean - t2 = t.filter_blank_rows when_any=True treat_nans_as_blank=True + t2 = t.filter_blank_rows when=Blank_Selector.Any_Cell_Blank treat_nans_as_blank=True t2.at "X" . to_vector . should_equal [1, 5] t2.at "Y" . to_vector . should_equal ['A', 0]