@staticmethod<EOL><INDENT>def validate_categories(categories, fastpath=False):<DEDENT>
from pandas import Index<EOL>if not fastpath and not is_list_like(categories):<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise TypeError(msg.format(categories))<EOL><DEDENT>elif not isinstance(categories, ABCIndexClass):<EOL><INDENT>categories = Index(categories, tupleize_cols=False)<EOL><DEDENT>if not fastpath:<EOL><INDENT>if categories.hasnans:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not categories.is_unique:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>if isinstance(categories, ABCCategoricalIndex):<EOL><INDENT>categories = categories.categories<EOL><DEDENT>return categories<EOL>
Validates that we have good categories

Parameters
----------
categories : array-like
fastpath : bool
    Whether to skip nan and uniqueness checks

Returns
-------
categories : Index