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

Fix Pandas date_range warnings in tests #3945

Merged
merged 2 commits into from
Jul 8, 2022

Conversation

zundertj
Copy link
Collaborator

@zundertj zundertj commented Jul 8, 2022

Since Pandas 1.4 (released Jan 2022), the input arg closed for pd.date_range has been deprecated in favor of inclusive (https://pandas.pydata.org/docs/reference/api/pandas.date_range.html). This generated two warnings in our Python test suite. In one of the two cases, we just needed a range of dates, so switched that to polars.date_range, for the other use case updated the keyword. This does mean one needs Pandas >= 1.4 for running the test suite.

Since Pandas 1.4 (released Jan 2022), the input arg `closed` for pd.date_range has been deprecated in favor of `inclusive` (https://pandas.pydata.org/docs/reference/api/pandas.date_range.html) This  generated two warnings in our Python test suite. In one of the two cases, we just needed a range of dates, so switched that to polars.date_range, for the other use case updated the keyword.
@github-actions github-actions bot added the python Related to Python Polars label Jul 8, 2022
@@ -1449,7 +1451,8 @@ def test_join_dates() -> None:
"value": [2, 3, 4, 1, 2, 3, 5, 1, 2, 3],
}
)
df.join(df, on="datetime")
out = df.join(df, on="datetime")
assert len(out) == len(df)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a basic assertion here, there was no assert in place.

@ritchie46
Copy link
Member

Thanks you @zundertj. Do you know about the reason of the change?

@ritchie46 ritchie46 merged commit 6e325e7 into pola-rs:master Jul 8, 2022
@zundertj
Copy link
Collaborator Author

zundertj commented Jul 8, 2022

Consistency of the API: pandas-dev/pandas#40245. Although I do not see any deep thinking on why inclusive vs closed, so I may be missing something. I see in polars we are mainly using closed, and only for splitting strings the keyword inclusive (closed would not make sense in that context)

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

Successfully merging this pull request may close these issues.

2 participants