@@ -1429,8 +1429,51 @@ def mode(self):
1429
1429
# TODO: Add option for bins like value_counts()
1430
1430
return algorithms .mode (self )
1431
1431
1432
- @Appender (base ._shared_docs ['unique' ] % _shared_doc_kwargs )
1433
1432
def unique (self ):
1433
+ """
1434
+ Return unique values of Series object.
1435
+
1436
+ Uniques are returned in order of appearance. Hash table-based unique,
1437
+ therefore does NOT sort.
1438
+
1439
+ Returns
1440
+ -------
1441
+ ndarray or Categorical
1442
+ The unique values returned as a NumPy array. In case of categorical
1443
+ data type, returned as a Categorical.
1444
+
1445
+ See Also
1446
+ --------
1447
+ pandas.unique : top-level unique method for any 1-d array-like object.
1448
+ Index.unique : return Index with unique values from an Index object.
1449
+
1450
+ Examples
1451
+ --------
1452
+ >>> pd.Series([2, 1, 3, 3], name='A').unique()
1453
+ array([2, 1, 3])
1454
+
1455
+ >>> pd.Series([pd.Timestamp('2016-01-01') for _ in range(3)]).unique()
1456
+ array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
1457
+
1458
+ >>> pd.Series([pd.Timestamp('2016-01-01', tz='US/Eastern')
1459
+ ... for _ in range(3)]).unique()
1460
+ array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')],
1461
+ dtype=object)
1462
+
1463
+ An unordered Categorical will return categories in the order of
1464
+ appearance.
1465
+
1466
+ >>> pd.Series(pd.Categorical(list('baabc'))).unique()
1467
+ [b, a, c]
1468
+ Categories (3, object): [b, a, c]
1469
+
1470
+ An ordered Categorical preserves the category ordering.
1471
+
1472
+ >>> pd.Series(pd.Categorical(list('baabc'), categories=list('abc'),
1473
+ ... ordered=True)).unique()
1474
+ [b, a, c]
1475
+ Categories (3, object): [a < b < c]
1476
+ """
1434
1477
result = super (Series , self ).unique ()
1435
1478
1436
1479
if is_datetime64tz_dtype (self .dtype ):
0 commit comments