Proper way to use iloc in Pandas

前端 未结 4 1133
故里飘歌
故里飘歌 2020-12-14 04:39

I have the following dataframe df:

print(df)

    Food         Taste
0   Apple        NaN
1   Banana       NaN
2   Candy        NaN
3   Milk         NaN
4            


        
4条回答
  •  囚心锁ツ
    2020-12-14 05:35

    Purely integer-location based indexing for selection by position.. eg :-

    lang_sets = {}
    lang_sets['en'] = train[train.lang == 'en'].iloc[:,:-1]
    lang_sets['ja'] = train[train.lang == 'ja'].iloc[:,:-1]
    lang_sets['de'] = train[train.lang == 'de'].iloc[:,:-1]
    

提交回复
热议问题