From 2183f7bf71a90661877c87fe04dcd52efa481184 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 2 Oct 2018 11:17:28 -0500 Subject: [PATCH] api --- pandas/tests/extension/decimal_array/__init__.py | 2 +- pandas/tests/extension/decimal_array/array.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/extension/decimal_array/__init__.py b/pandas/tests/extension/decimal_array/__init__.py index 9a0071e1c776e..6bdfa0e05e0a0 100644 --- a/pandas/tests/extension/decimal_array/__init__.py +++ b/pandas/tests/extension/decimal_array/__init__.py @@ -1,4 +1,4 @@ from .array import DecimalArray, DecimalDtype -__all__ = ['DecimalArray', 'DecimalDtype'] +__all__ = ['DecimalArray', 'DecimalDtype', 'to_decimal', 'make_data'] diff --git a/pandas/tests/extension/decimal_array/array.py b/pandas/tests/extension/decimal_array/array.py index 387942234e6fd..f324cc2e0f345 100644 --- a/pandas/tests/extension/decimal_array/array.py +++ b/pandas/tests/extension/decimal_array/array.py @@ -138,5 +138,9 @@ def _concat_same_type(cls, to_concat): return cls(np.concatenate([x._data for x in to_concat])) +def to_decimal(values, context=None): + return DecimalArray([decimal.Decimal(x) for x in values], context=context) + + DecimalArray._add_arithmetic_ops() DecimalArray._add_comparison_ops()