@@ -146,31 +146,6 @@ def _maybe_match_name(a, b):
146146# -----------------------------------------------------------------------------
147147
148148
149- def _get_frame_op_default_axis (name : str ) -> Optional [str ]:
150- """
151- Only DataFrame cares about default_axis, specifically:
152- special methods have default_axis=None and flex methods
153- have default_axis='columns'.
154-
155- Parameters
156- ----------
157- name : str
158-
159- Returns
160- -------
161- default_axis: str or None
162- """
163- if name .replace ("__r" , "__" ) in ["__and__" , "__or__" , "__xor__" ]:
164- # bool methods
165- return "columns"
166- elif name .startswith ("__" ):
167- # __add__, __mul__, ...
168- return None
169- else :
170- # add, mul, ...
171- return "columns"
172-
173-
174149def _get_op_name (op , special : bool ) -> str :
175150 """
176151 Find the name to attach to this method according to conventions
@@ -619,7 +594,7 @@ def _maybe_align_series_as_frame(frame: "DataFrame", series: "Series", axis: int
619594def arith_method_FRAME (cls : Type ["DataFrame" ], op , special : bool ):
620595 # This is the only function where `special` can be either True or False
621596 op_name = _get_op_name (op , special )
622- default_axis = _get_frame_op_default_axis ( op_name )
597+ default_axis = None if special else "columns"
623598
624599 na_op = get_array_op (op )
625600
@@ -671,8 +646,7 @@ def f(self, other, axis=default_axis, level=None, fill_value=None):
671646def flex_comp_method_FRAME (cls : Type ["DataFrame" ], op , special : bool ):
672647 assert not special # "special" also means "not flex"
673648 op_name = _get_op_name (op , special )
674- default_axis = _get_frame_op_default_axis (op_name )
675- assert default_axis == "columns" , default_axis # because we are not "special"
649+ default_axis = "columns" # because we are "flex"
676650
677651 doc = _flex_comp_doc_FRAME .format (
678652 op_name = op_name , desc = _op_descriptions [op_name ]["desc" ]
0 commit comments