pyspark.pandas.Index.is_all_dates

property Index.is_all_dates

Return if all data types of the index are datetime. remember that since pandas-on-Spark does not support multiple data types in an index, so it returns True if any type of data is datetime.

Deprecated since version 3.4.0.

Examples

>>> from datetime import datetime
>>> idx = ps.Index([datetime(2019, 1, 1, 0, 0, 0), datetime(2019, 2, 3, 0, 0, 0)])
>>> idx
DatetimeIndex(['2019-01-01', '2019-02-03'], dtype='datetime64[ns]', freq=None)
>>> idx.is_all_dates
True
>>> idx = ps.Index([datetime(2019, 1, 1, 0, 0, 0), None])
>>> idx
DatetimeIndex(['2019-01-01', 'NaT'], dtype='datetime64[ns]', freq=None)
>>> idx.is_all_dates
True
>>> idx = ps.Index([0, 1, 2])
>>> idx  
Int64Index([0, 1, 2], dtype='int64')
>>> idx.is_all_dates
False