Skip to content

Commit d77a058

Browse files
committed
fix doc
1 parent a703cf7 commit d77a058

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

pandas/core/arrays/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ def _create_method(cls, op, coerce_to_dtype=True):
831831
`op` cannot be stored in the ExtensionArray. The dtype of the
832832
ndarray uses NumPy's normal inference rules.
833833
834-
Example
835-
-------
834+
Examples
835+
--------
836836
Given an ExtensionArray subclass called MyExtensionArray, use
837837
838838
>>> __add__ = cls._create_method(operator.add)
@@ -909,8 +909,8 @@ def _create_unary_method(cls, op, coerce_to_dtype=True):
909909
`op` cannot be stored in the ExtensionArray. The dtype of the
910910
ndarray uses NumPy's normal inference rules.
911911
912-
Example
913-
-------
912+
Examples
913+
--------
914914
Given an ExtensionArray subclass called MyExtensionArray, use
915915
>>> __neg__ = cls._create_method(operator.neg)
916916

pandas/tests/arrays/test_integer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def test_integer(self, dtype, op):
363363
# GH#23087
364364
arr = integer_array([1, 3, 2], dtype=dtype)
365365
result = op(arr)
366-
exp = integer_array(op(np.array([1, 3, 2], dtype=dtype)), dtype=dtype)
366+
exp = integer_array(op(np.array([1, 3, 2], dtype=dtype.numpy_dtype)))
367367
tm.assert_extension_array_equal(result, exp)
368368

369369
@pytest.mark.parametrize('op', [operator.pos, operator.neg,
@@ -378,19 +378,19 @@ def test_empty(self, dtype, op):
378378
operator.inv, operator.abs])
379379
def test_mask(self, dtype, op):
380380
# GH#23087
381-
arr = IntegerArray(np.array([1, 2, 3], dtype=dtype),
382-
np.array([False, True, False]))
381+
arr = IntegerArray(np.array([1, 2, 3], dtype=dtype.numpy_dtype),
382+
mask=np.array([False, True, False]))
383383
result = op(arr)
384-
exp = IntegerArray(op(np.array([1, 2, 3], dtype=dtype)),
385-
np.array([False, True, False]))
384+
exp = IntegerArray(op(np.array([1, 2, 3], dtype=dtype.numpy_dtype)),
385+
mask=np.array([False, True, False]))
386386
tm.assert_extension_array_equal(result, exp)
387387

388388
@pytest.mark.parametrize('op', [operator.pos, operator.neg,
389389
operator.inv, operator.abs])
390390
def test_all_mask(self, dtype, op):
391391
# GH#23087
392-
arr = IntegerArray(np.array([1, 1, 1], dtype=dtype),
393-
np.array([True, True, True]))
392+
arr = IntegerArray(np.array([1, 1, 1], dtype=dtype.numpy_dtype),
393+
mask=np.array([True, True, True]))
394394
result = op(arr)
395395
tm.assert_extension_array_equal(result, arr)
396396

pandas/tests/frame/test_arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ def test_arith_non_pandas_object(self):
651651
index=df.index, columns=df.columns)
652652
tm.assert_frame_equal(df.add(val3), added)
653653

654+
654655
# ------------------------------------------------------------------
655656
# Unary
656-
657657
class TestFrameUnary(object):
658658

659659
@pytest.mark.parametrize('typ', ['int64', 'int32', 'int16', 'int8',

pandas/tests/series/test_arithmetic.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,16 @@ def test_integer(self, typ, op):
255255
@pytest.mark.parametrize('op', [operator.pos, operator.neg,
256256
operator.abs])
257257
def test_float(self, float_dtype, op):
258-
typ = float_dtype
259258
# GH#23087
260-
ser = Series([1.1, 3.1, 2.1], index=range(3), dtype=typ)
259+
ser = Series([1.1, 3.1, 2.1], index=range(3), dtype=float_dtype)
261260
result = op(ser)
262261
exp = Series(op(ser.values), index=ser.index)
263262
tm.assert_series_equal(result, exp)
264263

265264
@pytest.mark.parametrize('op', [operator.inv])
266265
def test_float_inv_raise(self, float_dtype, op):
267-
typ = float_dtype
268266
# GH#23087
269-
ser = Series([1.1, 3.1, 2.1], index=range(3), dtype=typ)
267+
ser = Series([1.1, 3.1, 2.1], index=range(3), dtype=float_dtype)
270268
pytest.raises(TypeError, op, ser)
271269
# consistent with numpy
272270
pytest.raises(TypeError, op, ser.values)

0 commit comments

Comments
 (0)