dft = pd.DataFrame(
{
"str1": "foo",
"str2": pd.Series(["bar"] * 3).astype("string"),
"str3": pd.Series(["qux"] * 3).astype("category"),
"float64": np.random.RandomState(64).rand(3),
"int64": 1,
"float32": np.random.RandomState(32).rand(3).astype("float32"),
"int8": pd.Series([1] * 3, dtype="int8"),
"bool": False,
"date1": pd.Timestamp("20010102"),
"date2": pd.date_range("1/1/2015", periods=3),
"date3": np.datetime64('2011-06-24'),
"delta": [pd.Timedelta(days=i) for i in range(3)]
}
)
dft
Display each column along with its data type.
dft.dtypes
Return the column count of each data type.
dft.dtypes.value_counts()