From 987d8c734a2ef5e9b38140c5b134b8a965d79378 Mon Sep 17 00:00:00 2001 From: rjzamora Date: Wed, 17 Apr 2024 15:04:16 -0700 Subject: [PATCH] avoid divide-by-zero error --- 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