Skip to content

Commit bec5b3a

Browse files
author
ShaharNaveh
committed
Applied "black formatting" on the example code
1 parent 4bca61f commit bec5b3a

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

pandas/core/algorithms.py

+26-14
Original file line numberDiff line numberDiff line change
@@ -375,48 +375,60 @@ def unique(values):
375375
>>> pd.unique(pd.Series([2] + [1] * 5))
376376
array([2, 1])
377377
378-
>>> pd.unique(pd.Series([pd.Timestamp('20160101'),
379-
... pd.Timestamp('20160101')]))
378+
>>> pd.unique(pd.Series([pd.Timestamp("20160101"), pd.Timestamp("20160101")]))
380379
array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
381380
382-
>>> pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
383-
... pd.Timestamp('20160101', tz='US/Eastern')]))
381+
>>> pd.unique(
382+
... pd.Series(
383+
... [
384+
... pd.Timestamp("20160101", tz="US/Eastern"),
385+
... pd.Timestamp("20160101", tz="US/Eastern"),
386+
... ]
387+
... )
388+
... )
384389
<DatetimeArray>
385390
['2016-01-01 00:00:00-05:00']
386391
Length: 1, dtype: datetime64[ns, US/Eastern]
387392
388-
>>> pd.unique(pd.Index([pd.Timestamp('20160101', tz='US/Eastern'),
389-
... pd.Timestamp('20160101', tz='US/Eastern')]))
393+
>>> pd.unique(
394+
... pd.Index(
395+
... [
396+
... pd.Timestamp("20160101", tz="US/Eastern"),
397+
... pd.Timestamp("20160101", tz="US/Eastern"),
398+
... ]
399+
... )
400+
... )
390401
DatetimeIndex(['2016-01-01 00:00:00-05:00'],
391402
dtype='datetime64[ns, US/Eastern]',
392403
freq=None)
393404
394-
>>> pd.unique(list('baabc'))
405+
>>> pd.unique(list("baabc"))
395406
array(['b', 'a', 'c'], dtype=object)
396407
397408
An unordered Categorical will return categories in the
398409
order of appearance.
399410
400-
>>> pd.unique(pd.Series(pd.Categorical(list('baabc'))))
411+
>>> pd.unique(pd.Series(pd.Categorical(list("baabc"))))
401412
['b', 'a', 'c']
402413
Categories (3, object): ['a', 'b', 'c']
403414
404-
>>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
405-
... categories=list('abc'))))
415+
>>> pd.unique(pd.Series(pd.Categorical(list("baabc"), categories=list("abc"))))
406416
['b', 'a', 'c']
407417
Categories (3, object): ['a', 'b', 'c']
408418
409419
An ordered Categorical preserves the category ordering.
410420
411-
>>> pd.unique(pd.Series(pd.Categorical(list('baabc'),
412-
... categories=list('abc'),
413-
... ordered=True)))
421+
>>> pd.unique(
422+
... pd.Series(
423+
... pd.Categorical(list("baabc"), categories=list("abc"), ordered=True)
424+
... )
425+
... )
414426
['b', 'a', 'c']
415427
Categories (3, object): ['a' < 'b' < 'c']
416428
417429
An array of tuples
418430
419-
>>> pd.unique([('a', 'b'), ('b', 'a'), ('a', 'c'), ('b', 'a')])
431+
>>> pd.unique([("a", "b"), ("b", "a"), ("a", "c"), ("b", "a")])
420432
array([('a', 'b'), ('b', 'a'), ('a', 'c')], dtype=object)
421433
"""
422434
values = _ensure_arraylike(values)

0 commit comments

Comments
 (0)