Skip to content

Commit f9b05e2

Browse files
committed
small fix to fill-in defaults
1 parent 941a54d commit f9b05e2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

type_infer/api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ def infer_types(
1818
data : pd.DataFrame
1919
The input dataset for which we want to infer data type information.
2020
"""
21-
if config is None or 'engine' not in config:
21+
# Set global defaults if missing
22+
if config is None:
2223
config = {'engine': 'rule_based', 'pct_invalid': 2, 'seed': 420, 'mp_cutoff': 1e4}
24+
elif 'engine' not in config:
25+
config['engine'] = 'rule_based'
26+
27+
if 'pct_invalid' not in config:
28+
config['pct_invalid'] = 2
29+
30+
if 'seed' not in config:
31+
config['seed'] = 420
2332

2433
if config['engine'] == ENGINES.RULE_BASED:
34+
if 'mp_cutoff' not in config:
35+
config['mp_cutoff'] = 1e4
36+
2537
engine = RuleBasedEngine(config)
2638
return engine.infer(data)
2739
else:

0 commit comments

Comments
 (0)