Skip to content

Commit f5c931b

Browse files
committed
BUG: Handle MultiIndex in imsd()
Matches emsd() behavior.
1 parent b956a3c commit f5c931b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

trackpy/motion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def imsd(traj, mpp, fps, max_lagtime=100, statistic='msd', pos_columns=None):
191191
msds = []
192192
# Note: Index is set by msd, so we don't need to worry
193193
# about conformity here.
194-
for pid, ptraj in traj.groupby('particle'):
194+
for pid, ptraj in traj.reset_index(drop=True).groupby('particle'):
195195
msds.append(msd(ptraj, mpp, fps, max_lagtime, False, pos_columns))
196196
ids.append(pid)
197197
results = pandas_concat(msds, keys=ids)

0 commit comments

Comments
 (0)