Repository: modin-project/modin

Issue:
BUG: Syntax Error in modin > pandas > indexing.py:829
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
import modin.pandas as mp
import numpy as np

temp = mp.DataFrame({'a': [1,2,3,4,5], 'b': [11,12,13,14,15]}, dtype=object)

temp.loc[[3, 4], ['c', 'd', 'e']] = np.array([[24, 34, 44], [25, 35, 45]])
```


### Issue Description

I think there is a syntax error in the line `829 of modin/pandas/indexing.py`

### Expected Behavior

The expected code is : 

```python

... if item.shape != (len(self.qc.index), len(col_loc)):
...

```

Therefore, the error of the mismatch of the shapes should be as following :

```python-traceback

...\modin\pandas\indexing.py:830, in _LocIndexer._setitem_with_new_columns(self, row_loc, col_loc, item)
    828     else:
    829         if item.shape != (len(self.qc.index), len(col_loc)):
--> 830             raise ValueError(
    831                 "Must have equal len keys and value when setting with an iterable"
    832             )
    833     exist_items = (
    834         item[:, common_label_loc]
    835         if len(item.shape) > 1
    836         else item[common_label_loc]
    837     )
    838 if not all(common_label_loc):
    839     # In this case we have some new cols and some old ones

ValueError: Must have equal len keys and value when setting with an iterable

```

### Error Logs

<details>

```python-traceback

..\lib\site-packages\modin\pandas\indexing.py:829, in _LocIndexer._setitem_with_new_columns(self, row_loc, col_loc, item)
    825         raise ValueError(
    826             "Must have equal len keys and value when setting with an iterable"
    827         )
    828 else:
--> 829     if item.shape != (len(self.qc.index, len(col_loc))):
    830         raise ValueError(
    831             "Must have equal len keys and value when setting with an iterable"
    832         )
    833 exist_items = (
    834     item[:, common_label_loc]
    835     if len(item.shape) > 1
    836     else item[common_label_loc]
    837 )

TypeError: len() takes exactly one argument (2 given)

```

</details>


### Installed Versions

<details>

Modin dependencies
------------------
modin            : 0.19.0
ray              : 2.3.0
...

pandas dependencies
-------------------
pandas           : 1.5.3
...

</details>



Discussion:
thanks @ebalah! I can reproduce the problem.

Resolving patch:
diff --git a/modin/pandas/indexing.py b/modin/pandas/indexing.py
--- a/modin/pandas/indexing.py
+++ b/modin/pandas/indexing.py
@@ -828,8 +828,6 @@ def _setitem_with_new_columns(self, row_loc, col_loc, item):
         item : modin.pandas.DataFrame, modin.pandas.Series or scalar
             Value that should be assigned to located dataset.
         """
-        exist_items = item
-        common_label_loc = np.isin(col_loc, self.qc.columns.values)
         if is_list_like(item) and not isinstance(item, (DataFrame, Series)):
             item = np.array(item)
             if len(item.shape) == 1:
@@ -838,24 +836,20 @@ def _setitem_with_new_columns(self, row_loc, col_loc, item):
                         "Must have equal len keys and value when setting with an iterable"
                     )
             else:
-                if item.shape != (len(self.qc.index, len(col_loc))):
+                if item.shape != (len(row_loc), len(col_loc)):
                     raise ValueError(
                         "Must have equal len keys and value when setting with an iterable"
                     )
-            exist_items = (
-                item[:, common_label_loc]
-                if len(item.shape) > 1
-                else item[common_label_loc]
-            )
+        common_label_loc = np.isin(col_loc, self.qc.columns.values)
         if not all(common_label_loc):
             # In this case we have some new cols and some old ones
             columns = self.qc.columns
             for i in range(len(common_label_loc)):
                 if not common_label_loc[i]:
                     columns = columns.insert(len(columns), col_loc[i])
-            self.qc = self.qc.reindex(labels=columns, axis=1, fill_value=0)
+            self.qc = self.qc.reindex(labels=columns, axis=1, fill_value=np.NaN)
             self.df._update_inplace(new_query_compiler=self.qc)
-        self._set_item_existing_loc(row_loc, np.array(col_loc), exist_items)
+        self._set_item_existing_loc(row_loc, np.array(col_loc), item)
 
     def _set_item_existing_loc(self, row_loc, col_loc, item):
         """


Test patch:
diff --git a/modin/pandas/test/dataframe/test_indexing.py b/modin/pandas/test/dataframe/test_indexing.py
--- a/modin/pandas/test/dataframe/test_indexing.py
+++ b/modin/pandas/test/dataframe/test_indexing.py
@@ -515,6 +515,18 @@ def test_loc_4456(
     eval_loc(modin_df, pandas_df, (mdf_value, pdf_value), key)
 
 
+def test_loc_5829():
+    data = {"a": [1, 2, 3, 4, 5], "b": [11, 12, 13, 14, 15]}
+    modin_df = pd.DataFrame(data, dtype=object)
+    pandas_df = pandas.DataFrame(data, dtype=object)
+    eval_loc(
+        modin_df,
+        pandas_df,
+        value=np.array([[24, 34, 44], [25, 35, 45]]),
+        key=([3, 4], ["c", "d", "e"]),
+    )
+
+
 # This tests the bug from https://github.com/modin-project/modin/issues/3736
 def test_loc_setting_single_categorical_column():
     modin_df = pd.DataFrame({"status": ["a", "b", "c"]}, dtype="category")