Skip to content

Commit 33e59e7

Browse files
committed
Simplify
1 parent 3876dd8 commit 33e59e7

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pandas/core/window.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -625,29 +625,27 @@ def _validate_win_type(win_type, kwargs):
625625
'gaussian': ['std'],
626626
'general_gaussian': ['power', 'width'],
627627
'slepian': ['width'],
628-
'exponential': ['center', 'tau']}
629-
immutable_args_map = {'exponential': {'center': None}}
628+
'exponential': ['tau'],
629+
}
630630

631631
if win_type in arg_map:
632-
immutable_args = immutable_args_map.get(win_type, {})
633-
return tuple([win_type] + _pop_args(win_type,
634-
arg_map[win_type],
635-
immutable_args,
636-
kwargs))
632+
win_args = _pop_args(win_type, arg_map[win_type], kwargs)
633+
if win_type == 'exponential':
634+
# exponential window requires the first arg (center)
635+
# to be set to None (necessary for symmetric window)
636+
win_args.insert(0, None)
637+
638+
return tuple([win_type] + win_args)
637639

638640
return win_type
639641

640-
def _pop_args(win_type, arg_names, immutable_args, kwargs):
642+
def _pop_args(win_type, arg_names, kwargs):
641643
msg = '%s window requires %%s' % win_type
642644
all_args = []
643645
for n in arg_names:
644-
if n in immutable_args:
645-
value = immutable_args[n]
646-
elif n in kwargs:
647-
value = kwargs.pop(n)
648-
else:
646+
if n not in kwargs:
649647
raise ValueError(msg % n)
650-
all_args.append(value)
648+
all_args.append(kwargs.pop(n))
651649
return all_args
652650

653651
win_type = _validate_win_type(self.win_type, kwargs)

0 commit comments

Comments
 (0)