Skip to content

Commit 5df9611

Browse files
committed
Make include_groups kwarg pandas version dependent
1 parent 0b1785f commit 5df9611

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: trackpy/tests/test_motion.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from numpy.testing import assert_almost_equal
1010

1111
import trackpy as tp
12-
from trackpy.utils import pandas_sort, pandas_concat
12+
from trackpy.utils import pandas_sort, pandas_concat, is_pandas_since_220
1313
from trackpy.tests.common import StrictTestCase
1414

1515

@@ -228,7 +228,10 @@ def setUp(self):
228228
def test_theta_entropy(self):
229229
# just a smoke test
230230
theta_entropy = lambda x: tp.motion.theta_entropy(x, plot=False)
231-
self.steppers.groupby('particle').apply(theta_entropy, include_groups=False)
231+
self.steppers.groupby('particle').apply(
232+
theta_entropy,
233+
**({"include_groups": False} if is_pandas_since_220 else {}),
234+
)
232235

233236
def test_relate_frames(self):
234237
# Check completeness of output

Diff for: trackpy/utils.py

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
except ValueError: # Probably a development version
2424
is_pandas_since_023 = True
2525

26+
27+
try:
28+
is_pandas_since_220 = (LooseVersion(pd.__version__) >=
29+
LooseVersion('2.2.0'))
30+
except ValueError: # Probably a development version
31+
is_pandas_since_220 = True
32+
33+
2634
# Emit warnings in refine.least_squares for scipy 1.5
2735
try:
2836
is_scipy_15 = LooseVersion("1.5.0") <= LooseVersion(scipy.__version__) < LooseVersion('1.6.0')

0 commit comments

Comments
 (0)