You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Peter Nguyen (Jira)" <ji...@apache.org> on 2025/06/26 22:42:00 UTC

[jira] [Created] (SPARK-52592) Can't construct ps.Series from a ps.Series

Peter Nguyen created SPARK-52592:
------------------------------------

             Summary: Can't construct ps.Series from a ps.Series
                 Key: SPARK-52592
                 URL: https://issues.apache.org/jira/browse/SPARK-52592
             Project: Spark
          Issue Type: Bug
          Components: Pandas API on Spark
    Affects Versions: 3.2.0
            Reporter: Peter Nguyen


I'd like for this to work, but it does not. 
{code:python}
obj = ps.Series([x for x in range(3)])
obj = ps.Series(obj) print(obj)
{code}
 
Here's the error:

{code:java}
Traceback (most recent call last):
  File "script.py", line 75, in <module>
    obj = ps.Series(obj)
  File ".../pyspark/pandas/series.py", line 422, in __init__
    s = pd.Series(
  File ".../pandas/core/series.py", line 470, in __init__
    data = sanitize_array(data, index, dtype, copy)
  File ".../pandas/core/construction.py", line 618, in sanitize_array
    data = list(data)
  File ".../pyspark/pandas/series.py", line 7339, in __iter__
    return MissingPandasLikeSeries.__iter__(self)
  File ".../pyspark/pandas/missing/__init__.py", line 23, in unsupported_function
    raise PandasNotImplementedError(
pyspark.pandas.exceptions.PandasNotImplementedError: The method `pd.Series.__iter__()` is not implemented. If you want to collect your data as an NumPy array, use 'to_numpy()' instead.
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org