I have the following dataframe:
import pandas as pd import numpy as np df = pd.DataFrame(dict(A = np.arange(3), B = np.random.randn
You can use parameter reduce=False and more info here:
reduce=False
print (df.apply(lambda x: x.dtype, reduce=False)) A int32 B float64 C object D datetime64[ns] dtype: object
In newer versions of pandas is possible use:
print (df.apply(lambda x: x.dtype, result_type='expand'))