One other way you can try this is to use selected_row_indices instead. Use this example as a reference for what you are looking for. and you will be able to simply append row indices instead of storing an entire ID as well so it should be more data efficient if you specify the dtype.