def select_dtypes(self, include=None, exclude=None):
def _get_info_slice(obj, indexer):<EOL><INDENT>"""<STR_LIT>"""<EOL>if not hasattr(obj, '<STR_LIT>'):<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise TypeError(msg.format(typ=type(obj).__name__))<EOL><DEDENT>slices = [slice(None)] * obj.ndim<EOL>slices[obj._info_axis_number] = indexer<EOL>return tuple(slices)<EOL><DEDENT>if not is_list_like(include):<EOL><INDENT>include = (include,) if include is not None else ()<EOL><DEDENT>if not is_list_like(exclude):<EOL><INDENT>exclude = (exclude,) if exclude is not None else ()<EOL><DEDENT>selection = tuple(map(frozenset, (include, exclude)))<EOL>if not any(selection):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>include, exclude = map(<EOL>lambda x: frozenset(map(infer_dtype_from_object, x)), selection)<EOL>for dtypes in (include, exclude):<EOL><INDENT>invalidate_string_dtypes(dtypes)<EOL><DEDENT>if not include.isdisjoint(exclude):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(<EOL>inc_ex=(include & exclude)))<EOL><DEDENT>include_these = Series(not bool(include), index=self.columns)<EOL>exclude_these = Series(not bool(exclude), index=self.columns)<EOL>def is_dtype_instance_mapper(idx, dtype):<EOL><INDENT>return idx, functools.partial(issubclass, dtype.type)<EOL><DEDENT>for idx, f in itertools.starmap(is_dtype_instance_mapper,<EOL>enumerate(self.dtypes)):<EOL><INDENT>if include:  <EOL><INDENT>include_these.iloc[idx] = any(map(f, include))<EOL><DEDENT>if exclude:<EOL><INDENT>exclude_these.iloc[idx] = not any(map(f, exclude))<EOL><DEDENT><DEDENT>dtype_indexer = include_these & exclude_these<EOL>return self.loc[_get_info_slice(self, dtype_indexer)]<EOL>
Return a subset of the DataFrame's columns based on the column dtypes.

Parameters
----------
include, exclude : scalar or list-like
    A selection of dtypes or strings to be included/excluded. At least
    one of these parameters must be supplied.

Returns
-------
DataFrame
    The subset of the frame including the dtypes in ``include`` and
    excluding the dtypes in ``exclude``.

Raises
------
ValueError
    * If both of ``include`` and ``exclude`` are empty
    * If ``include`` and ``exclude`` have overlapping elements
    * If any kind of string dtype is passed in.

Notes
-----
* To select all *numeric* types, use ``np.number`` or ``'number'``
* To select strings you must use the ``object`` dtype, but note that
  this will return *all* object dtype columns
* See the `numpy dtype hierarchy
  <http://docs.scipy.org/doc/numpy/reference/arrays.scalars.html>`__
* To select datetimes, use ``np.datetime64``, ``'datetime'`` or
  ``'datetime64'``
* To select timedeltas, use ``np.timedelta64``, ``'timedelta'`` or
  ``'timedelta64'``
* To select Pandas categorical dtypes, use ``'category'``
* To select Pandas datetimetz dtypes, use ``'datetimetz'`` (new in
  0.20.0) or ``'datetime64[ns, tz]'``

Examples
--------
>>> df = pd.DataFrame({'a': [1, 2] * 3,
...                    'b': [True, False] * 3,
...                    'c': [1.0, 2.0] * 3})
>>> df
        a      b  c
0       1   True  1.0
1       2  False  2.0
2       1   True  1.0
3       2  False  2.0
4       1   True  1.0
5       2  False  2.0

>>> df.select_dtypes(include='bool')
   b
0  True
1  False
2  True
3  False
4  True
5  False

>>> df.select_dtypes(include=['float64'])
   c
0  1.0
1  2.0
2  1.0
3  2.0
4  1.0
5  2.0

>>> df.select_dtypes(exclude=['int'])
       b    c
0   True  1.0
1  False  2.0
2   True  1.0
3  False  2.0
4   True  1.0
5  False  2.0