Repository: pyjanitor-devs/pyjanitor

Issue:
[DOC] Add factorize_columns and drop_constant_columns to the API index
- `factorize_columns` and `drop_constant_columns` are missing from the API index. This functions were created in #850 and #852 respectively.


Discussion:

Resolving patch:
diff --git a/janitor/functions.py b/janitor/functions.py
--- a/janitor/functions.py
+++ b/janitor/functions.py
@@ -324,7 +324,6 @@ def clean_names(
         df = df.rename(columns=_strip_accents)
 
     df = df.rename(columns=lambda x: re.sub("_+", "_", x))  # noqa: PD005
-
     df = _strip_underscores(df, strip_underscores)
 
     df = df.rename(columns=lambda x: x[:truncate_limit])
@@ -337,7 +336,6 @@ def clean_names(
 
 def _change_case(col: str, case_type: str) -> str:
     """Change case of a column name."""
-
     case_types = ["preserve", "upper", "lower", "snake"]
     if case_type.lower() not in case_types:
         raise JanitorError(f"case_type must be one of: {case_types}")
@@ -355,7 +353,6 @@ def _change_case(col: str, case_type: str) -> str:
 
 def _remove_special(col_name: Hashable) -> str:
     """Remove special characters from column name."""
-
     return "".join(
         item for item in str(col_name) if item.isalnum() or "_" in item
     )
@@ -380,7 +377,6 @@ def _camel2snake(col_name: str) -> str:
 
 def _normalize_1(col_name: Hashable) -> str:
     """Perform normalization of column name."""
-
     result = str(col_name)
     for search, replace in FIXES:
         result = re.sub(search, replace, result)  # noqa: PD005
@@ -2523,7 +2519,7 @@ def row_to_names(
         df = df.drop(df.index[range(row_number)])
 
     if reset_index:
-        df.reset_index(drop=["index"], inplace=True)
+        df = df.reset_index(drop=["index"])
 
     return df
 
@@ -5617,7 +5613,6 @@ def complete(
     Let's get all the missing years per state::
 
         df.complete(
-
             columns = [{'year': new_year_values}],
             by='state'
         )


Test patch:
diff --git a/tests/functions/test_clean_names.py b/tests/functions/test_clean_names.py
--- a/tests/functions/test_clean_names.py
+++ b/tests/functions/test_clean_names.py
@@ -193,7 +193,7 @@ def test_charac():
 
     df = df.clean_names(strip_underscores=True, case_type="lower")
 
-    assert "current_accountbalance_in_%_of_gdp" in df.columns.values
+    assert "current_accountbalance_in_%_of_gdp" in df.columns
 
 
 @pytest.mark.functions
@@ -205,4 +205,4 @@ def test_space():
 
     df = df.clean_names(strip_underscores=True, case_type="lower")
 
-    assert ("in %" in df.columns.values) is False
+    assert ("in %" in df.columns) is False
diff --git a/tests/functions/test_convert_excel_date.py b/tests/functions/test_convert_excel_date.py
--- a/tests/functions/test_convert_excel_date.py
+++ b/tests/functions/test_convert_excel_date.py
@@ -29,4 +29,4 @@ def test_convert_excel_date_with_string_data():
     ).clean_names()
 
     with pytest.raises(ValueError):
-        df.convert_excel_date("hire_date_str")
+        df.convert_excel_date("certification")
diff --git a/tests/test_df_registration.py b/tests/test_df_registration.py
--- a/tests/test_df_registration.py
+++ b/tests/test_df_registration.py
@@ -124,3 +124,8 @@ def test_change_type_registration(dataframe):
 def test_filter_date_registration(dataframe):
     """Test if DataFrame has filter_date method"""
     assert dataframe.__getattr__("filter_date")
+
+
+def test_drop_constant_columns_registration(dataframe):
+    """Test if DataFrame has drop_constant_columns method"""
+    assert dataframe.__getattr__("drop_constant_columns")