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

Raise more specific exception on concat([None]) #8501

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pandas/tools/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def merge(left, right, how='inner', on=None, left_on=None, right_on=None,
merge.__doc__ = _merge_doc % '\nleft : DataFrame'


class MergeError(Exception):
class MergeError(ValueError):
pass


Expand Down Expand Up @@ -679,7 +679,7 @@ def concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False,
If a dict is passed, the sorted keys will be used as the `keys`
argument, unless it is passed, in which case the values will be
selected (see below). Any None objects will be dropped silently unless
they are all None in which case an Exception will be raised
they are all None in which case a ValueError will be raised
axis : {0, 1, ...}, default 0
The axis to concatenate along
join : {'inner', 'outer'}, default 'outer'
Expand Down Expand Up @@ -764,7 +764,7 @@ def __init__(self, objs, axis=0, join='outer', join_axes=None,
keys = clean_keys

if len(objs) == 0:
raise Exception('All objects passed were None')
raise ValueError('All objects passed were None')

# consolidate data & figure out what our result ndim is going to be
ndims = set()
Expand Down
2 changes: 1 addition & 1 deletion pandas/tools/tests/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ def test_concat_exclude_none(self):
pieces = [df[:5], None, None, df[5:]]
result = concat(pieces)
tm.assert_frame_equal(result, df)
self.assertRaises(Exception, concat, [None, None])
self.assertRaises(ValueError, concat, [None, None])

def test_concat_datetime64_block(self):
from pandas.tseries.index import date_range
Expand Down