-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Empty dataframe with valid index object is not being read correctly via parquet reader #37897
Comments
likely a pyarrow issue |
(thanks for the ping, will take a look later this week) |
It's indeed a pyarrow issue, but not directly related to Parquet itself, but the pandas <-> pyarrow roundtrip is already failing for this corner case:
I opened https://issues.apache.org/jira/browse/ARROW-10643 for this, contributions to fix this are always welcome! Since it is an issue on the pyarrow side, closing this. |
While the underlying pyarrow issue was fixed. The bug in the original report persists. import pyarrow as pa
import pandas as pd
from io import BytesIO
buf = BytesIO()
df = pd.DataFrame({"a": [1, 2, 3]}, index=pd.RangeIndex(0, 3))
df.to_parquet(buf, index=True)
table = pa.parquet.read_table(buf)
pa_table = pa.table(df)
assert table == pa_table # False |
parquet case is apache/arrow#40743 |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
When
index
isNone
/True
parquet reader must retrieve onlyRangeIndex
and not emptyRangeIndex
orInt64Index
.Expected Output
We should be able to get rangeIndex when we read from parquet file
a
.Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here leaving a blank line after the details tag]INSTALLED VERSIONS
commit : 67a3d42
python : 3.7.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-53-generic
Version : #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.4
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 20.2.4
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.1.2
hypothesis : 5.41.1
sphinx : 3.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 0.8.4
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.1
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.51.2
This could be related to #37896, but it appears the parquet reader is also not able to retrieve any Index at all when
index
isNone
. Hence filing this as a separate issue.The text was updated successfully, but these errors were encountered: