-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
DocsExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Description
We should document the expected behavior for binary operations between ExtensionArrays and pandas' own objects (Series, DataFrame, Index). We should update our own EAs to match the docs.
In [4]: integer_array([1, 2]) + pd.Series([1, 2])
Out[4]: IntegerArray([2, 4], dtype='Int64')
Out[4]
should be a Series with "Int64" dtype, to match the behavior of ndarray + series.
We've documented this, but need to test between series, index, dataframe, and the array class
pandas/pandas/tests/extension/base/ops.py
Lines 83 to 88 in 6bf6cd2
def test_arith_series_with_array(self, data, all_arithmetic_operators): | |
# ndarray & other series | |
op_name = all_arithmetic_operators | |
s = pd.Series(data) | |
self.check_opname(s, op_name, pd.Series([s.iloc[0]] * len(s)), | |
exc=self.series_array_exc) |
Metadata
Metadata
Assignees
Labels
DocsExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations