amillb / pgMapMatch

map-matching of GPS traces
MIT License
78 stars 20 forks source link

rewrite pandas call to avoid deprecated function #21

Closed amillb closed 3 years ago

amillb commented 3 years ago

This line viterbi() uses a now-deprecated indexer in pandas. Rewrite to avoid the FutureWarning.

trellis_1 = np.nanmax(np.broadcast_to(trellis_0[:, None], (trellis_0.shape[0], iterN)) +
   (np.repeat(self.ptsDf.loc[nid-nToSkip:nid, 'distprob'], 2)-self.skip_penalty*np.repeat(np.array(nid-self.ptsDf.loc[nid-nToSkip:nid].index)**2, 2))[:, None].T + LL, 0)

From pandas docs:

Support for multi-dimensional indexing (e.g. index[:, None]) on a Index is deprecated and will be removed in a future version, convert to a numpy array before indexing instead (GH30588)