<h4 dir="auto">Code Sample</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import pandas as pd

dts = pd.date_range('20180101', periods=10)
iterables = [dts, ['one', 'two']]
idx = pd.MultiIndex.from_product(iterables, names=['first', 'second'])
s = pd.Series(np.random.randn(20), index=idx)
s.groupby('first').nlargest(1)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>

<span class="pl-s1">dts</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">date_range</span>(<span class="pl-s">'20180101'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">10</span>)
<span class="pl-s1">iterables</span> <span class="pl-c1">=</span> [<span class="pl-s1">dts</span>, [<span class="pl-s">'one'</span>, <span class="pl-s">'two'</span>]]
<span class="pl-s1">idx</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">MultiIndex</span>.<span class="pl-en">from_product</span>(<span class="pl-s1">iterables</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span>[<span class="pl-s">'first'</span>, <span class="pl-s">'second'</span>])
<span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">20</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">idx</span>)
<span class="pl-s1">s</span>.<span class="pl-en">groupby</span>(<span class="pl-s">'first'</span>).<span class="pl-en">nlargest</span>(<span class="pl-c1">1</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">After upgrade to Anaconda 5.2.0, the sample code raises the following exception</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="TypeError                                 Traceback (most recent call last)
~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
    917             try:
--&gt; 918                 result = self._python_apply_general(f)
    919             except Exception:

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _python_apply_general(self, f)
    935         keys, values, mutated = self.grouper.apply(f, self._selected_obj,
--&gt; 936                                                    self.axis)
    937 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, f, data, axis)
   2272             group_axes = _get_axes(group)
-&gt; 2273             res = f(group)
   2274             if not _is_indexed_like(res, group_axes):

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in curried_with_axis(x)
    819             def curried_with_axis(x):
--&gt; 820                 return f(x, *args, **kwargs_with_axis)
    821 

TypeError: nlargest() got an unexpected keyword argument 'axis'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in wrapper(*args, **kwargs)
    834             try:
--&gt; 835                 return self.apply(curried_with_axis)
    836             except Exception:

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
   3468     def apply(self, func, *args, **kwargs):
-&gt; 3469         return super(SeriesGroupBy, self).apply(func, *args, **kwargs)
   3470 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
    929                 with _group_selection_context(self):
--&gt; 930                     return self._python_apply_general(f)
    931 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _python_apply_general(self, f)
    935         keys, values, mutated = self.grouper.apply(f, self._selected_obj,
--&gt; 936                                                    self.axis)
    937 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, f, data, axis)
   2272             group_axes = _get_axes(group)
-&gt; 2273             res = f(group)
   2274             if not _is_indexed_like(res, group_axes):

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in curried_with_axis(x)
    819             def curried_with_axis(x):
--&gt; 820                 return f(x, *args, **kwargs_with_axis)
    821 

TypeError: nlargest() got an unexpected keyword argument 'axis'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
    917             try:
--&gt; 918                 result = self._python_apply_general(f)
    919             except Exception:

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _python_apply_general(self, f)
    940             values,
--&gt; 941             not_indexed_same=mutated or self.mutated)
    942 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _wrap_applied_output(self, keys, values, not_indexed_same)
   3611             return self._concat_objects(keys, values,
-&gt; 3612                                         not_indexed_same=not_indexed_same)
   3613         elif isinstance(values[0], DataFrame):

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _concat_objects(self, keys, values, not_indexed_same)
   1135                                 levels=group_levels, names=group_names,
-&gt; 1136                                 sort=False)
   1137             else:

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in concat(objs, axis, join, join_axes, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    224                        verify_integrity=verify_integrity,
--&gt; 225                        copy=copy, sort=sort)
    226     return op.get_result()

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in __init__(self, objs, axis, join, join_axes, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    377 
--&gt; 378         self.new_axes = self._get_new_axes()
    379 

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _get_new_axes(self)
    457 
--&gt; 458         new_axes[self.axis] = self._get_concat_axis()
    459         return new_axes

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _get_concat_axis(self)
    513             concat_axis = _make_concat_multiindex(indexes, self.keys,
--&gt; 514                                                   self.levels, self.names)
    515 

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _make_concat_multiindex(indexes, keys, levels, names)
    594         return MultiIndex(levels=levels, labels=label_list, names=names,
--&gt; 595                           verify_integrity=False)
    596 

~\Programs\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py in __new__(cls, levels, labels, sortorder, names, dtype, copy, name, verify_integrity, _set_identity)
    231             # handles name validation
--&gt; 232             result._set_names(names)
    233 

~\Programs\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py in _set_names(self, names, level, validate)
    694                         'level {}, is already used for level '
--&gt; 695                         '{}.'.format(name, l, used[name]))
    696 

