Skip to content

DataFrame fail if columns is non-unique MultiIndex #1970

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

Closed
changhiskhan opened this issue Sep 26, 2012 · 1 comment
Closed

DataFrame fail if columns is non-unique MultiIndex #1970

changhiskhan opened this issue Sep 26, 2012 · 1 comment
Labels
Milestone

Comments

@changhiskhan
Copy link
Contributor

In [33]: cols2 = pd.MultiIndex.from_tuples(list(itertools.product(['A', 'B', 'C'], ['X', 'Y', 'Z']))*2)

In [34]: df2 = DataFrame(np.random.randn(3, len(cols2)), columns=cols2)

In [35]: df2
Out[35]: ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 df2

/Users/changshe/code/ipython/IPython/core/displayhook.pyc in call(self, result)
236 self.start_displayhook()
237 self.write_output_prompt()
--> 238 format_dict = self.compute_format_data(result)
239 self.write_format_data(format_dict)
240 self.update_user_ns(result)

...

/Users/changshe/code/pandas/pandas/core/format.pyc in _get_formatted_column_labels(self)
341 fmt_columns = self.columns.format(sparsify=False, adjoin=False)
342 fmt_columns = zip(fmt_columns)
--> 343 dtypes = self.frame.dtypes.values
344 need_leadsp = dict(zip(fmt_columns, map(is_numeric_dtype, dtypes)))
345 str_columns = zip(
[[' ' + y

/Users/changshe/code/pandas/pandas/core/frame.pyc in getattr(self, name)
1764 return self[name]
1765 raise AttributeError("'%s' object has no attribute '%s'" %
-> 1766 (type(self).name, name))
1767
1768 def setattr(self, name, value):

AttributeError: 'DataFrame' object has no attribute 'dtypes'

@changhiskhan
Copy link
Contributor Author

Fixed underlying problem in BlockManager.iget

yarikoptic added a commit to neurodebian/pandas that referenced this issue Sep 27, 2012
Version 0.9.0 Release Candidate 2

* tag 'v0.9.0rc2':
  DOC: release notes, bump to RC2
  DOC: missed a few for release notes 0.9
  DOC: add a few more notes on bug fixes in release.rst
  BUG: repr fix for all-NA index level. close pandas-dev#1971
  BLD: don't link against math library on windows
  TST: kludge around test failure on win64 python 3.2.2
  BLD: link against math library explicitly. close pandas-dev#1955
  DOC: Add line about resetting to default index
  DOC: Adding details on normalization for variance functions.
  DOC: Specify default merge behavior for on = None
  BUG: PeriodIndex slicing by datetime fails when either end out-of-bounds pandas-dev#1977
  BUG: read_table unicode bug pandas-dev#1975
  BUG: BlockManager.iget fails with non-unique MultiIndex pandas-dev#1970
  Better error message for DataFrame.apply if axis is not 0 or 1
  TST: fix up tzlocal test cases
  DOC: add level option in Series.reset_index to release notes
  ENH: level parameter for Series.reset_index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant