0

I have a dataset as follows:

Col1 Col2 ... Text
...  ...  ... Include details about your goal...
...  ...  ... Avoid asking opinion-based questions.

I would need to explode Text column in order to build a frequency plot. I have tried with: df.Text.explode().

still_learning
  • 776
  • 9
  • 32

1 Answers1

2

Try this:

df['Text'] = df['Text'].str.split()
df = df.explode('Text')

     Col1           Text
0  Value1        Include
0  Value1        details
0  Value1          about
0  Value1           your
0  Value1           goal
1  Value2          Avoid
1  Value2         asking
1  Value2  opinion-based
1  Value2     questions.
NYC Coder
  • 7,424
  • 2
  • 11
  • 24