Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pandas version to use diff #160

Closed
veenstrajelmer opened this issue Oct 23, 2024 · 0 comments · Fixed by #161
Closed

update pandas version to use diff #160

veenstrajelmer opened this issue Oct 23, 2024 · 0 comments · Fixed by #161

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Oct 23, 2024

Code would be slightly more convenient if we update to pandas 2.1.4, since it supports diff for timedeltas. That pandas version supports python 3.9 and higher, which is also what kenmerkendewaarden supports.

.diff() can be applied in two locations:

ts_timediff = (
df_times[1:] - df_times[:-1]
) # TODO: from pandas 2.1.4 the following also works: df_times.diff()[1:]

And:

df_meas["timediff"] = pd.TimedeltaIndex([pd.NaT]).append(
df_meas.index[1:] - df_meas.index[:-1]
) # TODO: from pandas>=2.1.4 the following also works: df_times.diff() (which results in a timedeltaindex of the correct length)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant