A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/13006 below:

Type error when comparing numpy scalar to pandas series · Issue #13006 · pandas-dev/pandas · GitHub

Hi,

I'm getting strange results when comparing a numpy float to a pandas series. It seems to think that the numpy float is some sort of array...

import numpy as np
import pandas as pd
np.float64(0) < pd.Series([1,2,3],dtype=np.float64)
Expected Output
0    True
1    True
2    True
dtype: bool
Actual Output
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-0803a1472416> in <module>()
      1 import numpy as np
      2 import pandas as pd
----> 3 np.float64(0) < pd.Series([1,2,3],dtype=np.float64)
        global np.float64 = <type 'numpy.float64'>
        global pd.Series = <class 'pandas.core.series.Series'>
        global dtype = undefined

/usr/local/lib/python2.7/dist-packages/pandas/core/ops.pyc in wrapper(self=0    1.0
1    2.0
2    3.0
dtype: float64, other=array(0.0), axis=None)
    737             return NotImplemented
    738         elif isinstance(other, (np.ndarray, pd.Index)):
--> 739             if len(self) != len(other):
        global len = undefined
        self = 0    1.0
1    2.0
2    3.0
dtype: float64
        other = array(0.0)
    740                 raise ValueError('Lengths must match to compare')
    741             return self._constructor(na_op(self.values, np.asarray(other)),

TypeError: len() of unsized object


output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.3.0-040300-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.0
nose: None
pip: 8.1.1
setuptools: 20.3.1
Cython: None
numpy: 1.11.0
scipy: 0.17.0
statsmodels: None
xarray: None
IPython: 4.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: 0.8
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4