-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: resample with ArrowDtype #56371
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
222aa32
BUG: resample with ArrowDtype
mroeschke 72d7fb0
Typing
mroeschke 6e4aa47
xfail for windows
mroeschke 1ab454e
Merge remote-tracking branch 'upstream/main' into bug/arrow/resample
mroeschke 13cca60
Fix again?
mroeschke a2037e9
Avoid tuple
mroeschke 4fc6ce5
Merge remote-tracking branch 'upstream/main' into bug/arrow/resample
mroeschke 17ab06a
Add gh numbers
mroeschke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
from pandas._libs import lib | ||
from pandas._typing import DatetimeNaTType | ||
from pandas.compat import is_platform_windows | ||
import pandas.util._test_decorators as td | ||
|
||
import pandas as pd | ||
from pandas import ( | ||
|
@@ -2195,3 +2197,27 @@ def test_resample_b_55282(unit): | |
index=exp_dti, | ||
) | ||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
@td.skip_if_no("pyarrow") | ||
@pytest.mark.parametrize( | ||
"tz", | ||
[ | ||
None, | ||
pytest.param( | ||
"UTC", | ||
marks=pytest.mark.xfail( | ||
condition=is_platform_windows(), | ||
reason="TODO: Set ARROW_TIMEZONE_DATABASE env var in CI", | ||
), | ||
), | ||
], | ||
) | ||
def test_arrow_timestamp_resample(tz): | ||
# GH 56371 | ||
idx = Series(date_range("2020-01-01", periods=5), dtype="timestamp[ns][pyarrow]") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GH# |
||
if tz is not None: | ||
idx = idx.dt.tz_localize(tz) | ||
expected = Series(np.arange(5, dtype=np.float64), index=idx) | ||
result = expected.resample("1D").mean() | ||
tm.assert_series_equal(result, expected) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
import numpy as np | ||
import pytest | ||
|
||
import pandas.util._test_decorators as td | ||
|
||
import pandas as pd | ||
from pandas import ( | ||
DataFrame, | ||
|
@@ -207,3 +209,12 @@ def test_resample_closed_right(): | |
), | ||
) | ||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
@td.skip_if_no("pyarrow") | ||
def test_arrow_duration_resample(): | ||
# GH 56371 | ||
idx = pd.Index(timedelta_range("1 day", periods=5), dtype="duration[ns][pyarrow]") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GH# |
||
expected = Series(np.arange(5, dtype=np.float64), index=idx) | ||
result = expected.resample("1D").mean() | ||
tm.assert_series_equal(result, expected) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.