ENH: Improve error message when using DataFrame.from_items instead of DataFrame.from_records (original) (raw)

User reported from an early version of pandas, but this is still present in master:

import pandas

counters = [
    ('a', 98172247543414),
    ('b', 7805009),
    ('c', 1172983),
    ]

df = pandas.DataFrame.from_items(counters)


# Traceback (most recent call last):                                                                                                                
#   File "/home/user/ptest.py", line 12, in <module>                                                                                               
#     df = pandas.DataFrame.from_items(counters)                                                                                                    
#   File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.1-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 932, in from_items                
#   File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.1-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 947, in _from_arrays              
#   File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.1-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 4463, in _arrays_to_mgr           
#   File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.1-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 4502, in extract_index            
# ValueError: If using all scalar values, you must must pass an index