astype方法转换类型
data = [['0', 'Y', 'N'], ['1', 'Y', 'Y'], ['2', 'N', 'Y'], ['3', 'Y', 'Y'], ['4', 'N', 'N']] Products = pd.DataFrame(data, columns=['product_id', 'low_fats', 'recyclable']).astype({'product_id':'int64', 'low_fats':'category', 'recyclable':'category'})
标签:category,fats,product,转换,astype,recyclable,类型,data From: https://www.cnblogs.com/bravesunforever/p/17636284.html