#NEWLINE# def add_categories( self , new_categories , inplace = False ) : #NEWLINE# #INDENT# ' Add new categories.\n\n        `new_categories` will be included at the last/highest place in the\n        categories and will be unused directly after this call.\n\n        Raises\n        ------\n        ValueError\n            If the new categories include old categories or do not validate as\n            categories\n\n        Parameters\n        ----------\n        new_categories : category or list-like of category\n           The new categories to be included.\n        inplace : boolean (default: False)\n           Whether or not to add the categories inplace or return a copy of\n           this categorical with added categories.\n\n        Returns\n        -------\n        cat : Categorical with new categories added or None if inplace.\n\n        See also\n        --------\n        rename_categories\n        reorder_categories\n        remove_categories\n        remove_unused_categories\n        set_categories\n        ' #NEWLINE# if ( not is_list_like ( new_categories ) ) : #NEWLINE# #INDENT# new_categories = [ new_categories ] #NEWLINE# #UNINDENT# already_included = ( set ( new_categories ) & set ( self . _categories ) ) #NEWLINE# if ( len ( already_included ) != 0 ) : #NEWLINE# #INDENT# msg = ( 'new categories must not include old categories: %s' % str ( already_included ) ) #NEWLINE# raise ValueError ( msg ) #NEWLINE# #UNINDENT# new_categories = ( list ( self . _categories ) + list ( new_categories ) ) #NEWLINE# cat = ( self if inplace else self . copy ( ) ) #NEWLINE# cat . _categories = self . _validate_categories ( new_categories ) #NEWLINE# cat . _codes = _coerce_indexer_dtype ( cat . _codes , new_categories ) #NEWLINE# if ( not inplace ) : #NEWLINE# #INDENT# return cat