3
有人可以幫我看起來像下面的例子從這裏去一個數據的二進制編碼:蟒蛇 - 逗號分隔字符串列的二進制編碼
df = pd.DataFrame({'_id': [1,2,3],
'test': ['one,two,three', 'one,two', 'two']})
print(df)
_id test
0 1 one,two,three
1 2 one,two
2 3 two
到這裏:
df_result = pd.DataFrame({'id': [1,2,3],
'one': [1,1,0],
'two': [1,1,1],
'three': [1,0,0]})
print(df_result)
id one three two
0 1 1 1 1
1 2 1 0 1
2 3 0 0 1
任何幫助將非常感激! 感謝
哇,非常感謝。我嘗試了一切:) – Codutie