I have a function that gives an output of 100+ elements for each input, and each output is appended to a list creating a list of lists:
def func(mols: List[str]):
feaut = []
for i, mol in enumerate(mols):
feaut.append(FG.features_generator(mol)) #This is calling another function from a
return feaut # package I am using
This is the output:
[[2.1874960973678963,10.264662506490405,2.7071067811865475,1.9855985596534889,...],
[2.475534205527556,24.264662506490403,2.7071067811865475,1.9472135954999579,...]]
What is required is to create a DataFrame that has the element passed into the function in one column and each element of the output in separate columns, like the following:
element passed | output1 | output2 | output3 | outputN |
---|---|---|---|---|
one | 2.187 | 10.264 | 2.707 | 1.985 |
two | 2.475 | 24.26 | 2.70 | 1.94 |
What I currently have is:
element passed | output |
---|---|
one | [2.187,10.264,2.707,1.985...] |
two | [2.475,24.26,2.70,1.94... ] |