nodes: 0, module; 1, function_definition; 2, function_name:unique_categories; 3, parameters; 4, block; 5, identifier:categories; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Pass array-like categories, return sorted cleaned unique categories."""; 12, assignment; 13, assignment; 14, assignment; 15, identifier:categories; 16, identifier:categories; 17, call; 18, identifier:categories; 19, call; 20, identifier:categories; 21, call; 22, attribute; 23, argument_list; 24, attribute; 25, argument_list; 26, attribute; 27, argument_list; 28, identifier:np; 29, identifier:unique; 30, identifier:categories; 31, identifier:np; 32, identifier:setdiff1d; 33, identifier:categories; 34, call; 35, identifier:np; 36, identifier:array; 37, call; 38, attribute; 39, argument_list; 40, identifier:natsorted; 41, argument_list; 42, identifier:np; 43, identifier:array; 44, attribute; 45, identifier:categories; 46, keyword_argument; 47, identifier:settings; 48, identifier:categories_to_ignore; 49, identifier:key; 50, lambda; 51, lambda_parameters; 52, call; 53, identifier:v; 54, attribute; 55, argument_list; 56, identifier:v; 57, identifier:upper
code: def unique_categories(categories):
      """Pass array-like categories, return sorted cleaned unique categories."""
      categories = np.unique(categories)
      categories = np.setdiff1d(categories, np.array(settings.categories_to_ignore))
      categories = np.array(natsorted(categories, key=lambda v: v.upper()))
      return categories