You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xinrong Meng (Jira)" <ji...@apache.org> on 2021/12/01 05:51:00 UTC

[jira] [Created] (SPARK-37512) Support TimedeltaIndex creation given a timedelta Series/Index

Xinrong Meng created SPARK-37512:
------------------------------------

             Summary: Support TimedeltaIndex creation given a timedelta Series/Index
                 Key: SPARK-37512
                 URL: https://issues.apache.org/jira/browse/SPARK-37512
             Project: Spark
          Issue Type: Sub-task
          Components: PySpark
    Affects Versions: 3.3.0
            Reporter: Xinrong Meng


 

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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org