-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Implement io.nullable_backend config for read_parquet #49039
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 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
caf68cf
ENH: Implement io.nullable_backend config for read_parquet
mroeschke e02411c
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke 368ef09
add whatsnew
mroeschke 7a89bdb
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke 9f49203
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke 2a1e8ba
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke 7695d49
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke df31bb1
xfail for min version
mroeschke 593446a
Merge remote-tracking branch 'upstream/main' into enh/io/nullable_bac…
mroeschke a4cd9f5
Remove unnecessary xfails
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 |
---|---|---|
|
@@ -1021,6 +1021,46 @@ def test_read_parquet_manager(self, pa, using_array_manager): | |
else: | ||
assert isinstance(result._mgr, pd.core.internals.BlockManager) | ||
|
||
@pytest.mark.xfail( | ||
pa_version_under2p0, reason="Timezone conversion incorrect for pyarrow < 2.0" | ||
) | ||
def test_read_use_nullable_types_pyarrow_config(self, pa, df_full): | ||
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. This is failing in the min versions build 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. Thanks, fixed |
||
import pyarrow | ||
|
||
df = df_full | ||
|
||
# additional supported types for pyarrow | ||
dti = pd.date_range("20130101", periods=3, tz="Europe/Brussels") | ||
dti = dti._with_freq(None) # freq doesn't round-trip | ||
df["datetime_tz"] = dti | ||
df["bool_with_none"] = [True, None, True] | ||
|
||
pa_table = pyarrow.Table.from_pandas(df) | ||
expected = pd.DataFrame( | ||
{ | ||
col_name: pd.arrays.ArrowExtensionArray(pa_column) | ||
for col_name, pa_column in zip( | ||
pa_table.column_names, pa_table.itercolumns() | ||
) | ||
} | ||
) | ||
# pyarrow infers datetimes as us instead of ns | ||
expected["datetime"] = expected["datetime"].astype("timestamp[us][pyarrow]") | ||
expected["datetime_with_nat"] = expected["datetime_with_nat"].astype( | ||
"timestamp[us][pyarrow]" | ||
) | ||
expected["datetime_tz"] = expected["datetime_tz"].astype( | ||
pd.ArrowDtype(pyarrow.timestamp(unit="us", tz="Europe/Brussels")) | ||
) | ||
|
||
with pd.option_context("io.nullable_backend", "pyarrow"): | ||
check_round_trip( | ||
df, | ||
engine=pa, | ||
read_kwargs={"use_nullable_dtypes": True}, | ||
expected=expected, | ||
) | ||
|
||
|
||
class TestParquetFastParquet(Base): | ||
def test_basic(self, fp, df_full): | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this