nodes: 0, module; 1, function_definition; 2, function_name:unique; 3, parameters; 4, block; 5, identifier:values; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, comment:"""
      Hash table-based unique. Uniques are returned in order
      of appearance. This does NOT sort.
  
      Significantly faster than numpy.unique. Includes NA values.
  
      Parameters
      ----------
      values : 1d array-like
  
      Returns
      -------
      numpy.ndarray or ExtensionArray
  
          The return can be:
  
          * Index : when the input is an Index
          * Categorical : when the input is a Categorical dtype
          * ndarray : when the input is a Series/ndarray
  
          Return numpy.ndarray or ExtensionArray.
  
      See Also
      --------
      Index.unique
      Series.unique
  
      Examples
      --------
      >>> pd.unique(pd.Series([2, 1, 3, 3]))
      array([2, 1, 3])
  
      >>> pd.unique(pd.Series([2] + [1] * 5))
      array([2, 1])
  
      >>> pd.unique(pd.Series([pd.Timestamp('20160101'),
      ...                     pd.Timestamp('20160101')]))
      array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
  
      >>> pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
      ...                      pd.Timestamp('20160101', tz='US/Eastern')]))
      array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')],
            dtype=object)
  
      >>> pd.unique(pd.Index([pd.Timestamp('20160101', tz='US/Eastern'),
      ...                     pd.Timestamp('20160101', tz='US/Eastern')]))
      DatetimeIndex(['2016-01-01 00:00:00-05:00'],
      ...           dtype='datetime64[ns, US/Eastern]', freq=None)
  
      >>> pd.unique(list('baabc'))
      array(['b', 'a', 'c'], dtype=object)
  
      An unordered Categorical will return categories in the
      order of appearance.
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'))))
      [b, a, c]
      Categories (3, object): [b, a, c]
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
      ...                                    categories=list('abc'))))
      [b, a, c]
      Categories (3, object): [b, a, c]
  
      An ordered Categorical preserves the category ordering.
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
      ...                                    categories=list('abc'),
      ...                                    ordered=True)))
      [b, a, c]
      Categories (3, object): [a < b < c]
  
      An array of tuples
  
      >>> pd.unique([('a', 'b'), ('b', 'a'), ('a', 'c'), ('b', 'a')])
      array([('a', 'b'), ('b', 'a'), ('a', 'c')], dtype=object)
      """; 16, assignment; 17, call; 18, comment:# Dispatch to extension dtype's unique.; 19, block; 20, assignment; 21, assignment; 22, assignment; 23, assignment; 24, assignment; 25, identifier:uniques; 26, identifier:values; 27, call; 28, identifier:is_extension_array_dtype; 29, argument_list; 30, return_statement; 31, identifier:original; 32, identifier:values; 33, pattern_list; 34, call; 35, identifier:table; 36, call; 37, identifier:uniques; 38, call; 39, identifier:uniques; 40, call; 41, identifier:_ensure_arraylike; 42, argument_list; 43, identifier:values; 44, call; 45, identifier:htable; 46, identifier:_; 47, identifier:values; 48, identifier:dtype; 49, identifier:ndtype; 50, identifier:_get_hashtable_algo; 51, argument_list; 52, identifier:htable; 53, argument_list; 54, attribute; 55, argument_list; 56, identifier:_reconstruct_data; 57, argument_list; 58, identifier:values; 59, attribute; 60, argument_list; 61, identifier:values; 62, call; 63, identifier:table; 64, identifier:unique; 65, identifier:values; 66, identifier:uniques; 67, identifier:dtype; 68, identifier:original; 69, identifier:values; 70, identifier:unique; 71, identifier:len; 72, argument_list; 73, identifier:values
code: def unique(values):
      """
      Hash table-based unique. Uniques are returned in order
      of appearance. This does NOT sort.
  
      Significantly faster than numpy.unique. Includes NA values.
  
      Parameters
      ----------
      values : 1d array-like
  
      Returns
      -------
      numpy.ndarray or ExtensionArray
  
          The return can be:
  
          * Index : when the input is an Index
          * Categorical : when the input is a Categorical dtype
          * ndarray : when the input is a Series/ndarray
  
          Return numpy.ndarray or ExtensionArray.
  
      See Also
      --------
      Index.unique
      Series.unique
  
      Examples
      --------
      >>> pd.unique(pd.Series([2, 1, 3, 3]))
      array([2, 1, 3])
  
      >>> pd.unique(pd.Series([2] + [1] * 5))
      array([2, 1])
  
      >>> pd.unique(pd.Series([pd.Timestamp('20160101'),
      ...                     pd.Timestamp('20160101')]))
      array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
  
      >>> pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
      ...                      pd.Timestamp('20160101', tz='US/Eastern')]))
      array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')],
            dtype=object)
  
      >>> pd.unique(pd.Index([pd.Timestamp('20160101', tz='US/Eastern'),
      ...                     pd.Timestamp('20160101', tz='US/Eastern')]))
      DatetimeIndex(['2016-01-01 00:00:00-05:00'],
      ...           dtype='datetime64[ns, US/Eastern]', freq=None)
  
      >>> pd.unique(list('baabc'))
      array(['b', 'a', 'c'], dtype=object)
  
      An unordered Categorical will return categories in the
      order of appearance.
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'))))
      [b, a, c]
      Categories (3, object): [b, a, c]
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
      ...                                    categories=list('abc'))))
      [b, a, c]
      Categories (3, object): [b, a, c]
  
      An ordered Categorical preserves the category ordering.
  
      >>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
      ...                                    categories=list('abc'),
      ...                                    ordered=True)))
      [b, a, c]
      Categories (3, object): [a < b < c]
  
      An array of tuples
  
      >>> pd.unique([('a', 'b'), ('b', 'a'), ('a', 'c'), ('b', 'a')])
      array([('a', 'b'), ('b', 'a'), ('a', 'c')], dtype=object)
      """
  
      values = _ensure_arraylike(values)
  
      if is_extension_array_dtype(values):
          # Dispatch to extension dtype's unique.
          return values.unique()
  
      original = values
      htable, _, values, dtype, ndtype = _get_hashtable_algo(values)
  
      table = htable(len(values))
      uniques = table.unique(values)
      uniques = _reconstruct_data(uniques, dtype, original)
      return uniques