From e89fcaabc9b0abbccd078453ed852ebd3956bc3e Mon Sep 17 00:00:00 2001 From: "Richard (Rick) Zamora" Date: Tue, 23 Apr 2024 03:42:34 -0500 Subject: [PATCH] avoid divide-by-zero error (#366) --- merlin/io/writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merlin/io/writer.py b/merlin/io/writer.py index 66c24170d..b4e472a67 100644 --- a/merlin/io/writer.py +++ b/merlin/io/writer.py @@ -195,7 +195,7 @@ def _add_data_slice(self, df): # the df and write out slices. if self.shuffle: df = shuffle_df(df) - int_slice_size = df.shape[0] // self.num_out_files + int_slice_size = max(df.shape[0] // self.num_out_files, 1) slice_size = int_slice_size if df.shape[0] % int_slice_size == 0 else int_slice_size + 1 for x in range(self.num_out_files): start = x * slice_size