Repository: modin-project/modin
Issue: Assignment of ndarray of single element ndarrays should convert data to column if these single elements

### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:

Ubuntu 20.04

- **Modin version** (`modin.__version__`):

0.7.3+116.g568e9c6.dirty

- **Python version**:

Python 3.8.2

- **Code we can use to reproduce**:

```python
import modin.pandas as pd

df1 = pd.DataFrame({"data": [2, 3, 4, 5]})
df2 = pd.DataFrame({"col1": [11, 21, 31, 41], "col2": [12, 22, 32, 42]})
values = df1[['data']].values
print(type(values))
print(type(values[0]))
print(values)
df2['data'] = values
print(df2)
s1 = df2['data'].unique()
print(s1)
```

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

Running above code on Pandas shows that assignment of 2-dimensional array to a dataframe column unwraps its elements and column consists of numbers while on Modin column consists of ndarrays. This leads to unability to run `unique` or probably other dataframe functions on this column.

### 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. -->


Changed files:
modin/pandas/dataframe.py, modin/pandas/test/test_dataframe.py

diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py
index 55fd95905..47ffdc370 100644
--- a/modin/pandas/dataframe.py
+++ b/modin/pandas/dataframe.py
@@ -2286,15 +2286,7 @@ class DataFrame(BasePandasDataset):
                 # last column name from the list (the appended value's name and append
                 # the new name.
                 self.columns = self.columns[:-1].append(pandas.Index([key]))
-            elif (
-                isinstance(value, np.ndarray)
-                and len(value.shape) > 1
-                and value.shape[1] != 1
-            ):
-                raise ValueError(
-                    "Wrong number of items passed %i, placement implies 1"
-                    % value.shape[1]
-                )
+                return
             elif (
                 isinstance(value, (pandas.DataFrame, DataFrame)) and value.shape[1] != 1
             ):
@@ -2302,8 +2294,18 @@ class DataFrame(BasePandasDataset):
                     "Wrong number of items passed %i, placement implies 1"
                     % value.shape[1]
                 )
-            else:
-                self.insert(loc=len(self.columns), column=key, value=value)
+            elif isinstance(value, np.ndarray) and len(value.shape) > 1:
+                if value.shape[1] == 1:
+                    # Transform into columnar table and take first column
+                    value = value.copy().T[0]
+                else:
+                    raise ValueError(
+                        "Wrong number of items passed %i, placement implies 1"
+                        % value.shape[1]
+                    )
+
+            # Do new column assignment after error checks and possible value modifications
+            self.insert(loc=len(self.columns), column=key, value=value)
             return
 
         if not isinstance(key, str):
diff --git a/modin/pandas/test/test_dataframe.py b/modin/pandas/test/test_dataframe.py
index 316cba35e..a5a8050ee 100644
--- a/modin/pandas/test/test_dataframe.py
+++ b/modin/pandas/test/test_dataframe.py
@@ -21,6 +21,7 @@ import modin.pandas as pd
 from modin.pandas.utils import to_pandas
 from numpy.testing import assert_array_equal
 import io
+import sys
 
 from .utils import (
     random_state,
@@ -5145,6 +5146,16 @@ class TestDataFrameIndexing:
         pandas_df[pandas_df.columns[-1]] = pandas_df[pandas_df.columns[0]]
         df_equals(modin_df, pandas_df)
 
+        if not sys.version_info.major == 3 and sys.version_info.minor > 6:
+            # This test doesn't work correctly on Python 3.6
+            # Test 2d ndarray assignment to column
+            modin_df = pd.DataFrame(data)
+            pandas_df = pandas.DataFrame(data)
+            modin_df["new_col"] = modin_df[[modin_df.columns[0]]].values
+            pandas_df["new_col"] = pandas_df[[pandas_df.columns[0]]].values
+            df_equals(modin_df, pandas_df)
+            assert isinstance(modin_df["new_col"][0], type(pandas_df["new_col"][0]))
+
         # Transpose test
         modin_df = pd.DataFrame(data).T
         pandas_df = pandas.DataFrame(data).T