<p dir="auto">I have what appears to be a valid <code class="notranslate">Series</code> with a time series index as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [41]: inactive
Out[41]: 
2010-06-10 20:43:07    37.2
2010-06-21 06:37:28     0.0
2009-07-20 06:53:38     0.0
2012-05-17 01:50:13    27.4
2009-07-27 21:09:15     0.0
2010-05-04 09:06:54     0.0
2010-05-06 03:38:54    32.5
2010-05-09 08:33:16    56.9
2010-05-26 18:58:42     0.0
2010-05-31 18:40:41     0.0
2010-06-13 08:46:17     0.0
2010-06-16 18:27:51     0.0
2010-06-19 11:59:48     0.0
2010-06-24 15:24:26    33.4
2010-06-28 10:54:27     0.0
...
2008-11-02 07:35:22     71.2
2008-11-05 17:33:39     97.6
2009-10-22 23:15:39     75.7
2009-10-27 20:55:07     67.5
2009-06-02 13:57:15     35.8
2009-06-06 14:15:41     25.9
2008-11-07 01:22:46      0.0
2009-10-12 17:08:20    100.0
2010-09-19 10:21:39      0.0
2010-09-24 15:46:50      0.0
2010-09-30 16:48:09      0.0
2010-10-08 21:43:10      0.0
2010-10-15 19:27:11      0.0
2010-10-28 19:10:42      0.0
2010-06-13 10:32:45    100.0
Name: pdgt10, Length: 13536, dtype: float64"><pre class="notranslate"><code class="notranslate">In [41]: inactive
Out[41]: 
2010-06-10 20:43:07    37.2
2010-06-21 06:37:28     0.0
2009-07-20 06:53:38     0.0
2012-05-17 01:50:13    27.4
2009-07-27 21:09:15     0.0
2010-05-04 09:06:54     0.0
2010-05-06 03:38:54    32.5
2010-05-09 08:33:16    56.9
2010-05-26 18:58:42     0.0
2010-05-31 18:40:41     0.0
2010-06-13 08:46:17     0.0
2010-06-16 18:27:51     0.0
2010-06-19 11:59:48     0.0
2010-06-24 15:24:26    33.4
2010-06-28 10:54:27     0.0
...
2008-11-02 07:35:22     71.2
2008-11-05 17:33:39     97.6
2009-10-22 23:15:39     75.7
2009-10-27 20:55:07     67.5
2009-06-02 13:57:15     35.8
2009-06-06 14:15:41     25.9
2008-11-07 01:22:46      0.0
2009-10-12 17:08:20    100.0
2010-09-19 10:21:39      0.0
2010-09-24 15:46:50      0.0
2010-09-30 16:48:09      0.0
2010-10-08 21:43:10      0.0
2010-10-15 19:27:11      0.0
2010-10-28 19:10:42      0.0
2010-06-13 10:32:45    100.0
Name: pdgt10, Length: 13536, dtype: float64
</code></pre></div>
<p dir="auto">Note also:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [43]: inactive.isnull().sum()
Out[43]: 0

In [45]: inactive.index.size
Out[45]: 13536

In [46]: inactive.values.size
Out[46]: 13536"><pre class="notranslate"><code class="notranslate">In [43]: inactive.isnull().sum()
Out[43]: 0

In [45]: inactive.index.size
Out[45]: 13536

In [46]: inactive.values.size
Out[46]: 13536
</code></pre></div>
<p dir="auto">However, when I try calling <code class="notranslate">inactive.plot()</code> in order to get a time series plot, I receive a puzzling <code class="notranslate">AssertionError</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [40]: inactive.plot()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
&lt;ipython-input-40-cdcfa4d871e5&gt; in &lt;module&gt;()
----&gt; 1 inactive.plot()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in plot_series(series, label, kind, use_index, rot, xticks, yticks, xlim, ylim, ax, style, grid, legend, logx, logy, secondary_y, **kwds)
   1730                      secondary_y=secondary_y, **kwds)
   1731 
-&gt; 1732     plot_obj.generate()
   1733     plot_obj.draw()
   1734 

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in generate(self)
    856         self._compute_plot_data()
    857         self._setup_subplots()
--&gt; 858         self._make_plot()
    859         self._post_plot_logic()
    860         self._adorn_subplots()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in _make_plot(self)
   1244             lines = []
   1245             labels = []
-&gt; 1246             x = self._get_xticks(convert_period=True)
   1247 
   1248             plotf = self._get_plot_function()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in _get_xticks(self, convert_period)
   1034                 x = index._mpl_repr()
   1035             elif is_datetype:
-&gt; 1036                 self.data = self.data.reindex(index=index.order())
   1037                 x = self.data.index._mpl_repr()
   1038             else:

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in reindex(self, index, method, level, fill_value, limit, copy, takeable)
   2649 
   2650         # GH4246 (dispatch to a common method with frame to handle possibly duplicate index)
-&gt; 2651         return self._reindex_with_indexers(new_index, indexer, copy=copy, fill_value=fill_value)
   2652 
   2653     def _reindex_with_indexers(self, index, indexer, copy, fill_value):

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in _reindex_with_indexers(self, index, indexer, copy, fill_value)
   2653     def _reindex_with_indexers(self, index, indexer, copy, fill_value):
   2654         new_values = com.take_1d(self.values, indexer, fill_value=fill_value)
