Skip to content

Commit bfcfdab

Browse files
committed
fix naming in dict
1 parent 047e64c commit bfcfdab

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/core/ops.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,11 @@ def _create_methods(cls, arith_method, comp_method, bool_method,
529529
# divmod doesn't have an op that is supported by numexpr
530530
new_methods['divmod'] = arith_method(cls, divmod, special)
531531

532-
new_methods = {v.__name__: v for k, v in new_methods.items()}
532+
if special:
533+
dunderize = lambda x: '__{name}__'.format(name=x.strip('_'))
534+
else:
535+
dunderize = lambda x: x
536+
new_methods = {dunderize(k): v for k, v in new_methods.items()}
533537
return new_methods
534538

535539

@@ -565,7 +569,6 @@ def add_special_arithmetic_methods(cls, arith_method=None,
565569
"""
566570
new_methods = _create_methods(cls, arith_method, comp_method, bool_method,
567571
special=True)
568-
569572
# inplace operators (I feel like these should get passed an `inplace=True`
570573
# or just be removed
571574

@@ -1368,7 +1371,7 @@ def f(self, other, axis=0):
13681371
comp_method=_comp_method_PANEL,
13691372
bool_method=_arith_method_PANEL)
13701373

1371-
panel_flex_funcs = dict(arith_method=_flex_method_PANEL,
1374+
panel_flex_funcs = dict(flex_arith_method=_flex_method_PANEL,
13721375
flex_comp_method=_comp_method_PANEL)
13731376

13741377
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)