diff --git a/modin/core/dataframe/pandas/dataframe/dataframe.py b/modin/core/dataframe/pandas/dataframe/dataframe.py index ec3ca1ca71c..5da628b4c6a 100644 --- a/modin/core/dataframe/pandas/dataframe/dataframe.py +++ b/modin/core/dataframe/pandas/dataframe/dataframe.py @@ -4068,7 +4068,14 @@ def to_numpy(self, **kwargs): ------- np.ndarray """ - return self._partition_mgr_cls.to_numpy(self._partitions, **kwargs) + arr = self._partition_mgr_cls.to_numpy(self._partitions, **kwargs) + ErrorMessage.catch_bugs_and_request_email( + self.has_materialized_index + and len(arr) != len(self.index) + or self.has_materialized_columns + and len(arr[0]) != len(self.columns) + ) + return arr @lazy_metadata_decorator(apply_axis=None, transpose=True) def transpose(self): diff --git a/modin/core/storage_formats/pandas/query_compiler.py b/modin/core/storage_formats/pandas/query_compiler.py index 7ca93d9a43e..8482d305d0a 100644 --- a/modin/core/storage_formats/pandas/query_compiler.py +++ b/modin/core/storage_formats/pandas/query_compiler.py @@ -378,11 +378,7 @@ def free(self): # To NumPy def to_numpy(self, **kwargs): - arr = self._modin_frame.to_numpy(**kwargs) - ErrorMessage.catch_bugs_and_request_email( - len(arr) != len(self.index) or len(arr[0]) != len(self.columns) - ) - return arr + return self._modin_frame.to_numpy(**kwargs) # END To NumPy