|
9 | 9 |
|
10 | 10 | import pandas as pd |
11 | 11 | from pandas import ( |
12 | | - CategoricalIndex, DatetimeIndex, Float64Index, Index, Int64Index, |
13 | | - IntervalIndex, MultiIndex, PeriodIndex, RangeIndex, Series, TimedeltaIndex, |
14 | | - UInt64Index, isna) |
| 12 | + CategoricalIndex, DatetimeIndex, Index, Int64Index, IntervalIndex, |
| 13 | + MultiIndex, PeriodIndex, RangeIndex, Series, TimedeltaIndex, UInt64Index, |
| 14 | + isna) |
15 | 15 | from pandas.core.indexes.base import InvalidIndexError |
16 | 16 | from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin |
17 | 17 | import pandas.util.testing as tm |
@@ -677,58 +677,9 @@ def test_equals_op(self): |
677 | 677 | tm.assert_numpy_array_equal(index_a == item, expected3) |
678 | 678 | tm.assert_series_equal(series_a == item, Series(expected3)) |
679 | 679 |
|
680 | | - def test_numpy_ufuncs(self): |
681 | | - # test ufuncs of numpy, see: |
682 | | - # http://docs.scipy.org/doc/numpy/reference/ufuncs.html |
683 | | - |
684 | | - for name, idx in self.indices.items(): |
685 | | - for func in [np.exp, np.exp2, np.expm1, np.log, np.log2, np.log10, |
686 | | - np.log1p, np.sqrt, np.sin, np.cos, np.tan, np.arcsin, |
687 | | - np.arccos, np.arctan, np.sinh, np.cosh, np.tanh, |
688 | | - np.arcsinh, np.arccosh, np.arctanh, np.deg2rad, |
689 | | - np.rad2deg]: |
690 | | - if isinstance(idx, DatetimeIndexOpsMixin): |
691 | | - # raise TypeError or ValueError (PeriodIndex) |
692 | | - # PeriodIndex behavior should be changed in future version |
693 | | - with pytest.raises(Exception): |
694 | | - with np.errstate(all='ignore'): |
695 | | - func(idx) |
696 | | - elif isinstance(idx, (Float64Index, Int64Index, UInt64Index)): |
697 | | - # coerces to float (e.g. np.sin) |
698 | | - with np.errstate(all='ignore'): |
699 | | - result = func(idx) |
700 | | - exp = Index(func(idx.values), name=idx.name) |
701 | | - |
702 | | - tm.assert_index_equal(result, exp) |
703 | | - assert isinstance(result, pd.Float64Index) |
704 | | - else: |
705 | | - # raise AttributeError or TypeError |
706 | | - if len(idx) == 0: |
707 | | - continue |
708 | | - else: |
709 | | - with pytest.raises(Exception): |
710 | | - with np.errstate(all='ignore'): |
711 | | - func(idx) |
712 | | - |
713 | | - for func in [np.isfinite, np.isinf, np.isnan, np.signbit]: |
714 | | - if isinstance(idx, DatetimeIndexOpsMixin): |
715 | | - # raise TypeError or ValueError (PeriodIndex) |
716 | | - with pytest.raises(Exception): |
717 | | - func(idx) |
718 | | - elif isinstance(idx, (Float64Index, Int64Index, UInt64Index)): |
719 | | - # Results in bool array |
720 | | - result = func(idx) |
721 | | - assert isinstance(result, np.ndarray) |
722 | | - assert not isinstance(result, Index) |
723 | | - else: |
724 | | - if len(idx) == 0: |
725 | | - continue |
726 | | - else: |
727 | | - with pytest.raises(Exception): |
728 | | - func(idx) |
729 | | - |
730 | 680 | def test_hasnans_isnans(self): |
731 | 681 | # GH 11343, added tests for hasnans / isnans |
| 682 | + |
732 | 683 | for name, index in self.indices.items(): |
733 | 684 | if isinstance(index, MultiIndex): |
734 | 685 | pass |
|
0 commit comments