From cd04309716b4e55306358cecf90264771637bcb5 Mon Sep 17 00:00:00 2001 From: samukweku Date: Thu, 28 Sep 2023 08:37:47 +1000 Subject: [PATCH] remove _clean_accounting_column --- .../functions/currency_column_to_numeric.py | 23 ------------------- tests/utils/test_clean_accounting_column.py | 17 -------------- 2 files changed, 40 deletions(-) delete mode 100644 tests/utils/test_clean_accounting_column.py diff --git a/janitor/functions/currency_column_to_numeric.py b/janitor/functions/currency_column_to_numeric.py index 0e6cda39f..1194caa06 100644 --- a/janitor/functions/currency_column_to_numeric.py +++ b/janitor/functions/currency_column_to_numeric.py @@ -136,29 +136,6 @@ def currency_column_to_numeric( return df -def _clean_accounting_column(x: str) -> float: - """Perform the logic for the "accounting" cleaning style. - - This is a private function, not intended to be used outside of - `currency_column_to_numeric``. - - It is intended to be used in a pandas `apply` method. - - Args: - x: A string representing currency. - - Returns: - A float representing currency. - """ - y = x.strip() - y = y.replace(",", "") - y = y.replace(")", "") - y = y.replace("(", "-") - if y == "-": - return 0.00 - return float(y) - - def _currency_column_to_numeric( x: str, cast_non_numeric: Optional[dict] = None, diff --git a/tests/utils/test_clean_accounting_column.py b/tests/utils/test_clean_accounting_column.py deleted file mode 100644 index e48685fdd..000000000 --- a/tests/utils/test_clean_accounting_column.py +++ /dev/null @@ -1,17 +0,0 @@ -import pytest - -from janitor.functions.currency_column_to_numeric import ( - _clean_accounting_column, -) - - -@pytest.mark.utils -def test_clean_accounting_column(): - test_str = "(1,000)" - assert _clean_accounting_column(test_str) == float(-1000) - - -@pytest.mark.utils -def test_clean_accounting_column_zeroes(): - test_str = "()" - assert _clean_accounting_column(test_str) == 0.00