Skip to content

Commit

Permalink
ensure get_index_labels is called before checks
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel.oranyeli committed Jan 9, 2024
1 parent 92665c8 commit 74293be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions janitor/functions/coalesce.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def coalesce(
This method does not mutate the original DataFrame.
The [`select`][janitor.functions.select.select] syntax
can be used in `column_names`.
Examples:
Use `coalesce` with 3 columns, "a", "b" and "c".
Expand Down Expand Up @@ -97,13 +100,13 @@ def coalesce(
if not column_names:
return df

column_names = get_index_labels([*column_names], df, axis="columns")

if len(column_names) < 2:
raise ValueError(
"The number of columns to coalesce should be a minimum of 2."
)

column_names = get_index_labels([*column_names], df, axis="columns")

if target_column_name:
check("target_column_name", target_column_name, [str])

Expand Down

0 comments on commit 74293be

Please sign in to comment.