Repository: pandas-dev/pandas

Issue:
CLN/DEPR: Undocumented, old helper functions
There are some old, undocumented functions that exist in public namespaces that were maybe useful some time ago. Since these are not hidden in private namespaces, should these function undergo the normal depreciation processes?

https://github.com/pandas-dev/pandas/blob/da6e26db079cd4050c1693939db6a52afb2978e1/pandas/core/reshape/util.py#L10

https://github.com/pandas-dev/pandas/blob/da6e26db079cd4050c1693939db6a52afb2978e1/pandas/core/tools/datetimes.py#L863

https://github.com/pandas-dev/pandas/blob/da6e26db079cd4050c1693939db6a52afb2978e1/pandas/core/tools/datetimes.py#L855

https://github.com/pandas-dev/pandas/blob/da6e26db079cd4050c1693939db6a52afb2978e1/pandas/core/reshape/reshape.py#L411

https://github.com/pandas-dev/pandas/blob/da6e26db079cd4050c1693939db6a52afb2978e1/pandas/core/reshape/reshape.py#L451



Discussion:

Resolving patch:
diff --git a/pandas/core/reshape/util.py b/pandas/core/reshape/util.py
--- a/pandas/core/reshape/util.py
+++ b/pandas/core/reshape/util.py
@@ -3,16 +3,9 @@
 from pandas.core.dtypes.common import is_list_like
 
 from pandas.compat import reduce
-from pandas.core.index import Index
 from pandas.core import common as com
 
 
-def match(needles, haystack):
-    haystack = Index(haystack)
-    needles = Index(needles)
-    return haystack.get_indexer(needles)
-
-
 def cartesian_product(X):
     """
     Numpy version of itertools.product or pandas.compat.product.
diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py
--- a/pandas/core/tools/datetimes.py
+++ b/pandas/core/tools/datetimes.py
@@ -1,5 +1,5 @@
 from functools import partial
-from datetime import datetime, timedelta, time
+from datetime import datetime, time
 from collections import MutableMapping
 
 import numpy as np
@@ -850,24 +850,3 @@ def _convert_listlike(arg, format):
         return _convert_listlike(arg, format)
 
     return _convert_listlike(np.array([arg]), format)[0]
-
-
-def format(dt):
-    """Returns date in YYYYMMDD format."""
-    return dt.strftime('%Y%m%d')
-
-
-OLE_TIME_ZERO = datetime(1899, 12, 30, 0, 0, 0)
-
-
-def ole2datetime(oledt):
-    """function for converting excel date to normal date format"""
-    val = float(oledt)
-
-    # Excel has a bug where it thinks the date 2/29/1900 exists
-    # we just reject any date before 3/1/1900.
-    if val < 61:
-        msg = "Value is outside of acceptable range: {value}".format(value=val)
-        raise ValueError(msg)
-
-    return OLE_TIME_ZERO + timedelta(days=val)


Test patch:
diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py
--- a/pandas/tests/io/test_sql.py
+++ b/pandas/tests/io/test_sql.py
@@ -36,7 +36,6 @@
 from pandas import date_range, to_datetime, to_timedelta, Timestamp
 import pandas.compat as compat
 from pandas.compat import range, lrange, string_types, PY36
-from pandas.core.tools.datetimes import format as date_format
 
 import pandas.io.sql as sql
 from pandas.io.sql import read_sql_table, read_sql_query
@@ -2094,6 +2093,11 @@ def test_illegal_names(self):
 # -- Old tests from 0.13.1 (before refactor using sqlalchemy)
 
 
+def date_format(dt):
+    """Returns date in YYYYMMDD format."""
+    return dt.strftime('%Y%m%d')
+
+
 _formatters = {
     datetime: lambda dt: "'%s'" % date_format(dt),
     str: lambda x: "'%s'" % x,
diff --git a/pandas/tests/tseries/offsets/test_offsets.py b/pandas/tests/tseries/offsets/test_offsets.py
--- a/pandas/tests/tseries/offsets/test_offsets.py
+++ b/pandas/tests/tseries/offsets/test_offsets.py
@@ -29,7 +29,6 @@
                                     QuarterEnd, BusinessMonthEnd, FY5253,
                                     Nano, Easter, FY5253Quarter,
                                     LastWeekOfMonth, Tick)
-from pandas.core.tools.datetimes import format, ole2datetime
 import pandas.tseries.offsets as offsets
 from pandas.io.pickle import read_pickle
 from pandas._libs.tslibs import timezones
@@ -45,19 +44,6 @@
 ####
 
 
-def test_format():
-    actual = format(datetime(2008, 1, 15))
-    assert actual == '20080115'
-
-
-def test_ole2datetime():
-    actual = ole2datetime(60000)
-    assert actual == datetime(2064, 4, 8)
-
-    with pytest.raises(ValueError):
-        ole2datetime(60)
-
-
 def test_to_m8():
     valb = datetime(2007, 10, 1)
     valu = _to_m8(valb)