I only need code to recognize the dtype of columns as done in pandas profiling (numeric and categorical) could you please extract only that code for me from pandas profiling package code.
series = series.fillna(np.nan)
# get `infer_dtypes` (bool) from config
if config.infer_dtypes:
# Infer variable types
vtype = typeset.infer_type(series)
series = typeset.cast_to_inferred(series)
else:
# Detect variable types from pandas dataframe (df.dtypes).
# [new dtypes, changed using `astype` function are now considered]
vtype = typeset.detect_type(series)