Skip to content

Commit

Permalink
Replace depreated pandas function with local alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfByttner committed Apr 6, 2024
1 parent b0d10d9 commit e3c9190
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions traja/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pandas as pd

# Check whether pandas series is datetime or timedelta
def is_datetime_or_timedelta_dtype(series: pd.Series) -> bool:
return pd.api.types.is_datetime64_dtype(series) or pd.api.types.is_timedelta64_dtype(series)
3 changes: 1 addition & 2 deletions traja/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
from matplotlib.axes import Axes
from matplotlib.collections import PathCollection
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
from pandas.core.dtypes.common import (
is_datetime_or_timedelta_dtype,
is_datetime64_any_dtype,
is_timedelta64_dtype,
)

import traja
from traja.frame import TrajaDataFrame
from traja.core import is_datetime_or_timedelta_dtype
from traja.trajectory import coords_to_flow

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion traja/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import (
is_datetime_or_timedelta_dtype,
is_datetime64_any_dtype,
is_timedelta64_dtype,
)
Expand All @@ -15,6 +14,7 @@

import traja
from traja import TrajaDataFrame
from traja.core import is_datetime_or_timedelta_dtype

__all__ = [
"_bins_to_tuple",
Expand Down

0 comments on commit e3c9190

Please sign in to comment.