File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,9 @@ def set_option(*args) -> None:
199199
200200 Parameters
201201 ----------
202- *args : str | object
202+ *args : str | object | dict
203203 Arguments provided in pairs, which will be interpreted as (pattern, value)
204- pairs.
204+ pairs, or as a single dictionary containing multiple option-value pairs .
205205 pattern: str
206206 Regexp which should match a single option
207207 value: object
@@ -248,6 +248,21 @@ def set_option(*args) -> None:
248248 [2 rows x 5 columns]
249249 >>> pd.reset_option("display.max_columns")
250250 """
251+ # Handle dictionary input
252+ if len (args ) == 1 and isinstance (args [0 ], dict ):
253+ options_dict = args [0 ]
254+ for k , v in options_dict .items ():
255+ key = _get_single_key (k )
256+ opt = _get_registered_option (key )
257+ if opt and opt .validator :
258+ opt .validator (v )
259+ # walk the nested dict
260+ root , k_root = _get_root (key )
261+ root [k_root ] = v
262+ if opt .cb :
263+ opt .cb (key )
264+ return
265+
251266 # must at least 1 arg deal with constraints later
252267 nargs = len (args )
253268 if not nargs or nargs % 2 != 0 :
You can’t perform that action at this time.
0 commit comments