BUG: dict_keys
cannot be used as pd.read_csv
's names
parameter
#36928
Labels
Milestone
dict_keys
cannot be used as pd.read_csv
's names
parameter
#36928
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.
Code Sample, a copy-pastable example
test.csv
:Error:
Problem description
When a
dict_keys
object is passed, the keys aren't used as names. This is becausedict_keys
isn't list_like (pandas/pandas/io/parsers.py
Line 423 in 4e55346
dict_keys
without issue.Expected Output
Passing the dict keys to names shouldn't fail.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 4e55346
python : 3.8.3.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-118-generic
Version : #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8
pandas : 1.2.0.dev0+632.g4e553464f
numpy : 1.18.2
pytz : 2019.3
dateutil : 2.8.1
pip : 20.1.1
setuptools : 46.1.3
Cython : None
pytest : None
hypothesis : None
sphinx : 1.6.7
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 0.999999999
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : None
pandas_datareader: None
bs4 : 4.6.0
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.2.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: