Skip to content

Commit

Permalink
small fix to fill-in defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
paxcema committed Dec 25, 2023
1 parent 941a54d commit f9b05e2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion type_infer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f9b05e2

Please sign in to comment.