A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/12157 below:

read_excel(..., index_col=0, squeeze=True) raises AttributeError · Issue #12157 · pandas-dev/pandas · GitHub

pd.read_excel with keyword argument squeeze=True raises an AttributeError. This is unexpected, in that:

Steps to reproduce:

In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '0.17.1'

In [3]: df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})

In [4]: df.to_csv('tmp.csv', index=False)

In [5]: df.to_excel('tmp.xlsx', index=False)

In [6]: pd.read_csv('tmp.csv', index_col=0, squeeze=True)
Out[6]:
a
1    3
2    4
Name: b, dtype: int64

In [7]: pd.read_excel('tmp.xlsx', index_col=0, squeeze=True)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-ed256b323894> in <module>()
----> 1 pd.read_excel('tmp.xlsx', index_col=0, squeeze=True)

C:\Anaconda3\lib\site-packages\pandas\io\excel.py in read_excel(io, sheetname, header, skiprows, skip_footer, index_col, parse_cols, parse_dates, date_parser, na_values, thousands, convert_float, has_index_names, converters, engine, **kwds)
    168         date_parser=date_parser, na_values=na_values, thousands=thousands,
    169         convert_float=convert_float, has_index_names=has_index_names,
--> 170         skip_footer=skip_footer, converters=converters, **kwds)
    171
    172 class ExcelFile(object):

C:\Anaconda3\lib\site-packages\pandas\io\excel.py in _parse_excel(self, sheetname, header, skiprows, skip_footer, index_col, has_index_names, parse_cols, parse_dates, date_parser, na_values, thousands, convert_float, verbose, **kwds)
    437
    438             output[asheetname] = parser.read()
--> 439             output[asheetname].columns = output[asheetname].columns.set_names(header_names)
    440
    441         if ret_dict:

C:\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   2353                 or name in self._metadata
   2354                 or name in self._accessors):
-> 2355             return object.__getattribute__(self, name)
   2356         else:
   2357             if name in self._info_axis:

AttributeError: 'Series' object has no attribute 'columns'

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4