I\'m trying to find a better way to assert the column data type in Python/Pandas of a given dataframe.
For example:
import pandas as pd t = pd.DataFrame(
You can do this
import numpy as np numeric_dtypes = [np.dtype('int64'), np.dtype('float64')] # or whatever types you want assert t[numeric_cols].apply(lambda c: c.dtype).isin(numeric_dtypes).all()