[ 
https://issues.apache.org/jira/browse/SPARK-37512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon updated SPARK-37512:
---------------------------------
        Parent:     (was: SPARK-37525)
    Issue Type: Improvement  (was: Sub-task)

> Support TimedeltaIndex creation (from Series/Index) and TimedeltaIndex.astype
> -----------------------------------------------------------------------------
>
>                 Key: SPARK-37512
>                 URL: https://issues.apache.org/jira/browse/SPARK-37512
>             Project: Spark
>          Issue Type: Improvement
>          Components: PySpark
>    Affects Versions: 3.3.0
>            Reporter: Xinrong Meng
>            Assignee: Xinrong Meng
>            Priority: Major
>             Fix For: 3.3.0
>
>
>  
> To solve the issues below:
> {code:java}
> >>> idx = ps.TimedeltaIndex([timedelta(1), timedelta(microseconds=2)])
> >>> idx
> TimedeltaIndex(['1 days 00:00:00', '0 days 00:00:00.000002'], 
> dtype='timedelta64[ns]', freq=None)
> >>> ps.TimedeltaIndex(idx)
> Traceback (most recent call last):
> ...
>     raise TypeError("astype can not be applied to %s." % self.pretty_name)
> TypeError: astype can not be applied to timedelta.
>  {code}
>  
>  
>  
> {code:java}
> >>> s = ps.Series([timedelta(1), timedelta(microseconds=2)], index=[10, 20])
> >>> s
> 10          1 days 00:00:00
> 20   0 days 00:00:00.000002
> dtype: timedelta64[ns]
> >>> ps.TimedeltaIndex(s)
> Traceback (most recent call last):
> ...
>     raise TypeError("astype can not be applied to %s." % self.pretty_name)
> TypeError: astype can not be applied to timedelta.
>  {code}
>  
>  



--
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