rmnskb commented on code in PR #47147: URL: https://github.com/apache/arrow/pull/47147#discussion_r2264057039
########## python/pyarrow/tests/parquet/test_pandas.py: ########## @@ -101,6 +101,33 @@ def test_merging_parquet_tables_with_different_pandas_metadata(tempdir): writer.write_table(table2) +@pytest.mark.pandas +def test_attributes_metadata_persistence(tempdir): + # GH-45382: Add support for pandas DataFrame.attrs + # During the .parquet file writing, the attrs are serialised into json + # along with the rest of the pandas.DataFrame metadata. + + filename = tempdir / "metadata_persistence.parquet" + df = alltypes_sample(size=10000) + df.attrs = { + 'float16': 'half-precision', + 'float32': 'single precision', + 'float64': 'double precision', + 'desciption': 'Attributes Persistence Test DataFrame', + } + + table = pa.Table.from_pandas(df) + assert b'attributes' in table.schema.metadata[b'pandas'] + + _write_table(table, filename) + metadata = pq.read_metadata(filename).metadata + assert b'attributes' in table.schema.metadata[b'pandas'] Review Comment: Hey @rok, thanks for spotting that! Removed it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org