Skip to content

BUG: avoid specifying default coerce_timestamps in to_parquet #31652

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 3 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def write(
df: DataFrame,
path,
compression="snappy",
coerce_timestamps="ms",
index: Optional[bool] = None,
partition_cols=None,
**kwargs,
Expand All @@ -103,17 +102,12 @@ def write(
table,
path,
compression=compression,
coerce_timestamps=coerce_timestamps,
partition_cols=partition_cols,
**kwargs,
)
else:
self.api.parquet.write_table(
table,
path,
compression=compression,
coerce_timestamps=coerce_timestamps,
**kwargs,
table, path, compression=compression, **kwargs,
)

def read(self, path, columns=None, **kwargs):
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ def test_additional_extension_types(self, pa):
)
check_round_trip(df, pa)

@td.skip_if_no("pyarrow", min_version="0.14")
def test_timestamp_nanoseconds(self, pa):
# with version 2.0, pyarrow defaults to writing the nanoseconds, so
# this should work with error
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this say "work without error"?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, of course ... !

df = pd.DataFrame({"a": pd.date_range("2017-01-01", freq="1n", periods=10)})
check_round_trip(df, pa, write_kwargs={"version": "2.0"})


class TestParquetFastParquet(Base):
@td.skip_if_no("fastparquet", min_version="0.3.2")
Expand Down