ValueError: Duplicated level name: &quot;first&quot;, assigned to level 1, is already used for level 0.

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in wrapper(*args, **kwargs)
    837                 try:
--&gt; 838                     return self.apply(curried)
    839                 except Exception:

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
   3468     def apply(self, func, *args, **kwargs):
-&gt; 3469         return super(SeriesGroupBy, self).apply(func, *args, **kwargs)
   3470 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in apply(self, func, *args, **kwargs)
    929                 with _group_selection_context(self):
--&gt; 930                     return self._python_apply_general(f)
    931 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _python_apply_general(self, f)
    940             values,
--&gt; 941             not_indexed_same=mutated or self.mutated)
    942 

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _wrap_applied_output(self, keys, values, not_indexed_same)
   3611             return self._concat_objects(keys, values,
-&gt; 3612                                         not_indexed_same=not_indexed_same)
   3613         elif isinstance(values[0], DataFrame):

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in _concat_objects(self, keys, values, not_indexed_same)
   1135                                 levels=group_levels, names=group_names,
-&gt; 1136                                 sort=False)
   1137             else:

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in concat(objs, axis, join, join_axes, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    224                        verify_integrity=verify_integrity,
--&gt; 225                        copy=copy, sort=sort)
    226     return op.get_result()

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in __init__(self, objs, axis, join, join_axes, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    377 
--&gt; 378         self.new_axes = self._get_new_axes()
    379 

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _get_new_axes(self)
    457 
--&gt; 458         new_axes[self.axis] = self._get_concat_axis()
    459         return new_axes

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _get_concat_axis(self)
    513             concat_axis = _make_concat_multiindex(indexes, self.keys,
--&gt; 514                                                   self.levels, self.names)
    515 

~\Programs\Anaconda3\lib\site-packages\pandas\core\reshape\concat.py in _make_concat_multiindex(indexes, keys, levels, names)
    594         return MultiIndex(levels=levels, labels=label_list, names=names,
--&gt; 595                           verify_integrity=False)
    596 

~\Programs\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py in __new__(cls, levels, labels, sortorder, names, dtype, copy, name, verify_integrity, _set_identity)
    231             # handles name validation
--&gt; 232             result._set_names(names)
    233 

~\Programs\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py in _set_names(self, names, level, validate)
    694                         'level {}, is already used for level '
--&gt; 695                         '{}.'.format(name, l, used[name]))
    696 

ValueError: Duplicated level name: &quot;first&quot;, assigned to level 1, is already used for level 0.

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in wrapper(*args, **kwargs)
    847                     try:
--&gt; 848                         return self._aggregate_item_by_item(name,
    849                                                             *args, **kwargs)

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in __getattr__(self, attr)
    764         raise AttributeError(&quot;%r object has no attribute %r&quot; %
--&gt; 765                              (type(self).__name__, attr))
    766 

AttributeError: 'SeriesGroupBy' object has no attribute '_aggregate_item_by_item'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
&lt;ipython-input-2-2e8f88f2b9dc&gt; in &lt;module&gt;()
      6 idx = pd.MultiIndex.from_product(iterables, names=['first', 'second'])
      7 s = pd.Series(np.random.randn(20), index=idx)
----&gt; 8 s.groupby('first').nlargest(1)

~\Programs\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in wrapper(*args, **kwargs)
    849                                                             *args, **kwargs)
    850                     except (AttributeError):
--&gt; 851                         raise ValueError
    852 
    853         return wrapper

