-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: np.min(pd.Index) and np.max(pd.Index) raise a TypeError #26125
New issue
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
Comments
Related issue: numpy/numpy#13285 |
I have looked a bit into this, but I am not satisfied with what I got. My understanding is that as of today A dirty fix is to add a kwargs passthrough arg to
It does not break tests, but it is a public interface modification 👎 |
this is what we do for all other method and is acceptable |
Ok then, I will make a PR. |
Code Sample, a copy-pastable example if possible
Note that other numpy functions work fine:
And
np.min
andnp.max
work on other pandas data structures:Problem description
Both
np.min
andnp.max
raise aTypeError
when applied to apd.Index
. Usingpd.Index.min
andpd.Index.max
is more idiomatic for pandas, but using the numpy equivalent functions should work, as they do for other pandas data structures.Expected Output
I'd expect
np.min(pd.Index)
andnp.max(pd.Index)
to be equivalent topd.Index.min
andpd.Index.max
, as is the case with other pandas data structures.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: 8b60ebb
python: 3.6.8.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.25.0.dev0+421.g8b60ebb359
pytest: 4.2.0
pip: 19.0.1
setuptools: 40.6.3
Cython: 0.28.2
numpy: 1.16.2
scipy: 1.2.1
pyarrow: 0.6.0
xarray: 0.9.6
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.9
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 0.9.8
lxml.etree: 3.8.0
bs4: None
html5lib: 0.999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: 0.1.5
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: