from __future__ import absolute_import

from distutils.version import LooseVersion

import numpy as np
import pandas


version = LooseVersion(pandas.__version__)

if version >= LooseVersion('0.17.0'):
    def sort_values(df, *args, **kwargs):
        return df.sort_values(*args, **kwargs)
else:
    def sort_values(df, *args, **kwargs):
        # always set inplace with 'False' as default
        kwargs.setdefault('inplace', False)
        return df.sort(*args, **kwargs)

try:
    from pandas import RangeIndex
except ImportError:
    RangeIndex = tuple()

# Float64Index introduced in Pandas 0.13.0
try:
    from pandas import Float64Index
except:
    Float64Index = tuple()

try:
    from pandas.api.types import is_numeric_dtype
except ImportError:
    try:
        from pandas.core.common import is_numeric_dtype
    except ImportError:
        # Pandas <= 0.14
        def is_numeric_dtype(arr_or_dtype):
            # Crude implementation only suitable for array-like types
            try:
                tipo = arr_or_dtype.dtype.type
            except AttributeError:
                tipo = type(None)
            return (issubclass(tipo, (np.number, np.bool_)) and
                    not issubclass(tipo, (np.datetime64, np.timedelta64)))

if version >= '0.20':
    from pandas.tseries import frequencies
    data_klasses = (pandas.Series, pandas.DataFrame, pandas.Panel)
else:
    try:
        import pandas.tseries.frequencies as frequencies
    except ImportError:
        from pandas.core import datetools as frequencies  # noqa

    data_klasses = (pandas.Series, pandas.DataFrame, pandas.Panel,
                    pandas.WidePanel)

@@ -88,33 +88,71 @@
 ort 
-numpy as np%0Aimport pandas
+pandas%0Afrom pandas import RangeIndex, Float64Index  # noqa:F401
 %0A%0A%0Av
@@ -198,50 +198,9 @@
 _)%0A%0A
-if version %3E= LooseVersion('0.17.0'):%0A    
+%0A
 def 
@@ -233,28 +233,24 @@
 wargs):%0A    
-  
-  
 return df.so
@@ -280,397 +280,8 @@
 gs)%0A
-else:%0A    def sort_values(df, *args, **kwargs):%0A        # always set inplace with 'False' as default%0A        kwargs.setdefault('inplace', False)%0A        return df.sort(*args, **kwargs)%0A%0Atry:%0A    from pandas import RangeIndex%0Aexcept ImportError:%0A    RangeIndex = tuple()%0A%0A# Float64Index introduced in Pandas 0.13.0%0Atry:%0A    from pandas import Float64Index%0Aexcept:%0A    Float64Index = tuple()
 %0A%0Atr
@@ -332,16 +332,29 @@
 ic_dtype
+  # noqa:F401
 %0Aexcept 
@@ -366,29 +366,16 @@
 tError:%0A
-    try:%0A    
     from
@@ -421,443 +421,21 @@
 type
-%0A    except ImportError:%0A        # Pandas %3C= 0.14%0A        def is_numeric_dtype(arr_or_dtype):%0A            # Crude implementation only suitable for array-like types%0A            try:%0A                tipo = arr_or_dtype.dtype.type%0A            except AttributeError:%0A                tipo = type(None)%0A            return (issubclass(tipo, (np.number, np.bool_)) and%0A                    not issubclass(tipo, (np.datetime64, np.timedelta64)))
+  # noqa:F401
 %0A%0Aif

remove unused pandas shims