You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/12 04:47:39 UTC
[GitHub] [arrow] AlenkaF commented on issue #13125: parquet conversion failed,Bool column has NA values in column boolean__v
AlenkaF commented on issue #13125:
URL: https://github.com/apache/arrow/issues/13125#issuecomment-1124525696
What version of PyArrow are you using?
I created this minimal reproducible example, can you run it and check if it works for you?
```python
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
chunk = pd.DataFrame([True, False, None], columns=['col1'])
field = pa.field("col1", pa.bool_())
glue_schema = pa.schema([field])
table = pa.Table.from_pandas(chunk, preserve_index=False, schema=glue_schema)
# Open a Parquet file for writing
pq_writer = pq.ParquetWriter('example.parquet',
schema = glue_schema,
compression='snappy')
# Write CSV chunk to the parquet file
pq_writer.write_table(table)
pq_writer.close()
# Read the chunk
pq.read_table('example.parquet').to_pandas()
```
It should create this output:
```python
>>> pq.read_table('example.parquet').to_pandas()
col1
0 True
1 False
2 None
```
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org