-&gt; 2655         return Series(new_values, index=index, name=self.name)
   2656 
   2657     def reindex_axis(self, labels, axis=0, **kwargs):

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in __new__(cls, data, index, dtype, name, copy)
    491         else:
    492             subarr = subarr.view(Series)
--&gt; 493         subarr.index = index
    494         subarr.name = name
    495 

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/lib.so in pandas.lib.SeriesIndex.__set__ (pandas/lib.c:29092)()

AssertionError: Index length did not match values"><pre class="notranslate"><code class="notranslate">In [40]: inactive.plot()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
&lt;ipython-input-40-cdcfa4d871e5&gt; in &lt;module&gt;()
----&gt; 1 inactive.plot()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in plot_series(series, label, kind, use_index, rot, xticks, yticks, xlim, ylim, ax, style, grid, legend, logx, logy, secondary_y, **kwds)
   1730                      secondary_y=secondary_y, **kwds)
   1731 
-&gt; 1732     plot_obj.generate()
   1733     plot_obj.draw()
   1734 

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in generate(self)
    856         self._compute_plot_data()
    857         self._setup_subplots()
--&gt; 858         self._make_plot()
    859         self._post_plot_logic()
    860         self._adorn_subplots()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in _make_plot(self)
   1244             lines = []
   1245             labels = []
-&gt; 1246             x = self._get_xticks(convert_period=True)
   1247 
   1248             plotf = self._get_plot_function()

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/tools/plotting.pyc in _get_xticks(self, convert_period)
   1034                 x = index._mpl_repr()
   1035             elif is_datetype:
-&gt; 1036                 self.data = self.data.reindex(index=index.order())
   1037                 x = self.data.index._mpl_repr()
   1038             else:

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in reindex(self, index, method, level, fill_value, limit, copy, takeable)
   2649 
   2650         # GH4246 (dispatch to a common method with frame to handle possibly duplicate index)
-&gt; 2651         return self._reindex_with_indexers(new_index, indexer, copy=copy, fill_value=fill_value)
   2652 
   2653     def _reindex_with_indexers(self, index, indexer, copy, fill_value):

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in _reindex_with_indexers(self, index, indexer, copy, fill_value)
   2653     def _reindex_with_indexers(self, index, indexer, copy, fill_value):
   2654         new_values = com.take_1d(self.values, indexer, fill_value=fill_value)
-&gt; 2655         return Series(new_values, index=index, name=self.name)
   2656 
   2657     def reindex_axis(self, labels, axis=0, **kwargs):

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/core/series.pyc in __new__(cls, data, index, dtype, name, copy)
    491         else:
    492             subarr = subarr.view(Series)
--&gt; 493         subarr.index = index
    494         subarr.name = name
    495 

/Library/Python/2.7/site-packages/pandas-0.12.0_80_gfcaf9a6_20130729-py2.7-macosx-10.8-intel.egg/pandas/lib.so in pandas.lib.SeriesIndex.__set__ (pandas/lib.c:29092)()

AssertionError: Index length did not match values
</code></pre></div>
<p dir="auto">As I have shown above, my index length and my values are the same length.</p>
<p dir="auto">Running a recent (&lt;2 weeks) build from master on OS X 10.8.4 and Python 2.7.2.</p>
<p dir="auto">xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="11856129" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/3004" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/3004/hovercard" href="https://github.com/pandas-dev/pandas/issues/3004">#3004</a><br>
xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3440791" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/841" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/841/hovercard" href="https://github.com/pandas-dev/pandas/issues/841">#841</a><br>
xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="39027114" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/7873" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/7873/hovercard" href="https://github.com/pandas-dev/pandas/issues/7873">#7873</a><br>
xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="34215786" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/7223" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/7223/hovercard" href="https://github.com/pandas-dev/pandas/issues/7223">#7223</a><br>
xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="48761643" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/8815" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/8815/hovercard" href="https://github.com/pandas-dev/pandas/issues/8815">#8815</a></p>
<p dir="auto">Building on <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/immerrr/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/immerrr">@immerrr</a>'s excellent refactor in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="48158607" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/8753" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/8753/hovercard" href="https://github.com/pandas-dev/pandas/pull/8753">#8753</a>, I would like to propose adding a <code class="notranslate">get_nearest</code> method to pandas.Index that does nearest neighbor lookups. The idea is that nearest neighbor lookups are usually the desirable/sane thing to do when using inexact indexes. Eventually, we might want to add an alternative "wrapper index" (like IntervalIndex), e.g., <code class="notranslate">NearestNeighborIndex</code> which switches the default behavior; this would be an intermediate step in that direction.</p>
<p dir="auto">The implementation would be a simple wrapper that calls <code class="notranslate">Index.get_slice_bound</code> twice, once to the left and once to the right. Ideally, this would this would even work for array-like arguments, though perhaps there should be separate <code class="notranslate">get_nearest_loc</code> and <code class="notranslate">get_nearest_indexer</code> methods.</p>