I am trying to get the datatypes of all the elements in a dataframe into a new dataframe and was wondering if there is a native Pandas function for this case?
Example:
import pandas as pd
d = {'col1': [1, '2', 2.0, []], 'col2': [3, '4', 4.0, []]}
df = pd.DataFrame(data=d)
col1 col2
0 1 3
1 2 4
2 2 4
3 [] []
Expected result:
col1 col2
0 int int
1 str str
2 float float
3 list list