熊猫选择数字列

时间:2019-11-14 07:19:31

标签: python pandas numpy

我正在尝试在python中选择数据类型

binary = [c for c in data.columns if data[c].nunique() == 2]
numerical = [c for c in data.columns if data.select_dtypes(exclude=['int'])]
categorical = [c for c in data.columns if (c not in numerical) & (c not in binary)]

但是在选择数值变量时出现了贝洛错误

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

0 个答案:

没有答案