ValueError: "><pre class="notranslate"><span class="pl-v">TypeError</span>                                 <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">917</span>             <span class="pl-k">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-&gt;</span> <span class="pl-c1">918</span>                 <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_python_apply_general</span>(<span class="pl-s1">f</span>)
    <span class="pl-c1">919</span>             <span class="pl-k">except</span> <span class="pl-v">Exception</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_python_apply_general</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>)
    <span class="pl-c1">935</span>         <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">mutated</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">grouper</span>.<span class="pl-en">apply</span>(<span class="pl-s1">f</span>, <span class="pl-s1">self</span>.<span class="pl-s1">_selected_obj</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">936</span>                                                    <span class="pl-s1">self</span>.<span class="pl-s1">axis</span>)
    <span class="pl-c1">937</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>, <span class="pl-s1">data</span>, <span class="pl-s1">axis</span>)
   <span class="pl-c1">2272</span>             <span class="pl-s1">group_axes</span> <span class="pl-c1">=</span> <span class="pl-en">_get_axes</span>(<span class="pl-s1">group</span>)
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">2273</span>             <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-en">f</span>(<span class="pl-s1">group</span>)
   <span class="pl-c1">2274</span>             <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-en">_is_indexed_like</span>(<span class="pl-s1">res</span>, <span class="pl-s1">group_axes</span>):

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">curried_with_axis</span>(<span class="pl-s1">x</span>)
    <span class="pl-c1">819</span>             <span class="pl-s1">def</span> <span class="pl-en">curried_with_axis</span>(<span class="pl-s1">x</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">820</span>                 <span class="pl-s1">return</span> <span class="pl-en">f</span>(<span class="pl-s1">x</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs_with_axis</span>)
    <span class="pl-c1">821</span> 

<span class="pl-v">TypeError</span>: <span class="pl-en">nlargest</span>() <span class="pl-s1">got</span> <span class="pl-s1">an</span> <span class="pl-s1">unexpected</span> <span class="pl-s1">keyword</span> <span class="pl-s1">argument</span> <span class="pl-s">'axis'</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">TypeError</span>                                 <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">wrapper</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">834</span>             <span class="pl-s1">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">835</span>                 <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">apply</span>(<span class="pl-s1">curried_with_axis</span>)
    <span class="pl-c1">836</span>             <span class="pl-s1">except</span> <span class="pl-v">Exception</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">3468</span>     <span class="pl-s1">def</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
<span class="pl-c1">-&gt;</span> <span class="pl-c1">3469</span>         <span class="pl-s1">return</span> <span class="pl-en">super</span>(<span class="pl-v">SeriesGroupBy</span>, <span class="pl-s1">self</span>).<span class="pl-en">apply</span>(<span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">3470</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">929</span>                 <span class="pl-s1">with</span> <span class="pl-en">_group_selection_context</span>(<span class="pl-s1">self</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">930</span>                     <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_python_apply_general</span>(<span class="pl-s1">f</span>)
    <span class="pl-c1">931</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_python_apply_general</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>)
    <span class="pl-c1">935</span>         <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">mutated</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">grouper</span>.<span class="pl-en">apply</span>(<span class="pl-s1">f</span>, <span class="pl-s1">self</span>.<span class="pl-s1">_selected_obj</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">936</span>                                                    <span class="pl-s1">self</span>.<span class="pl-s1">axis</span>)
    <span class="pl-c1">937</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>, <span class="pl-s1">data</span>, <span class="pl-s1">axis</span>)
   <span class="pl-c1">2272</span>             <span class="pl-s1">group_axes</span> <span class="pl-c1">=</span> <span class="pl-en">_get_axes</span>(<span class="pl-s1">group</span>)
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">2273</span>             <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-s1">f</span>(<span class="pl-s1">group</span>)
   <span class="pl-c1">2274</span>             <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-en">_is_indexed_like</span>(<span class="pl-s1">res</span>, <span class="pl-s1">group_axes</span>):

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">curried_with_axis</span>(<span class="pl-s1">x</span>)
    <span class="pl-c1">819</span>             <span class="pl-s1">def</span> <span class="pl-en">curried_with_axis</span>(<span class="pl-s1">x</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">820</span>                 <span class="pl-s1">return</span> <span class="pl-en">f</span>(<span class="pl-s1">x</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs_with_axis</span>)
    <span class="pl-c1">821</span> 

<span class="pl-v">TypeError</span>: <span class="pl-en">nlargest</span>() <span class="pl-s1">got</span> <span class="pl-s1">an</span> <span class="pl-s1">unexpected</span> <span class="pl-s1">keyword</span> <span class="pl-s1">argument</span> <span class="pl-s">'axis'</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">ValueError</span>                                <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">917</span>             <span class="pl-s1">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">918</span>                 <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_python_apply_general</span>(<span class="pl-s1">f</span>)
    <span class="pl-c1">919</span>             <span class="pl-s1">except</span> <span class="pl-v">Exception</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_python_apply_general</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>)
    <span class="pl-c1">940</span>             <span class="pl-s1">values</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">941</span>             <span class="pl-s1">not_indexed_same</span><span class="pl-c1">=</span><span class="pl-s1">mutated</span> <span class="pl-c1">or</span> <span class="pl-s1">self</span>.<span class="pl-s1">mutated</span>)
    <span class="pl-c1">942</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_wrap_applied_output</span>(<span class="pl-s1">self</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">3611</span>             <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_concat_objects</span>(<span class="pl-s1">keys</span>, <span class="pl-s1">values</span>,
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">3612</span>                                         <span class="pl-s1">not_indexed_same</span><span class="pl-c1">=</span><span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">3613</span>         <span class="pl-k">elif</span> <span class="pl-s1">isinstance</span>(<span class="pl-s1">values</span>[<span class="pl-c1">0</span>], <span class="pl-v">DataFrame</span>):

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_concat_objects</span>(<span class="pl-s1">self</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">1135</span>                                 <span class="pl-s1">levels</span><span class="pl-c1">=</span><span class="pl-s1">group_levels</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span><span class="pl-s1">group_names</span>,
<span class="pl-c1">-&gt;</span> <span class="pl-c1">1136</span>                                 <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
   <span class="pl-c1">1137</span>             <span class="pl-k">else</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">concat</span>(<span class="pl-s1">objs</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">join</span>, <span class="pl-s1">join_axes</span>, <span class="pl-s1">ignore_index</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">sort</span>, <span class="pl-s1">copy</span>)
    <span class="pl-c1">224</span>                        <span class="pl-s1">verify_integrity</span><span class="pl-c1">=</span><span class="pl-s1">verify_integrity</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">225</span>                        <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-s1">copy</span>, <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">sort</span>)
    <span class="pl-c1">226</span>     <span class="pl-k">return</span> <span class="pl-s1">op</span>.<span class="pl-s1">get_result</span>()

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">objs</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">join</span>, <span class="pl-s1">join_axes</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>, <span class="pl-s1">ignore_index</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">sort</span>)
    <span class="pl-c1">377</span> 
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">378</span>         <span class="pl-s1">self</span>.<span class="pl-s1">new_axes</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_new_axes</span>()
    <span class="pl-c1">379</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_get_new_axes</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">457</span> 
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">458</span>         <span class="pl-s1">new_axes</span>[<span class="pl-s1">self</span>.<span class="pl-s1">axis</span>] <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_concat_axis</span>()
    <span class="pl-c1">459</span>         <span class="pl-k">return</span> <span class="pl-s1">new_axes</span>

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_get_concat_axis</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">513</span>             <span class="pl-s1">concat_axis</span> <span class="pl-c1">=</span> <span class="pl-en">_make_concat_multiindex</span>(<span class="pl-s1">indexes</span>, <span class="pl-s1">self</span>.<span class="pl-s1">keys</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">514</span>                                                   <span class="pl-s1">self</span>.<span class="pl-s1">levels</span>, <span class="pl-s1">self</span>.<span class="pl-s1">names</span>)
    <span class="pl-c1">515</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_make_concat_multiindex</span>(<span class="pl-s1">indexes</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>)
    <span class="pl-c1">594</span>         <span class="pl-k">return</span> <span class="pl-v">MultiIndex</span>(<span class="pl-s1">levels</span><span class="pl-c1">=</span><span class="pl-s1">levels</span>, <span class="pl-s1">labels</span><span class="pl-c1">=</span><span class="pl-s1">label_list</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span><span class="pl-s1">names</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">595</span>                           <span class="pl-s1">verify_integrity</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
    <span class="pl-c1">596</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">ndexes</span>\m<span class="pl-s1">ulti</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__new__</span>(<span class="pl-s1">cls</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">labels</span>, <span class="pl-s1">sortorder</span>, <span class="pl-s1">names</span>, <span class="pl-s1">dtype</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">name</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">_set_identity</span>)
    <span class="pl-c1">231</span>             <span class="pl-c"># handles name validation</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">232</span>             <span class="pl-s1">result</span>.<span class="pl-en">_set_names</span>(<span class="pl-s1">names</span>)
    <span class="pl-c1">233</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">ndexes</span>\m<span class="pl-s1">ulti</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_set_names</span>(<span class="pl-s1">self</span>, <span class="pl-s1">names</span>, <span class="pl-s1">level</span>, <span class="pl-s1">validate</span>)
    <span class="pl-c1">694</span>                         <span class="pl-s">'level {}, is already used for level '</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">695</span>                         <span class="pl-s">'{}.'</span>.<span class="pl-en">format</span>(<span class="pl-s1">name</span>, <span class="pl-s1">l</span>, <span class="pl-s1">used</span>[<span class="pl-s1">name</span>]))
    <span class="pl-c1">696</span> 

<span class="pl-v">ValueError</span>: <span class="pl-v">Duplicated</span> <span class="pl-s1">level</span> <span class="pl-s1">name</span>: <span class="pl-s">"first"</span>, <span class="pl-s1">assigned</span> <span class="pl-s1">to</span> <span class="pl-s1">level</span> <span class="pl-c1">1</span>, <span class="pl-c1">is</span> <span class="pl-s1">already</span> <span class="pl-s1">used</span> <span class="pl-k">for</span> <span class="pl-s1">level</span> <span class="pl-c1">0.</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">ValueError</span>                                <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">wrapper</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">837</span>                 <span class="pl-s1">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">838</span>                     <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">apply</span>(<span class="pl-s1">curried</span>)
    <span class="pl-c1">839</span>                 <span class="pl-s1">except</span> <span class="pl-v">Exception</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">3468</span>     <span class="pl-s1">def</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
<span class="pl-c1">-&gt;</span> <span class="pl-c1">3469</span>         <span class="pl-s1">return</span> <span class="pl-en">super</span>(<span class="pl-v">SeriesGroupBy</span>, <span class="pl-s1">self</span>).<span class="pl-en">apply</span>(<span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">3470</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">apply</span>(<span class="pl-s1">self</span>, <span class="pl-s1">func</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">929</span>                 <span class="pl-s1">with</span> <span class="pl-en">_group_selection_context</span>(<span class="pl-s1">self</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">930</span>                     <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_python_apply_general</span>(<span class="pl-s1">f</span>)
    <span class="pl-c1">931</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_python_apply_general</span>(<span class="pl-s1">self</span>, <span class="pl-s1">f</span>)
    <span class="pl-c1">940</span>             <span class="pl-s1">values</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">941</span>             <span class="pl-s1">not_indexed_same</span><span class="pl-c1">=</span><span class="pl-s1">mutated</span> <span class="pl-c1">or</span> <span class="pl-s1">self</span>.<span class="pl-s1">mutated</span>)
    <span class="pl-c1">942</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_wrap_applied_output</span>(<span class="pl-s1">self</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">3611</span>             <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_concat_objects</span>(<span class="pl-s1">keys</span>, <span class="pl-s1">values</span>,
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">3612</span>                                         <span class="pl-s1">not_indexed_same</span><span class="pl-c1">=</span><span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">3613</span>         <span class="pl-k">elif</span> <span class="pl-s1">isinstance</span>(<span class="pl-s1">values</span>[<span class="pl-c1">0</span>], <span class="pl-v">DataFrame</span>):

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_concat_objects</span>(<span class="pl-s1">self</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">values</span>, <span class="pl-s1">not_indexed_same</span>)
   <span class="pl-c1">1135</span>                                 <span class="pl-s1">levels</span><span class="pl-c1">=</span><span class="pl-s1">group_levels</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span><span class="pl-s1">group_names</span>,
<span class="pl-c1">-&gt;</span> <span class="pl-c1">1136</span>                                 <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
   <span class="pl-c1">1137</span>             <span class="pl-k">else</span>:

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">concat</span>(<span class="pl-s1">objs</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">join</span>, <span class="pl-s1">join_axes</span>, <span class="pl-s1">ignore_index</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">sort</span>, <span class="pl-s1">copy</span>)
    <span class="pl-c1">224</span>                        <span class="pl-s1">verify_integrity</span><span class="pl-c1">=</span><span class="pl-s1">verify_integrity</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">225</span>                        <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-s1">copy</span>, <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">sort</span>)
    <span class="pl-c1">226</span>     <span class="pl-k">return</span> <span class="pl-s1">op</span>.<span class="pl-en">get_result</span>()

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">objs</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">join</span>, <span class="pl-s1">join_axes</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>, <span class="pl-s1">ignore_index</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">sort</span>)
    <span class="pl-c1">377</span> 
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">378</span>         <span class="pl-s1">self</span>.<span class="pl-s1">new_axes</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_new_axes</span>()
    <span class="pl-c1">379</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_get_new_axes</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">457</span> 
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">458</span>         <span class="pl-s1">new_axes</span>[<span class="pl-s1">self</span>.<span class="pl-s1">axis</span>] <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_concat_axis</span>()
    <span class="pl-c1">459</span>         <span class="pl-k">return</span> <span class="pl-s1">new_axes</span>

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_get_concat_axis</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">513</span>             <span class="pl-s1">concat_axis</span> <span class="pl-c1">=</span> <span class="pl-en">_make_concat_multiindex</span>(<span class="pl-s1">indexes</span>, <span class="pl-s1">self</span>.<span class="pl-s1">keys</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">514</span>                                                   <span class="pl-s1">self</span>.<span class="pl-s1">levels</span>, <span class="pl-s1">self</span>.<span class="pl-s1">names</span>)
    <span class="pl-c1">515</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\c<span class="pl-s1">oncat</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_make_concat_multiindex</span>(<span class="pl-s1">indexes</span>, <span class="pl-s1">keys</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">names</span>)
    <span class="pl-c1">594</span>         <span class="pl-k">return</span> <span class="pl-v">MultiIndex</span>(<span class="pl-s1">levels</span><span class="pl-c1">=</span><span class="pl-s1">levels</span>, <span class="pl-s1">labels</span><span class="pl-c1">=</span><span class="pl-s1">label_list</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span><span class="pl-s1">names</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">595</span>                           <span class="pl-s1">verify_integrity</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
    <span class="pl-c1">596</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">ndexes</span>\m<span class="pl-s1">ulti</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__new__</span>(<span class="pl-s1">cls</span>, <span class="pl-s1">levels</span>, <span class="pl-s1">labels</span>, <span class="pl-s1">sortorder</span>, <span class="pl-s1">names</span>, <span class="pl-s1">dtype</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">name</span>, <span class="pl-s1">verify_integrity</span>, <span class="pl-s1">_set_identity</span>)
    <span class="pl-c1">231</span>             <span class="pl-c"># handles name validation</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">232</span>             <span class="pl-s1">result</span>.<span class="pl-en">_set_names</span>(<span class="pl-s1">names</span>)
    <span class="pl-c1">233</span> 

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">ndexes</span>\m<span class="pl-s1">ulti</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_set_names</span>(<span class="pl-s1">self</span>, <span class="pl-s1">names</span>, <span class="pl-s1">level</span>, <span class="pl-s1">validate</span>)
    <span class="pl-c1">694</span>                         <span class="pl-s">'level {}, is already used for level '</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">695</span>                         <span class="pl-s">'{}.'</span>.<span class="pl-en">format</span>(<span class="pl-s1">name</span>, <span class="pl-s1">l</span>, <span class="pl-s1">used</span>[<span class="pl-s1">name</span>]))
    <span class="pl-c1">696</span> 

<span class="pl-v">ValueError</span>: <span class="pl-v">Duplicated</span> <span class="pl-s1">level</span> <span class="pl-s1">name</span>: <span class="pl-s">"first"</span>, <span class="pl-s1">assigned</span> <span class="pl-s1">to</span> <span class="pl-s1">level</span> <span class="pl-c1">1</span>, <span class="pl-c1">is</span> <span class="pl-s1">already</span> <span class="pl-s1">used</span> <span class="pl-k">for</span> <span class="pl-s1">level</span> <span class="pl-c1">0.</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">AttributeError</span>                            <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">wrapper</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">847</span>                     <span class="pl-s1">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">848</span>                         <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_aggregate_item_by_item</span>(<span class="pl-s1">name</span>,
    <span class="pl-c1">849</span>                                                             <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__getattr__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">attr</span>)
    <span class="pl-c1">764</span>         <span class="pl-s1">raise</span> <span class="pl-v">AttributeError</span>(<span class="pl-s">"%r object has no attribute %r"</span> <span class="pl-c1">%</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">765</span>                              (<span class="pl-en">type</span>(<span class="pl-s1">self</span>).<span class="pl-s1">__name__</span>, <span class="pl-s1">attr</span>))
    <span class="pl-c1">766</span> 

<span class="pl-v">AttributeError</span>: <span class="pl-s">'SeriesGroupBy'</span> <span class="pl-s1">object</span> <span class="pl-s1">has</span> <span class="pl-s1">no</span> <span class="pl-s1">attribute</span> <span class="pl-s">'_aggregate_item_by_item'</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">ValueError</span>                                <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">2</span><span class="pl-c1">-</span><span class="pl-c1">2e8</span><span class="pl-s1">f88f2b9dc</span><span class="pl-c1">&gt;</span> <span class="pl-c1">in</span> <span class="pl-c1">&lt;</span><span class="pl-en">module</span><span class="pl-c1">&gt;</span>()
      <span class="pl-c1">6</span> <span class="pl-s1">idx</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">MultiIndex</span>.<span class="pl-en">from_product</span>(<span class="pl-s1">iterables</span>, <span class="pl-s1">names</span><span class="pl-c1">=</span>[<span class="pl-s">'first'</span>, <span class="pl-s">'second'</span>])
      <span class="pl-c1">7</span> <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">20</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">idx</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">8</span> <span class="pl-s1">s</span>.<span class="pl-en">groupby</span>(<span class="pl-s">'first'</span>).<span class="pl-en">nlargest</span>(<span class="pl-c1">1</span>)

<span class="pl-c1">~</span>\P<span class="pl-s1">rograms</span>\A<span class="pl-s1">naconda3</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">roupby</span>\g<span class="pl-s1">roupby</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">wrapper</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">849</span>                                                             <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">850</span>                     <span class="pl-en">except</span> (<span class="pl-v">AttributeError</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">851</span>                         <span class="pl-s1">raise</span> <span class="pl-v">ValueError</span>
    <span class="pl-c1">852</span> 
    <span class="pl-c1">853</span>         <span class="pl-k">return</span> <span class="pl-s1">wrapper</span>

<span class="pl-v">ValueError</span>: </pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">sample output from pandas 0.22.0 (Anaconda 5.1.0)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="first       first       second
2018-01-01  2018-01-01  two       0.488124
2018-01-02  2018-01-02  one       0.884829
2018-01-03  2018-01-03  one       0.476739
2018-01-04  2018-01-04  two      -0.375585
2018-01-05  2018-01-05  two       0.317667
2018-01-06  2018-01-06  two      -1.067373
2018-01-07  2018-01-07  two       1.135441
2018-01-08  2018-01-08  two       0.808737
2018-01-09  2018-01-09  one       1.440924
2018-01-10  2018-01-10  one      -0.204873
dtype: float64"><pre class="notranslate"><code class="notranslate">first       first       second
2018-01-01  2018-01-01  two       0.488124
2018-01-02  2018-01-02  one       0.884829
2018-01-03  2018-01-03  one       0.476739
2018-01-04  2018-01-04  two      -0.375585
2018-01-05  2018-01-05  two       0.317667
2018-01-06  2018-01-06  two      -1.067373
2018-01-07  2018-01-07  two       1.135441
2018-01-08  2018-01-08  two       0.808737
2018-01-09  2018-01-09  one       1.440924
2018-01-10  2018-01-10  one      -0.204873
dtype: float64
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.5.final.0<br>
python-bits: 64<br>
OS: Windows<br>
OS-release: 10<br>
machine: AMD64<br>
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: zh_CN.UTF-8<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.23.0<br>
pytest: 3.5.1<br>
pip: 10.0.1<br>
setuptools: 39.1.0<br>
Cython: 0.28.2<br>
numpy: 1.14.3<br>
scipy: 1.1.0<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.4.0<br>
sphinx: 1.7.4<br>
patsy: 0.5.0<br>
dateutil: 2.7.3<br>
pytz: 2018.4<br>
blosc: None<br>
bottleneck: 1.2.1<br>
tables: 3.4.3<br>
numexpr: 2.6.5<br>
feather: None<br>
matplotlib: 2.2.2<br>
openpyxl: 2.5.3<br>
xlrd: 1.1.0<br>
xlwt: 1.3.0<br>
xlsxwriter: 1.0.4<br>
lxml: 4.2.1<br>
bs4: 4.6.0<br>
html5lib: 1.0.1<br>
sqlalchemy: 1.2.7<br>
pymysql: 0.8.1<br>
psycopg2: None<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">Related <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="16408869" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/4134" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/4134/hovercard" href="https://github.com/pandas-dev/pandas/issues/4134">#4134</a> and:</p>
<p dir="auto"><a href="http://stackoverflow.com/questions/18159675/python-pandas-change-duplicate-timestamp-to-unique/18162121#18162121" rel="nofollow">http://stackoverflow.com/questions/18159675/python-pandas-change-duplicate-timestamp-to-unique/18162121#18162121</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [81]: df = DataFrame(dict(time = [Timestamp('20130101 9:01'),Timestamp('20130101 9:02')]))"><pre class="notranslate"><code class="notranslate">In [81]: df = DataFrame(dict(time = [Timestamp('20130101 9:01'),Timestamp('20130101 9:02')]))
</code></pre></div>
<p dir="auto">This is buggy</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [82]: df.time + np.timedelta64(1,'ms')
Out[82]: 
0   2013-01-01 09:01:00.000000001
1   2013-01-01 09:02:00.000000001
Name: time, dtype: datetime64[ns]

In [84]: df.time + np.timedelta64(1,'s')
Out[84]: 
0   2013-01-01 09:01:00.000000001
1   2013-01-01 09:02:00.000000001
Name: time, dtype: datetime64[ns]"><pre class="notranslate"><code class="notranslate">In [82]: df.time + np.timedelta64(1,'ms')
Out[82]: 
0   2013-01-01 09:01:00.000000001
1   2013-01-01 09:02:00.000000001
Name: time, dtype: datetime64[ns]

In [84]: df.time + np.timedelta64(1,'s')
Out[84]: 
0   2013-01-01 09:01:00.000000001
1   2013-01-01 09:02:00.000000001
Name: time, dtype: datetime64[ns]
</code></pre></div>
<p dir="auto">Doesn't work</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [83]: df.time + pd.offsets.Milli(5)
ValueError: cannot operate on a series with out a rhs of a series/ndarray of type datetime64[ns] or a timedelta"><pre class="notranslate"><code class="notranslate">In [83]: df.time + pd.offsets.Milli(5)
ValueError: cannot operate on a series with out a rhs of a series/ndarray of type datetime64[ns] or a timedelta
</code></pre></div>
<p dir="auto">But this is ok</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [86]: df.time.apply(lambda x: x + pd.offsets.Milli(5))
Out[86]: 
0   2013-01-01 09:01:00.005000
1   2013-01-01 09:02:00.005000
Name: time, dtype: datetime64[ns]"><pre class="notranslate"><code class="notranslate">In [86]: df.time.apply(lambda x: x + pd.offsets.Milli(5))
Out[86]: 
0   2013-01-01 09:01:00.005000
1   2013-01-01 09:02:00.005000
Name: time, dtype: datetime64[ns]
</code></pre></div>
<p dir="auto">This is ok</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [85]: df.time + timedelta(seconds=1)
Out[85]: 
0   2013-01-01 09:01:01
1   2013-01-01 09:02:01
Name: time, dtype: datetime64[ns]"><pre class="notranslate"><code class="notranslate">In [85]: df.time + timedelta(seconds=1)
Out[85]: 
0   2013-01-01 09:01:01
1   2013-01-01 09:02:01
Name: time, dtype: datetime64[ns]
</code></pre></div>