Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.preprocessing import binarize
- import pandas as pd
- df = pd.read_csv('data.csv')
- b = binarize(df, threshold=1)
- print(df)
- print(b)
- df
- data
- 0 1
- 1 2
- 2 1
- 3 2
- 4 1
- 5 2
- array([[0],
- [1],
- [0],
- [1],
- [0],
- [1]])
Add Comment
Please, Sign In to add comment