@@ -369,10 +369,10 @@ def values(self):
369369 Timezone aware datetime data is converted to UTC:
370370
371371 >>> pd.Series(pd.date_range('20130101', periods=3,
372- tz='US/Eastern')).values
373- array(['2013-01-01T00 :00:00.000000000-0500 ',
374- '2013-01-02T00 :00:00.000000000-0500 ',
375- '2013-01-03T00 :00:00.000000000-0500 '], dtype='datetime64[ns]')
372+ ... tz='US/Eastern')).values
373+ array(['2013-01-01T05 :00:00.000000000',
374+ '2013-01-02T05 :00:00.000000000',
375+ '2013-01-03T05 :00:00.000000000'], dtype='datetime64[ns]')
376376
377377 """
378378 return self ._data .external_values ()
@@ -1550,6 +1550,8 @@ def append(self, to_append, ignore_index=False, verify_integrity=False):
15501550 With `verify_integrity` set to True:
15511551
15521552 >>> s1.append(s2, verify_integrity=True)
1553+ Traceback (most recent call last):
1554+ ...
15531555 ValueError: Indexes have overlapping values: [0, 1, 2]
15541556
15551557
@@ -1919,8 +1921,19 @@ def nlargest(self, n=5, keep='first'):
19191921 --------
19201922 >>> import pandas as pd
19211923 >>> import numpy as np
1922- >>> s = pd.Series(np.random.randn(1e6 ))
1924+ >>> s = pd.Series(np.random.randn(10**6 ))
19231925 >>> s.nlargest(10) # only sorts up to the N requested
1926+ 219921 4.644710
1927+ 82124 4.608745
1928+ 421689 4.564644
1929+ 425277 4.447014
1930+ 718691 4.414137
1931+ 43154 4.403520
1932+ 283187 4.313922
1933+ 595519 4.273635
1934+ 503969 4.250236
1935+ 121637 4.240952
1936+ dtype: float64
19241937 """
19251938 return algorithms .select_n_series (self , n = n , keep = keep ,
19261939 method = 'nlargest' )
@@ -1958,8 +1971,19 @@ def nsmallest(self, n=5, keep='first'):
19581971 --------
19591972 >>> import pandas as pd
19601973 >>> import numpy as np
1961- >>> s = pd.Series(np.random.randn(1e6 ))
1974+ >>> s = pd.Series(np.random.randn(10**6 ))
19621975 >>> s.nsmallest(10) # only sorts up to the N requested
1976+ 288532 -4.954580
1977+ 732345 -4.835960
1978+ 64803 -4.812550
1979+ 446457 -4.609998
1980+ 501225 -4.483945
1981+ 669476 -4.472935
1982+ 973615 -4.401699
1983+ 621279 -4.355126
1984+ 773916 -4.347355
1985+ 359919 -4.331927
1986+ dtype: float64
19631987 """
19641988 return algorithms .select_n_series (self , n = n , keep = keep ,
19651989 method = 'nsmallest' )
@@ -2052,21 +2076,24 @@ def unstack(self, level=-1, fill_value=None):
20522076
20532077 Examples
20542078 --------
2079+ >>> s = pd.Series([1, 2, 3, 4],
2080+ ... index=pd.MultiIndex.from_product([['one', 'two'], ['a', 'b']]))
20552081 >>> s
2056- one a 1.
2057- one b 2.
2058- two a 3.
2059- two b 4.
2082+ one a 1
2083+ b 2
2084+ two a 3
2085+ b 4
2086+ dtype: int64
20602087
20612088 >>> s.unstack(level=-1)
2062- a b
2063- one 1. 2.
2064- two 3. 4.
2089+ a b
2090+ one 1 2
2091+ two 3 4
20652092
20662093 >>> s.unstack(level=0)
20672094 one two
2068- a 1. 2.
2069- b 3. 4.
2095+ a 1 3
2096+ b 2 4
20702097
20712098 Returns
20722099 -------
@@ -2102,15 +2129,16 @@ def map(self, arg, na_action=None):
21022129
21032130 >>> x = pd.Series([1,2,3], index=['one', 'two', 'three'])
21042131 >>> x
2105- one 1
2106- two 2
2107- three 3
2132+ one 1
2133+ two 2
2134+ three 3
2135+ dtype: int64
21082136
21092137 >>> y = pd.Series(['foo', 'bar', 'baz'], index=[1,2,3])
21102138 >>> y
2111- 1 foo
2112- 2 bar
2113- 3 baz
2139+ 1 foo
2140+ 2 bar
2141+ 3 baz
21142142
21152143 >>> x.map(y)
21162144 one foo
@@ -2215,6 +2243,7 @@ def apply(self, func, convert_dtype=True, args=(), **kwds):
22152243 >>> import numpy as np
22162244 >>> series = pd.Series([20, 21, 12], index=['London',
22172245 ... 'New York','Helsinki'])
2246+ >>> series
22182247 London 20
22192248 New York 21
22202249 Helsinki 12
0 commit comments