Skip to content

Commit

Permalink
BUG: fix concatenate bug causing #2057, but obscured by omitted asser…
Browse files Browse the repository at this point in the history
…ts. close #2057
  • Loading branch information
wesm committed Nov 19, 2012
1 parent 1320156 commit 19dc284
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,7 @@ def is_list_like(arg):
def _is_sequence(x):
try:
iter(x)
assert(not isinstance(x, basestring))
return True
return not isinstance(x, basestring) and True
except Exception:
return False

Expand Down
7 changes: 5 additions & 2 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ def __init__(self, values, items, ref_items, ndim=2):
if issubclass(values.dtype.type, basestring):
values = np.array(values, dtype=object)

assert(values.ndim == ndim)
assert(len(items) == len(values))
if values.ndim != ndim:
raise AssertionError('Wrong number of dimensions')

if len(items) != len(values):
raise AssertionError('Wrong number of items passed')

self._ref_locs = None
self.values = values
Expand Down
2 changes: 1 addition & 1 deletion pandas/tools/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ def _get_reindexed_data(self):

def _concat_blocks(self, blocks):
values_list = [b.values for b in blocks if b is not None]
concat_values = com._concat_compat(values_list)
concat_values = com._concat_compat(values_list, axis=self.axis)

if self.axis > 0:
# Not safe to remove this check, need to profile
Expand Down

0 comments on commit 19dc284

Please sign in to comment.