Skip to content
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

DataFrame constructor bug from single Series with different Index #475

wesm opened this issue Dec 12, 2011 · 0 comments


Copy link

commented Dec 12, 2011

reported by a user

In [7]: DataFrame(Series(np.arange(10)), index=range(5))
AssertionError                            Traceback (most recent call last)
/home/wesm/code/pandas/<ipython-input-7-0a85de6b44f0> in <module>()
----> 1 DataFrame(Series(np.arange(10)), index=range(5))

/home/wesm/code/pandas/pandas/core/frame.pyc in __init__(self, data, index, columns, dtype, copy)
    206             else:
    207                 mgr = self._init_ndarray(data, index, columns, dtype=dtype,
--> 208                                          copy=copy)
    209         elif isinstance(data, list):                                                     
    210             mgr = self._init_ndarray(data, index, columns, dtype=dtype,

/home/wesm/code/pandas/pandas/core/frame.pyc in _init_ndarray(self, values, index, columns, dtype, copy)                                                                                          
    287         columns = _ensure_index(columns)
    288         block = make_block(values.T, columns, columns)
--> 289         return BlockManager([block], [columns, index])
    291     def _wrap_array(self, arr, axes, copy=False):

/home/wesm/code/pandas/pandas/core/internals.pyc in __init__(self, blocks, axes, do_integrity_check)                                                                                              
    275         if do_integrity_check:
--> 276             self._verify_integrity()
    278     @property

/home/wesm/code/pandas/pandas/core/internals.pyc in _verify_integrity(self)
    353         mgr_shape = self.shape
    354         for block in self.blocks:
--> 355             assert(block.values.shape[1:] == mgr_shape[1:])
    356         tot_items = sum(len(x.items) for x in self.blocks)
    357         assert(len(self.items) == tot_items)


@wesm wesm closed this in d472cd7 Dec 12, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.