BUG: usecols behaving differently between c and python #47138
Labels
Bug
IO CSV
read_csv, to_csv
Needs Discussion
Requires discussion from core team before further action
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The python engine raises a warning that out of bounds usecols indices will raise in a future version while the c engine shifts the column name b one to the right and matches the value
c
with column nameb
.Python:
C:
Expected Behavior
Imo the behavior on the python side makes a bit more sense, but I could also see arguments for the c behavior.
Installed Versions
INSTALLED VERSIONS
commit : ef898b4
python : 3.8.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-44-generic
Version : #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.0.dev0+825.gef898b4aff
numpy : 1.22.0
pytz : 2021.1
dateutil : 2.8.2
setuptools : 59.8.0
pip : 21.3.1
Cython : 0.29.24
pytest : 7.1.1
hypothesis : 6.23.1
sphinx : 4.2.0
blosc : None
feather : None
xlsxwriter : 3.0.1
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : 7.28.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : 1.3.2
brotli :
fastparquet : 0.7.1
fsspec : 2021.11.0
gcsfs : 2021.05.0
matplotlib : 3.4.3
numba : 0.53.1
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 5.0.0
pyreadstat : 1.1.2
pyxlsb : None
s3fs : 2021.11.0
scipy : 1.7.2
snappy :
sqlalchemy : 1.4.25
tables : 3.6.1
tabulate : 0.8.9
xarray : 0.18.0
xlrd : 2.0.1
xlwt : 1.3.0
zstandard : None
None
Process finished with exit code 0
The text was updated successfully, but these errors were encountered: