From f9b05e2bb4e3e24789786b6873f250b3e7872abe Mon Sep 17 00:00:00 2001 From: Patricio Cerda Mardini Date: Mon, 25 Dec 2023 18:42:30 +0900 Subject: [PATCH] small fix to fill-in defaults --- type_infer/api.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/type_infer/api.py b/type_infer/api.py index cffcc4d..846541a 100644 --- a/type_infer/api.py +++ b/type_infer/api.py @@ -18,10 +18,22 @@ def infer_types( data : pd.DataFrame The input dataset for which we want to infer data type information. """ - if config is None or 'engine' not in config: + # Set global defaults if missing + if config is None: config = {'engine': 'rule_based', 'pct_invalid': 2, 'seed': 420, 'mp_cutoff': 1e4} + elif 'engine' not in config: + config['engine'] = 'rule_based' + + if 'pct_invalid' not in config: + config['pct_invalid'] = 2 + + if 'seed' not in config: + config['seed'] = 420 if config['engine'] == ENGINES.RULE_BASED: + if 'mp_cutoff' not in config: + config['mp_cutoff'] = 1e4 + engine = RuleBasedEngine(config) return engine.infer(data) else: