Repository: modin-project/modin

Issue:
Assignment "df.loc[row][col] = value" in DataFrame with one row throws exception
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:

Ubuntu 20.04

- **Modin version** (`modin.__version__`):

0.7.3+166.g00f57f1.dirty

- **Python version**:

Python 3.8.2

- **Code we can use to reproduce**:

```python
import modin.pandas as pd

df1 = pd.DataFrame(index=["row1"], columns=["col1", "col2"])
df1.loc["row1"]["col1"] = 11
print(df1)
```

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

On Modin code above throws exception:
```
Traceback (most recent call last):
  File "test_setitem6.py", line 4, in <module>
    df1.loc["row1"]["col1"] = 11
  File "/localdisk/gashiman/modin/modin/pandas/series.py", line 335, in __setitem__
    self._parent.loc[self.name] = self
  File "/localdisk/gashiman/modin/modin/pandas/indexing.py", line 279, in __setitem__
    super(_LocIndexer, self).__setitem__(row_lookup, col_lookup, item)
  File "/localdisk/gashiman/modin/modin/pandas/indexing.py", line 162, in __setitem__
    new_qc = self.qc.setitem(1, self.qc.index[row_lookup[0]], item)
  File "/localdisk/gashiman/modin/modin/backends/pandas/query_compiler.py", line 1285, in setitem
    value._modin_frame._concat(0, [mask], "inner", False)
  File "/localdisk/gashiman/modin/modin/engines/base/frame/data.py", line 1273, in _concat
    new_partitions = self._frame_mgr_cls.concat(axis, left_parts, right_parts)
  File "/localdisk/gashiman/modin/modin/engines/base/frame/partition_manager.py", line 223, in concat
    return np.concatenate([left_parts] + right_parts, axis=axis)
  File "<__array_function__ internals>", line 5, in concatenate
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)
```

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->



Discussion:

Resolving patch:
diff --git a/modin/engines/base/frame/partition_manager.py b/modin/engines/base/frame/partition_manager.py
--- a/modin/engines/base/frame/partition_manager.py
+++ b/modin/engines/base/frame/partition_manager.py
@@ -302,6 +302,10 @@ def concat(cls, axis, left_parts, right_parts):
             A new BaseFrameManager object, the type of object that called this.
         """
         if type(right_parts) is list:
+            # `np.array` with partitions of empty ModinFrame has a shape (0,)
+            # but `np.concatenate` can concatenate arrays only if its shapes at
+            # specified axis are equals, so filtering empty frames to avoid concat error
+            right_parts = [o for o in right_parts if o.size != 0]
             return np.concatenate([left_parts] + right_parts, axis=axis)
         else:
             return np.append(left_parts, right_parts, axis=axis)


Test patch:
diff --git a/modin/pandas/test/test_dataframe.py b/modin/pandas/test/test_dataframe.py
--- a/modin/pandas/test/test_dataframe.py
+++ b/modin/pandas/test/test_dataframe.py
@@ -4677,26 +4677,16 @@ def test_loc_multi_index(self):
         df_equals(modin_df.loc[modin_df.index], pandas_df.loc[pandas_df.index])
         df_equals(modin_df.loc[modin_df.index[:7]], pandas_df.loc[pandas_df.index[:7]])
 
-    def test_loc_assignment(self):
-        modin_df = pd.DataFrame(
-            index=["row1", "row2", "row3"], columns=["col1", "col2"]
-        )
-        pandas_df = pandas.DataFrame(
-            index=["row1", "row2", "row3"], columns=["col1", "col2"]
-        )
-        modin_df.loc["row1"]["col1"] = 11
-        modin_df.loc["row2"]["col1"] = 21
-        modin_df.loc["row3"]["col1"] = 31
-        modin_df.loc["row1"]["col2"] = 12
-        modin_df.loc["row2"]["col2"] = 22
-        modin_df.loc["row3"]["col2"] = 32
-        pandas_df.loc["row1"]["col1"] = 11
-        pandas_df.loc["row2"]["col1"] = 21
-        pandas_df.loc["row3"]["col1"] = 31
-        pandas_df.loc["row1"]["col2"] = 12
-        pandas_df.loc["row2"]["col2"] = 22
-        pandas_df.loc["row3"]["col2"] = 32
-        df_equals(modin_df, pandas_df)
+    @pytest.mark.parametrize("index", [["row1", "row2", "row3"], ["row1"]])
+    @pytest.mark.parametrize("columns", [["col1", "col2"], ["col1"]])
+    def test_loc_assignment(self, index, columns):
+        md_df, pd_df = create_test_dfs(index=index, columns=columns)
+        for i, ind in enumerate(index):
+            for j, col in enumerate(columns):
+                value_to_assign = int(str(i) + str(j))
+                md_df.loc[ind][col] = value_to_assign
+                pd_df.loc[ind][col] = value_to_assign
+        df_equals(md_df, pd_df)
 
     @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)
     def test_loc_nested_assignment(self, data):