def infer_vegalite_type(data, ordinal_threshold=<NUM_LIT:6>):
<EOL>typ = pd_infer_dtype(data, **_infer_dtype_kwds)<EOL>if typ in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if ordinal_threshold and pd.Series(data).nunique() <= ordinal_threshold:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT><DEDENT>elif typ in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif typ in ('<STR_LIT:string>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:object>'):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif typ in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT:date>', '<STR_LIT:time>', '<STR_LIT>'):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>".format(typ))<EOL>return '<STR_LIT>'<EOL><DEDENT>
From an array-like input, infer the correct vega typecode
('ordinal', 'nominal', 'quantitative', or 'temporal')

Parameters
----------
data: Numpy array or Pandas Series
    data for which the type will be inferred
ordinal_threshold: integer (default: 0)
    integer data will result in a 'quantitative' type, unless the
    number of unique values is smaller than ordinal_threshold.

Adapted from code at http://github.com/altair-viz/altair/
Licence: BSD-3