Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id_kat=(2, 1, 10, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44)
- def is_category(catId, colId):
- if catId==colId:
- return 1
- else:
- return 0
- for i in range( len(id_kat) ):
- df2['iscat_'+str(id_kat[i]) ] = df2.categoryId.apply(lambda x: is_category(x, id_kat[i]) )
- # w wyniku tego do dataframe zostały doklejony kolumny iscat_1..iscat_44 z kodowaniem binarnym.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement