Skip to content

Commit d26d3d2

Browse files
committed
Squashed commit of the following:
commit c9d6e89 Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 08:34:22 2018 -0500 xpass -> skip commit 95d5cbf Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 08:22:17 2018 -0500 typo, import commit 4e9b7f0 Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 08:18:40 2018 -0500 doc update commit cc2bfc8 Merge: 11a0d93 fe67b94 Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 08:15:46 2018 -0500 Merge remote-tracking branch 'upstream/master' into ea-divmod commit fe67b94 Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 06:55:09 2018 -0500 Update type for PeriodDtype / DatetimeTZDtype / IntervalDtype (pandas-dev#22938) commit b12e5ba Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 06:30:29 2018 -0500 Safer is dtype (pandas-dev#22975) commit c19c805 Author: Tom Augspurger <[email protected]> Date: Thu Oct 4 06:27:54 2018 -0500 Catch Exception in combine (pandas-dev#22936) commit d553ab3 Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:24:06 2018 +0200 TST: Fixturize series/test_combine_concat.py (pandas-dev#22964) commit 4c78b97 Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:23:39 2018 +0200 TST: Fixturize series/test_constructors.py (pandas-dev#22965) commit 45d3bb7 Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:23:20 2018 +0200 TST: Fixturize series/test_datetime_values.py (pandas-dev#22966) commit f1a22ff Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:22:21 2018 +0200 TST: Fixturize series/test_dtypes.py (pandas-dev#22967) commit abf68fd Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:21:45 2018 +0200 TST: Fixturize series/test_io.py (pandas-dev#22972) commit e6b0c29 Author: Anjali2019 <[email protected]> Date: Thu Oct 4 13:20:46 2018 +0200 TST: Fixturize series/test_missing.py (pandas-dev#22973) commit 9b405b8 Author: Joris Van den Bossche <[email protected]> Date: Thu Oct 4 13:16:28 2018 +0200 CLN: values is required argument in _shallow_copy_with_infer (pandas-dev#22983) commit c282e31 Author: h-vetinari <[email protected]> Date: Thu Oct 4 03:34:35 2018 +0200 Fix ASV import error (pandas-dev#22978) commit 11a0d93 Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 14:26:34 2018 -0500 typerror commit a0cd5e7 Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 14:25:38 2018 -0500 TypeError for Series commit 2247461 Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 13:29:29 2018 -0500 Test op(Series[EA], EA]) commit c9fe5d3 Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 13:21:33 2018 -0500 make strict commit 7ef697c Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 13:14:52 2018 -0500 Use super commit 35d4213 Merge: 0671e7d ee80803 Author: Tom Augspurger <[email protected]> Date: Wed Oct 3 13:11:05 2018 -0500 Merge remote-tracking branch 'upstream/master' into ea-divmod commit 0671e7d Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 11:10:42 2018 -0500 Fixup commit 1b4261f Merge: c92a4a8 1d9f76c Author: Tom Augspurger <[email protected]> Date: Tue Oct 2 10:58:43 2018 -0500 Merge remote-tracking branch 'upstream/master' into ea-divmod commit c92a4a8 Author: Tom Augspurger <[email protected]> Date: Mon Oct 1 16:56:15 2018 -0500 Update old test commit 52538fa Author: Tom Augspurger <[email protected]> Date: Mon Oct 1 16:51:48 2018 -0500 BUG: divmod return type
1 parent 0c7b704 commit d26d3d2

24 files changed

+182
-168
lines changed

.travis.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ matrix:
5353
- dist: trusty
5454
env:
5555
- JOB="3.6, coverage" ENV_FILE="ci/travis-36.yaml" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate" COVERAGE=true DOCTEST=true
56-
# In allow_failures
57-
- dist: trusty
58-
env:
59-
- JOB="3.6, slow" ENV_FILE="ci/travis-36-slow.yaml" SLOW=true
60-
# In allow_failures
56+
6157
- dist: trusty
6258
env:
6359
- JOB="3.7, NumPy dev" ENV_FILE="ci/travis-37-numpydev.yaml" TEST_ARGS="--skip-slow --skip-network -W error" PANDAS_TESTING_MODE="deprecate"
6460
addons:
6561
apt:
6662
packages:
6763
- xsel
64+
65+
# In allow_failures
66+
- dist: trusty
67+
env:
68+
- JOB="3.6, slow" ENV_FILE="ci/travis-36-slow.yaml" SLOW=true
69+
6870
# In allow_failures
6971
- dist: trusty
7072
env:
@@ -73,13 +75,6 @@ matrix:
7375
- dist: trusty
7476
env:
7577
- JOB="3.6, slow" ENV_FILE="ci/travis-36-slow.yaml" SLOW=true
76-
- dist: trusty
77-
env:
78-
- JOB="3.7, NumPy dev" ENV_FILE="ci/travis-37-numpydev.yaml" TEST_ARGS="--skip-slow --skip-network -W error" PANDAS_TESTING_MODE="deprecate"
79-
addons:
80-
apt:
81-
packages:
82-
- xsel
8378
- dist: trusty
8479
env:
8580
- JOB="3.6, doc" ENV_FILE="ci/travis-36-doc.yaml" DOC=true

asv_bench/benchmarks/indexing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import numpy as np
44
import pandas.util.testing as tm
5-
from pandas import (Series, DataFrame, MultiIndex, Int64Index, Float64Index,
6-
IntervalIndex, CategoricalIndex,
7-
IndexSlice, concat, date_range)
8-
from .pandas_vb_common import setup, Panel # noqa
5+
from pandas import (Series, DataFrame, MultiIndex, Panel,
6+
Int64Index, Float64Index, IntervalIndex,
7+
CategoricalIndex, IndexSlice, concat, date_range)
8+
from .pandas_vb_common import setup # noqa
99

1010

1111
class NumericSeriesIndexing(object):

asv_bench/benchmarks/join_merge.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33

44
import numpy as np
55
import pandas.util.testing as tm
6-
from pandas import (DataFrame, Series, MultiIndex, date_range, concat, merge,
7-
merge_asof)
6+
from pandas import (DataFrame, Series, Panel, MultiIndex,
7+
date_range, concat, merge, merge_asof)
8+
89
try:
910
from pandas import merge_ordered
1011
except ImportError:
1112
from pandas import ordered_merge as merge_ordered
1213

13-
from .pandas_vb_common import Panel, setup # noqa
14+
from .pandas_vb_common import setup # noqa
1415

1516

1617
class Append(object):

asv_bench/benchmarks/panel_ctor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import warnings
22
from datetime import datetime, timedelta
33

4-
from pandas import DataFrame, DatetimeIndex, date_range
4+
from pandas import DataFrame, Panel, DatetimeIndex, date_range
55

6-
from .pandas_vb_common import Panel, setup # noqa
6+
from .pandas_vb_common import setup # noqa
77

88

99
class DifferentIndexes(object):

asv_bench/benchmarks/panel_methods.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import warnings
22

33
import numpy as np
4+
from pandas import Panel
45

5-
from .pandas_vb_common import Panel, setup # noqa
6+
from .pandas_vb_common import setup # noqa
67

78

89
class PanelMethods(object):

doc/source/extending.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ your ``MyExtensionArray`` class, as follows:
167167
element one-by-one, this might not be as performant as implementing your own
168168
version of the associated operators directly on the ``ExtensionArray``.
169169

170-
This implementation will try to reconstruct a new ``ExtensionArray`` with the
171-
result of the element-wise operation. Whether or not that succeeds depends on
172-
whether the operation returns a result that's valid for the ``ExtensionArray``.
173-
If an ``ExtensionArray`` cannot be reconstructed, a list containing the scalars
174-
returned instead.
170+
For arithmetic operations, this implementation will try to reconstruct a new
171+
``ExtensionArray`` with the result of the element-wise operation. Whether
172+
or not that succeeds depends on whether the operation returns a result
173+
that's valid for the ``ExtensionArray``. If an ``ExtensionArray`` cannot
174+
be reconstructed, an ndarray containing the scalars returned instead.
175175

176176
.. _extending.extension.testing:
177177

pandas/core/arrays/base.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -781,20 +781,24 @@ def convert_values(param):
781781
# a TypeError should be raised
782782
res = [op(a, b) for (a, b) in zip(lvalues, rvalues)]
783783

784-
if coerce_to_dtype:
785-
if op.__name__ in {'divmod', 'rdivmod'}:
784+
def _maybe_convert(arr):
785+
if coerce_to_dtype:
786+
# https://github.com/pandas-dev/pandas/issues/22850
787+
# We catch all regular exceptions here, and fall back
788+
# to an ndarray.
786789
try:
787-
a, b = zip(*res)
788-
res = (self._from_sequence(a),
789-
self._from_sequence(b))
790+
res = self._from_sequence(arr)
790791
except Exception:
791-
pass
792+
res = np.asarray(arr)
792793
else:
793-
try:
794-
res = self._from_sequence(res)
795-
except Exception:
796-
pass
794+
res = np.asarray(arr)
795+
return res
797796

797+
if op.__name__ in {'divmod', 'rdivmod'}:
798+
a, b = zip(*res)
799+
res = _maybe_convert(a), _maybe_convert(b)
800+
else:
801+
res = _maybe_convert(res)
798802
return res
799803

800804
op_name = ops._get_op_name(op, True)

pandas/core/dtypes/base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import numpy as np
33

44
from pandas import compat
5+
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass, ABCDataFrame
56
from pandas.errors import AbstractMethodError
67

78

@@ -83,7 +84,12 @@ def is_dtype(cls, dtype):
8384
"""
8485
dtype = getattr(dtype, 'dtype', dtype)
8586

86-
if isinstance(dtype, np.dtype):
87+
if isinstance(dtype, (ABCSeries, ABCIndexClass,
88+
ABCDataFrame, np.dtype)):
89+
# https://github.com/pandas-dev/pandas/issues/22960
90+
# avoid passing data to `construct_from_string`. This could
91+
# cause a FutureWarning from numpy about failing elementwise
92+
# comparison from, e.g., comparing DataFrame == 'category'.
8793
return False
8894
elif dtype is None:
8995
return False

pandas/core/frame.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4908,7 +4908,8 @@ def _combine_match_index(self, other, func, level=None):
49084908
return ops.dispatch_to_series(left, right, func)
49094909
else:
49104910
# fastpath --> operate directly on values
4911-
new_data = func(left.values.T, right.values).T
4911+
with np.errstate(all="ignore"):
4912+
new_data = func(left.values.T, right.values).T
49124913
return self._constructor(new_data,
49134914
index=left.index, columns=self.columns,
49144915
copy=False)

pandas/core/indexes/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def _shallow_copy(self, values=None, **kwargs):
540540

541541
return self._simple_new(values, **attributes)
542542

543-
def _shallow_copy_with_infer(self, values=None, **kwargs):
543+
def _shallow_copy_with_infer(self, values, **kwargs):
544544
"""
545545
create a new Index inferring the class with passed value, don't copy
546546
the data, use the same object attributes with passed in attributes
@@ -553,8 +553,6 @@ def _shallow_copy_with_infer(self, values=None, **kwargs):
553553
values : the values to create the new Index, optional
554554
kwargs : updates the default attributes for this Index
555555
"""
556-
if values is None:
557-
values = self.values
558556
attributes = self._get_attributes_dict()
559557
attributes.update(kwargs)
560558
attributes['copy'] = False

0 commit comments

Comments
 (0)