I have pandas dataframe in which a column contains paragraphs of text. I wanted to explode the dataframe into separate columns by splitting the paragraphs of text into newlines. The paragraph of text may contain multiple new lines.
Example dataframe:
Current output:
A
foo bar
foo bar\nfoo bar
foo bar
foo bar
Desired output:
   A         B                                                      
0 foo bar                                                  
1 foo bar   foo bar                                                 
2 foo bar                                                  
3 foo bar                                                  
I have tried using this:
df.A.str.split(expand=True))
But it is splitting at every whitespace not "/n" as expected.
 
     
     
     
    