📅  最后修改于: 2022-03-11 14:46:21.958000             🧑  作者: Mango
import seaborn as sns
df = sns.load_dataset('iris')
def encode(x):
for i,j in enumerate(df['species'].unique()):
if x == j:
return i
df['species'] = df['species'].apply(lambda x:encode(x))