I think that you are almost there, try to remove the extra square brackets around lst (you also do not need to specify column names when you create a data frame from such words):
import pandas as pd lst1 = range(100) lst2 = range(100) lst3 = range(100) percentile_list = pd.DataFrame( {'lst1Title': lst1, 'lst2Title': lst2, 'lst3Title': lst3 }) percentile_list lst1Title lst2Title lst3Title 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 ...
If you need a more productive solution, you can use np.column_stack rather than zip as in the first attempt, in this example it is about 2 times more acceleration, however, in my opinion, this requires cost of readability:
import numpy as np percentile_list = pd.DataFrame(np.column_stack([lst1, lst2, lst3]), columns=['lst1Title', 'lst2Title', 'lst3Title'])
maxymoo May 29 '15 at 6:40 2015-05-29 06:40
source share