Maciej Szymkiewicz created SPARK-37668:
------------------------------------------

             Summary: 'Index' object has no attribute 'levels'
                 Key: SPARK-37668
                 URL: https://issues.apache.org/jira/browse/SPARK-37668
             Project: Spark
          Issue Type: Bug
          Components: PySpark
    Affects Versions: 3.3.0
            Reporter: Maciej Szymkiewicz


 [This piece of 
code|https://github.com/apache/spark/blob/6e45b04db48008fa033b09df983d3bd1c4f790ea/python/pyspark/pandas/frame.py#L3991-L3993]
 in {{pyspark.pandas.frame}} is going to fail on runtime, when 
{{is_name_like_tuple}} evaluates to {{True}}

{code:python}
if is_name_like_tuple(column):
    if len(column) != len(self.columns.levels):
{code}

with 

{code}
'Index' object has no attribute 'levels'
{code}

To be honest, I am not sure what is intended behavior (initially, I suspected 
that we should have 

{code:python}
 if len(column) != self.columns.nlevels
{code}

but {{nlevels}} is hard-coded to one, and wouldn't be consistent with Pandas at 
all.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to