pandas.Series.all
これは私にはバグのように見えます( df
PandasDataFrame
オブジェクトであり、のpd
省略形ですpandas
):
In [18]: df.foo.apply(lambda x: x.startswith(u'bar').head()
Out[18]:
0 True
1 False
2 True
3 True
4 False
Name: foo
In [19]: (df.baz == u'frobozz').head()
Out[19]:
0 False
1 False
2 True
3 True
4 False
Name: baz
In [20]: (type(Out[20]), type(Out[19]))
Out[20]: (pandas.core.series.Series, pandas.core.series.Series)
In [21]: pd.Series.all(Out[18], Out[19])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-310-d132f431d45f> in <module>()
----> 1 pd.Series.all(Out[18], Out[19])
/home/jones/.virtualenvs/proj/local/lib/python2.7/site-packages/pandas/core/series.pyc in f(self, *args, **kwargs)
276 @Appender(func.__doc__)
277 def f(self, *args, **kwargs):
--> 278 result = func(self, *args, **kwargs)
279 if isinstance(result, np.ndarray) and result.ndim == 0:
280 # return NumPy type
/home/jones/.virtualenvs/proj/local/lib/python2.7/site-packages/numpy/core/_methods.pyc in _all(a, axis, dtype, out, keepdims)
28 def _all(a, axis=None, dtype=None, out=None, keepdims=False):
29 return um.logical_and.reduce(a, axis=axis, dtype=dtype, out=out,
---> 30 keepdims=keepdims)
31
32 def _count_reduce_items(arr, axis):
TypeError: only length-1 arrays can be converted to Python scalars
どうしたの?