首先创建一个DataFrame
>>> import pandas as pd >>> df= pd.DataFrame({ 'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Yum Yum'], 'style': ['cup', 'cup', 'cup', 'pack', 'pack'], 'rating': [4, 4, 3.5, 15, 5] }) >>> df brand style rating 0 Yum Yum cup 4.0 1 Yum Yum cup 4.0 2 Indomie cup 3.5 3 Indomie pack 15.0 4 Yum Yum pack 5.0
标签:rating,某列,Indomie,cup,DataFrame,Yum,pack,赋值 From: https://www.cnblogs.com/liushao-AI/p/17625815.html