Clearer error message for pd.concat if empty iterator is passed · Issue #9157 · pandas-dev/pandas (original) (raw)

It is not possible to concatenate an empty sequence of data frames.

import pandas as pd
dfs = []
pd.concat(dfs)
/Users/ch/miniconda/envs/sci33/lib/python3.3/site-packages/pandas/tools/merge.py in __init__(self, objs, axis, join, join_axes, keys, levels, names, ignore_index, verify_integrity, copy)
    765 
    766         if len(objs) == 0:
--> 767             raise ValueError('All objects passed were None')
    768 
    769         # consolidate data & figure out what our result ndim is going to be

ValueError: All objects passed were None

I would suggest catching this special case in pd.concat before trying to merge and to raise an error with a clearer error description. For this special case, the current error message is not very helpful.