Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/pyspark/pandas/data_type_ops/timedelta_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pandas as pd
from pandas.api.types import CategoricalDtype

from pyspark.loose_version import LooseVersion
from pyspark.sql.types import (
BooleanType,
DayTimeIntervalType,
Expand Down Expand Up @@ -64,6 +65,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
"""Prepare column when from_pandas."""
return col

def restore(self, col: pd.Series) -> pd.Series:
"""Restore column when to_pandas."""
if LooseVersion(pd.__version__) < "3.0.0":
return col
else:
return col.astype(self.dtype)

def sub(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
_sanitize_list_like(right)

Expand Down