python - Getting a list of arrays into a Pandas dataframe -


so have list of arrays in python: [[0, 1, 0, 1], [1, 0, 1, 1], [0, 1, 1, 1]]. make list of arrays pandas dataframe, each array being row. there way , in python? tried values = np.split(values, len(values)) split list of arrays multiple arrays (well, tried). , tried create dataframe df = pd.dataframe(values). error came from. got "must pass 2-d input" error message. idea i'm doing wrong , how fix it? or easier way go this? thanks!

no need splitting, etc. if have list of lists 2 dimensional (meaning rows have same number of elements), can pass dataframe constructor:

data = [[0, 1, 0, 1], [1, 0, 1, 1], [0, 1, 1, 1]] pd.dataframe(data) 

generating expected:

>>> pd.dataframe(data)    0  1  2  3 0  0  1  0  1 1  1  0  1  1 2  0  1  1  1 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -