Skip to content

BUG: read_parquet unexpected output with pyarrow 0.16.0 and nullable usigned int dtype #31896

Closed
@cat-Yu

Description

@cat-Yu
data = [np.nan, 1, 2, 3, 4]
df = pd.DataFrame()
df['col'] = pd.Series(data, dtype = "UInt32")
df.to_parquet('example.parquet')
res = pd.read_parquet('example.parquet')
print(res)

Problem description

The above cope prints:

    col
0  <NA>
1     0
2     1
3     0
4     2

This happened after I upgraded to pyarrow 0.16.0, and UInt32 is the only dtype that I had trouble with.
The problem should be with read_parquet, I tried reading parquet with another package, and got the expected output.

Expected Output

    col
0  <NA>
1     1
2     2
3     3
4     4

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.0.1
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : None
pytest : 5.3.2
hypothesis : None
sphinx : 2.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.2
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pytest : 5.3.2
pyxlsb : None
s3fs : 0.4.0
scipy : 1.4.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : 0.48.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO Parquetparquet, featherNA - MaskedArraysRelated to pd.NA and nullable extension arrays

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions