pandas中的categorical类型 对象 属性 生成方法 将dataframe的一列转换为categorical对象 其他序列直接生成 利用分类编码数据生成 使用Categorical对象进行计算 对象 属性 categories codes 生成方法 将dataframe的一列转换为categorical对象 df[name] = df[name].astype('category') 其他序列直接生成 pd.Categorical(list) 利用分类编码数据生成