Repository: modin-project/modin

Issue:
modin.pandas.DataFrame.sparse.from_spmatrix throws an AttributeError.
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: MacOS Big Sur 11.5.2
- **Modin version** (`modin.__version__`): 0.12.0+55.g67013f93
- **Python version**: 3.8.8
- **Code we can use to reproduce**:

```python
import scipy.sparse
import modin.pandas as pd
pd.DataFrame.sparse.from_spmatrix(scipy.sparse.eye(0))
```

I get 

```
AttributeError                            Traceback (most recent call last)
<ipython-input-9-26aa252a0082> in <module>
----> 1 modin.pandas.DataFrame.sparse.from_spmatrix(scipy.sparse.eye(0))

~/modin/modin/pandas/accessor.py in from_spmatrix(cls, data, index, columns)
    109     @classmethod
    110     def from_spmatrix(cls, data, index=None, columns=None):
--> 111         return cls._default_to_pandas(
    112             pandas.DataFrame.sparse.from_spmatrix, data, index=index, columns=columns
    113         )

~/modin/modin/pandas/accessor.py in _default_to_pandas(self, op, *args, **kwargs)
     78             Result of operation.
     79         """
---> 80         return self._parent._default_to_pandas(
     81             lambda parent: op(parent.sparse, *args, **kwargs)
     82         )

AttributeError: 'function' object has no attribute '_parent'
```

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
This issues comes from [this StackOverflow question](https://stackoverflow.com/questions/70422977/modin-attributeerror-when-importing-from-sparse-matrix).





Discussion:

Resolving patch:
diff --git a/modin/pandas/accessor.py b/modin/pandas/accessor.py
--- a/modin/pandas/accessor.py
+++ b/modin/pandas/accessor.py
@@ -24,6 +24,8 @@
 import pandas
 from pandas.core.arrays.sparse.dtype import SparseDtype
 
+import modin.pandas as pd
+from modin.error_message import ErrorMessage
 from modin.utils import _inherit_docstrings
 
 
@@ -108,8 +110,9 @@ def density(self):
 
     @classmethod
     def from_spmatrix(cls, data, index=None, columns=None):
-        return cls._default_to_pandas(
-            pandas.DataFrame.sparse.from_spmatrix, data, index=index, columns=columns
+        ErrorMessage.default_to_pandas("`from_spmatrix`")
+        return pd.DataFrame(
+            pandas.DataFrame.sparse.from_spmatrix(data, index=index, columns=columns)
         )
 
     def to_dense(self):


Test patch:
diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py
--- a/modin/pandas/test/test_io.py
+++ b/modin/pandas/test/test_io.py
@@ -24,6 +24,7 @@
 from modin.pandas.utils import from_arrow
 import pyarrow as pa
 import os
+from scipy import sparse
 import sys
 import shutil
 import sqlalchemy as sa
@@ -2175,6 +2176,18 @@ def test_from_arrow():
     df_equals(modin_df, pandas_df)
 
 
+@pytest.mark.xfail(
+    condition="config.getoption('--simulate-cloud').lower() != 'off'",
+    reason="The reason of tests fail in `cloud` mode is unknown for now - issue #3264",
+)
+def test_from_spmatrix():
+    data = sparse.eye(3)
+    with pytest.warns(UserWarning, match="defaulting to pandas.*"):
+        modin_df = pd.DataFrame.sparse.from_spmatrix(data)
+    pandas_df = pandas.DataFrame.sparse.from_spmatrix(data)
+    df_equals(modin_df, pandas_df)
+
+
 @pytest.mark.xfail(
     condition="config.getoption('--simulate-cloud').lower() != 'off'",
     reason="The reason of tests fail in `cloud` mode is unknown for now - issue #3264",