pandas の dtype 判定

pandas の dtype 判定ように apiがある。

from pandas.api.types import is_string_dtype
from pandas.api.types import is_numeric_dtype

is_string_dtype(df['A'])
>>>> True

is_numeric_dtype(df['B'])
>>>> True

stackoverflow.com