I have the following list:
list = [-0.14626096918979603,
0.017925919395027533,
0.41265398151061766]
I have created a pandas dataframe using the following code:
df = pd.DataFrame(list, index=['var1','var2','var3'], columns=['Col1'])
df
Col1
var1 -0.146261
var2 0.017926
var3 0.412654
Now I have a new list:
list2 = [-0.14626096918979603,
0.017925919395027533,
0.41265398151061766,
-0.8538301985671065,
0.08182534201640915,
0.40291331836021105]
I would like to arrange the dataframe in a way that the output looks like this (MANUAL EDIT)
Col1 Col2
var1 -0.146261 -0.8538301985671065
var2 0.017926 0.08182534201640915
var3 0.412654 0.40291331836021105
and that whenever there is a third or foruth colum... the data gets arranged in the same way. I have tried to convert the list to a dict but since I am new with python I am not getting the desired output but only errors due to invalid shapes.
-- EDIT --
Once I have the dataframe created, I want to plot it using df.plot(). However, the way the data is shown is not what I would like. I am comming from R so I am not sure if this is because of the data structure used in the dataframe. Is is it that I need one measurement in each row?
My idea would be to have the col1, col2, col3 in the x-axis (it's a temporal series). In the y-axis the range of values (so that is ok in that plot) and the differnet lines should be showing the evolution of var1, var2, var3, etc.


list2deliberatly longer than the first column of your DataFrame or is that final output just a slice from the actual output?list2.list2will be any multiple of 3 so itslenwould be 3,6,9.... The number orrowsindfshould be always 3 and data should be "split" in the columns. Hope its clearlist2 = [i for i in list2 if i not in list] then df['Col2'] = list2listto compare with butlist2will be produce directly. I started testing the converstion fromlisttodfand now would like to move to the real case