2

I have searched but till not able to figure out how to make data frame from below:

0       ([179, 142, 176, 177, 176, 180, 180, 180, 180,...
1       ([353, 314, 349, 349, 344, 359, 359, 359, 359,...
2       ([535, 504, 535, 535, 535, 540, 540, 540, 540,...
3       ([711, 664, 703, 703, 703, 721, 721, 721, 721,...
4       ([850, 810, 822, 822, 842, 857, 857, 857, 857,.

below is how single data looks

([179, 142, 176],
 ['Qtr- Oct-20','Qtr- Oct-20','Qtr- Oct-20',],
 ['High','Low','Close'],
 [43.8, 26.05,33.1])

what i want is

      0  1           2               3
0   179 Qtr- Oct-20 High            43.8
1   142 Qtr- Oct-20 Low             26.05
2   176 Qtr- Oct-20 High_Volume     1123132
3   177 Qtr- Oct-20 High_Delivery   42499

what i am getting

      0
0   ([179, 142, 176, 177, 176, 180, 180, 180, 180,...
1   ([353, 314, 349, 349, 344, 359, 359, 359, 359,...
2   ([535, 504, 535, 535, 535, 540, 540, 540, 540,...

1 Answer 1

1

Let's do apply + pd.Series.explode:

pd.DataFrame(df['col'].tolist()).apply(pd.Series.explode).reset_index(drop=True)

     0            1      2      3
0  179  Qtr- Oct-20   High   43.8
1  142  Qtr- Oct-20    Low  26.05
2  176  Qtr- Oct-20  Close   33.1

Note: df['col'] is the column in the dataframe which contains list of lists.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.