Repository: modin-project/modin

Issue:
`modin/pandas/test/dataframe/test_indexing.py::test_loc_series` failed on master CI
Link: https://github.com/modin-project/modin/actions/runs/6093900128/job/16536041233

Error:
```bash
FAILED modin/pandas/test/dataframe/test_indexing.py::test_loc_series - ray.exceptions.RayTaskError(ValueError): ray::_deploy_ray_func() (pid=9951, ip=10.1.0.183)
    At least one of the input arguments for this task could not be computed:
  ray.exceptions.RayTaskError: ray::_apply_list_of_funcs() (pid=9951, ip=10.1.0.183)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/dtypes/cast.py", line 1[775](https://github.com/modin-project/modin/actions/runs/6093900128/job/16536041233#step:14:777), in np_can_hold_element
      raise LossySetitemError
  pandas.errors.LossySetitemError
  
  During handling of the above exception, another exception occurred:
  
  ray::_apply_list_of_funcs() (pid=9951, ip=10.1.0.183)
    File "/home/runner/work/modin/modin/modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py", line 421, in _apply_list_of_funcs
      partition = func(partition, *args, **kwargs)
    File "/home/runner/work/modin/modin/modin/core/storage_formats/pandas/query_compiler.py", line 4244, in iloc_mut
      partition.iloc[row_internal_indices, col_internal_indices] = item
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/indexing.py", line 885, in __setitem__
      iloc._setitem_with_indexer(indexer, value, self.name)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/indexing.py", line 1893, in _setitem_with_indexer
      self._setitem_with_indexer_split_path(indexer, value, name)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/indexing.py", line 1933, in _setitem_with_indexer_split_path
      self._setitem_with_indexer_2d_value(indexer, value)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/indexing.py", line 2008, in _setitem_with_indexer_2d_value
      self._setitem_single_column(loc, value_col, pi)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/indexing.py", line 2095, in _setitem_single_column
      self.obj._mgr.column_setitem(loc, plane_indexer, value)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 1308, in column_setitem
      new_mgr = col_mgr.setitem((idx,), value)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 399, in setitem
      return self.apply("setitem", indexer=indexer, value=value)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 354, in apply
      applied = getattr(b, f)(**kwargs)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/internals/blocks.py", line 1166, in setitem
      nb = self.coerce_to_target_dtype(value, warn_on_upcast=True)
    File "/usr/share/miniconda3/envs/modin/lib/python3.9/site-packages/pandas/core/internals/blocks.py", line 476, in coerce_to_target_dtype
      and lib.has_only_ints_or_nan(other)
    File "lib.pyx", line 535, in pandas._libs.lib.has_only_ints_or_nan
    File "stringsource", line 660, in View.MemoryView.memoryview_cwrapper
    File "stringsource", line 350, in View.MemoryView.memoryview.__cinit__
  ValueError: buffer source array is read-only
```


Discussion:

Resolving patch:
diff --git a/modin/core/storage_formats/pandas/query_compiler.py b/modin/core/storage_formats/pandas/query_compiler.py
--- a/modin/core/storage_formats/pandas/query_compiler.py
+++ b/modin/core/storage_formats/pandas/query_compiler.py
@@ -4241,7 +4241,16 @@ def iloc_mut(partition, row_internal_indices, col_internal_indices, item):
                 Partition data with updated values.
             """
             partition = partition.copy()
-            partition.iloc[row_internal_indices, col_internal_indices] = item
+            try:
+                partition.iloc[row_internal_indices, col_internal_indices] = item
+            except ValueError:
+                # `copy` is needed to avoid "ValueError: buffer source array is read-only" for `item`
+                # because the item may be converted to the type that is in the dataframe.
+                # TODO: in the future we will need to convert to the correct type manually according
+                # to the following warning. Example: "FutureWarning: Setting an item of incompatible
+                # dtype is deprecated and will raise in a future error of pandas. Value '[1.38629436]'
+                # has dtype incompatible with int64, please explicitly cast to a compatible dtype first."
+                partition.iloc[row_internal_indices, col_internal_indices] = item.copy()
             return partition
 
         new_modin_frame = self._modin_frame.apply_select_indices(


Test patch:
diff --git a/modin/numpy/test/utils.py b/modin/numpy/test/utils.py
--- a/modin/numpy/test/utils.py
+++ b/modin/numpy/test/utils.py
@@ -16,7 +16,7 @@
 import modin.numpy as np
 
 
-def assert_scalar_or_array_equal(x1, x2, err_msg=None):
+def assert_scalar_or_array_equal(x1, x2, err_msg=""):
     """
     Assert whether the result of the numpy and modin computations are the same.