Repository: modin-project/modin

Issue:
Modin should match pandas UserWarning for assigning columns via attributes
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: macOS 12.2.1
- **Modin version** (`modin.__version__`): 0.15.0+16.g4574746c
- **Python version**: 3.9.12
- **Code we can use to reproduce**:

```python
import modin.pandas as pd
import pandas

pandas_df = pandas.DataFrame({"a": [1, 2, 3]})
modin_df = pd.DataFrame({"a": [1, 2, 3]})

# This throws a user warning
pandas_df.b = [1,2,3]

# This does not throw a user warning
modin_df.b = [1,2,3]
```

### Describe the problem
Modin doesn't throw a user warning for trying to assign new columns by setting an attribute. This isn't a super pressing issue, but we should at least mimic pandas behavior here. 

### 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/pandas/dataframe.py b/modin/pandas/dataframe.py
--- a/modin/pandas/dataframe.py
+++ b/modin/pandas/dataframe.py
@@ -2502,7 +2502,7 @@ def __setattr__(self, key, value):
             # `__getattr__` will return the columns not present in `dir(self)`, so we do not need
             # to manually track this state in the `dir`.
             return
-        elif isinstance(value, pandas.Series):
+        elif is_list_like(value):
             warnings.warn(
                 "Modin doesn't allow columns to be created via a new attribute name - see "
                 + "https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access",


Test patch:
diff --git a/modin/pandas/test/dataframe/test_iter.py b/modin/pandas/test/dataframe/test_iter.py
--- a/modin/pandas/test/dataframe/test_iter.py
+++ b/modin/pandas/test/dataframe/test_iter.py
@@ -18,6 +18,7 @@
 import matplotlib
 import modin.pandas as pd
 import io
+import warnings
 
 from modin.pandas.test.utils import (
     random_state,
@@ -289,6 +290,36 @@ def test___setattr__mutating_column():
     df_equals(modin_df, pandas_df)
     assert modin_df.col0.equals(modin_df["col0"])
 
+    # Check that attempting to add a new col via attributes raises warning
+    # and adds the provided list as a new attribute and not a column.
+    with pytest.warns(
+        UserWarning,
+        match="Modin doesn't allow columns to be created via a new attribute name - see "
+        + "https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access",
+    ):
+        modin_df.col1 = [4]
+
+    with warnings.catch_warnings():
+        warnings.filterwarnings(
+            action="error",
+            message="Modin doesn't allow columns to be created via a new attribute name - see "
+            + "https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access",
+        )
+        modin_df.col1 = [5]
+        modin_df.new_attr = 6
+        modin_df.col0 = 7
+
+    assert "new_attr" in dir(
+        modin_df
+    ), "Modin attribute was not correctly added to the df."
+    assert (
+        "new_attr" not in modin_df
+    ), "New attribute was not correctly added to columns."
+    assert modin_df.new_attr == 6, "Modin attribute value was set incorrectly."
+    assert isinstance(
+        modin_df.col0, pd.Series
+    ), "Scalar was not broadcasted properly to an existing column."
+
 
 @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)
 def test_isin(data):