Repository: pandas-dev/pandas

Issue:
BUG: test_boxplot failure
`test_graphics.py` seems to be failing for me:

```
test_boxplot (__main__.TestDataFramePlots) ... > /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/internals.py(64)__init__()
-> '%d' % (len(values), len(items)))
(Pdb) bt
  /usr/lib/python2.7/unittest/case.py(331)run()
-> testMethod()
  /home/dsm/sys/pandas/pandas/tests/test_graphics.py(633)test_boxplot()
-> _check_plot_works(df.boxplot, column=['one', 'two'], by='indic')
  /home/dsm/sys/pandas/pandas/tests/test_graphics.py(1226)_check_plot_works()
-> ret = f(*args, **kwargs)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/frame.py(4865)boxplot()
-> fontsize=fontsize, grid=grid, rot=rot, **kwds)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/tools/plotting.py(1995)boxplot()
-> ax=ax)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/tools/plotting.py(2409)_grouped_plot_by_column()
-> plotf(gp_col, ax, **kwargs)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/tools/plotting.py(1973)plot_group()
-> bp = ax.boxplot(values, **kwds)
  /usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-i686.egg/matplotlib/axes/_axes.py(3003)boxplot()
-> labels=labels)
  /usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-i686.egg/matplotlib/cbook.py(2029)boxplot_stats()
-> np.compress(x < stats['whislo'], x),
  /usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py(1560)compress()
-> return _wrapit(a, 'compress', condition, axis, out)
  /usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py(47)_wrapit()
-> result = wrap(result)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/series.py(374)__array_wrap__()
-> copy=False).__finalize__(self)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/series.py(232)__init__()
-> data = SingleBlockManager(data, index, fastpath=True)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/internals.py(3670)__init__()
-> block = make_block(block, axis, axis, ndim=1, fastpath=True)
  /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/internals.py(2058)make_block()
-> placement=placement)
> /usr/local/lib/python2.7/dist-packages/pandas-0.13.1_436_g4216178-py2.7-linux-i686.egg/pandas/core/internals.py(64)__init__()
-> '%d' % (len(values), len(items)))
(Pdb) print values
[]
(Pdb) print items
Index([u'b', u'd', u'f'], dtype='object')
(Pdb) print ref_items
Index([u'b', u'd', u'f'], dtype='object')
(Pdb) print ndim
1
(Pdb) print fastpath
True
(Pdb) print placement
None
```

Standard TMI dump:

```
>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.5.final.0
python-bits: 32
OS: Linux
OS-release: 3.11.0-18-generic
machine: i686
processor: i686
byteorder: little
LC_ALL: None
LANG: en_CA.UTF-8

pandas: 0.13.1-436-g4216178
Cython: 0.20.1
numpy: 1.9.0.dev-e792e15
scipy: 0.15.0.dev-4aa534f
statsmodels: 0.6.0.dev-f3f5467
IPython: 1.2.1
sphinx: 1.2.2
patsy: 0.2.1
scikits.timeseries: None
dateutil: 2.2
pytz: 2014.1
bottleneck: 0.8.0
tables: None
numexpr: 2.3.1
matplotlib: 1.4.x
openpyxl: 1.8.4
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: None
lxml: 3.3.3
bs4: 4.3.2
html5lib: 1.0b3
bq: None
apiclient: 1.2
rpy2: None
sqlalchemy: 0.9.3
pymysql: None
psycopg2: None
```



Discussion:

Resolving patch:
diff --git a/pandas/core/series.py b/pandas/core/series.py
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -342,6 +342,10 @@ def base(self):
     def ravel(self, order='C'):
         return self.values.ravel(order=order)
 
+    def compress(self, condition, axis=0, out=None, **kwargs):
+        # 1-d compat with numpy
+        return self[condition]
+
     def transpose(self):
         """ support for compatiblity """
         return self


Test patch:
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -3436,6 +3436,15 @@ def f(x):
         s = Series(np.random.randn(10))
         tm.assert_almost_equal(s.ravel(order='F'),s.values.ravel(order='F'))
 
+        # compress
+        # GH 6658
+        s = Series([0,1.,-1],index=list('abc'))
+        result = np.compress(s>0,s)
+        assert_series_equal(result, Series([1.],index=['b']))
+
+        result = np.compress(s<-1,s)
+        assert_series_equal(result, Series([],dtype='float64'))
+
     def test_complexx(self):
 
         # GH4819