We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's pretty unexpected that the behavior of x <= pd.Series(...) depends on whether x is a python float or a np.float64:
x <= pd.Series(...)
x
np.float64
>>> import pandas as pd >>> import numpy as np >>> 5 <= pd.Series(range(10)) 0 False 1 False 2 False 3 False 4 False 5 True 6 True 7 True 8 True 9 True dtype: bool >>> np.float64(5) <= pd.Series(range(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/pandas/core/ops.py", line 588, in wrapper if len(self) != len(other): TypeError: len() of unsized object >>> pd.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 2.7.3.final.0 python-bits: 64 OS: Linux OS-release: 3.2.0-54-virtual machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 pandas: 0.16.2 nose: 1.3.3 Cython: None numpy: 1.9.2 scipy: 0.14.0 statsmodels: 0.5.0 IPython: 0.12.1 sphinx: None patsy: 0.3.0 dateutil: 2.2 pytz: 2014.4 bottleneck: None tables: None numexpr: None matplotlib: 1.3.1 openpyxl: 1.8.6 xlrd: 0.9.3 xlwt: None xlsxwriter: None lxml: 3.3.2 bs4: None html5lib: None httplib2: 0.7.2 apiclient: None sqlalchemy: None pymysql: None psycopg2: 2.5.2 (dt dec pq3 ext) >>>
The text was updated successfully, but these errors were encountered:
Note that the issue isn't present on the other side:
>>> pd.Series(range(10)) >= 5 0 False 1 False 2 False 3 False 4 False 5 True 6 True 7 True 8 True 9 True dtype: bool >>> pd.Series(range(10)) >= np.float64(5) 0 False 1 False 2 False 3 False 4 False 5 True 6 True 7 True 8 True 9 True dtype: bool
Apologies if this is a duplicate!
Sorry, something went wrong.
I can replicate this on 0.16.2 This definitely looks like a bug to me -- I guess we just didn't have test coverage for this.
dupe of #9369 thanks for the report though!
Excellent, thanks!
No branches or pull requests
It's pretty unexpected that the behavior of
x <= pd.Series(...)
depends on whetherx
is a python float or anp.float64
:The text was updated successfully, but these errors were encountered: