Python Pandas ValueError Arrays Must be All Same Length -


iterates on big list of .mp3 links metadata tags , save excel file. results in error. appreciate help. thanks.

    #print is_connected();      # create pandas dataframe data. df = pd.dataframe({'links' : lines ,'titles' : titles , 'singers': finalsingers , 'albums':finalalbums , 'years' : years})       # create pandas excel writer using xlsxwriter engine. writer = pd.excelwriter(xlspath, engine='xlsxwriter')      # convert dataframe xlsxwriter excel object. df.to_excel(writer, sheet_name='sheet1')     #df.to_excel(writer, sheet_name='sheet1')       # close pandas excel writer , output excel file. writer.save()  traceback (most recent call last):   file "mp.py", line 87, in <module>     df = pd.dataframe({'links' : lines ,'titles' : titles , 'singers': finalsingers , 'albums':finalalbums , 'years' : years})   file "c:\python27\lib\site-packages\pandas\core\frame.py", line 266, in __init__     mgr = self._init_dict(data, index, columns, dtype=dtype)   file "c:\python27\lib\site-packages\pandas\core\frame.py", line 402, in _init_dict     return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)   file "c:\python27\lib\site-packages\pandas\core\frame.py", line 5409, in _arrays_to_mgr     index = extract_index(arrays)   file "c:\python27\lib\site-packages\pandas\core\frame.py", line 5457, in extract_index     raise valueerror('arrays must same length') valueerror: arrays must same length 

you can avoid error

a = {'links' : lines ,'titles' : titles , 'singers': finalsingers , 'albums':finalalbums , 'years' : years} df = pd.dataframe.from_dict(a, orient='index') df.transpose() 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -