Filtering and onehotting data