def insert(self, loc, item):
code = self.categories.get_indexer([item])<EOL>if (code == -<NUM_LIT:1>) and not (is_scalar(item) and isna(item)):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>codes = self.codes<EOL>codes = np.concatenate((codes[:loc], code, codes[loc:]))<EOL>return self._create_from_codes(codes)<EOL>
Make new Index inserting new item at location. Follows
Python list.append semantics for negative values

Parameters
----------
loc : int
item : object

Returns
-------
new_index : Index

Raises
------
ValueError if the item is not in the categories