title: removing new lines from a data frame column
body: <p>I'm trying to clean my dataset I scrapped the data from abjjad. I have five columns <code>book_title, author, Cover_url, genres, and descriptions.</code> for the genres column, the data that I scraped has the following syntax</p>
  <blockquote>
  <p>روايات وقصص روايات اجتماعية | روايات وقصص روايات واقعية |</p>
  </blockquote>
  <p>here is <a href="https://i.stack.imgur.com/S5c9Z.jpg" rel="nofollow noreferrer">an image of exactly how it looks in vscode</a></p>
  <p>so I wanted to turn this into a list with each genre being in a separate cell. Genres are separated by a new line and by '|'. first, I used this line to remove the '|'</p>
  <pre><code>df = pd.read_csv(&quot;/data/abjjad.csv&quot;,converters={'genres': lambda x: x[1:-1].split('|')})
  </code></pre>
  <p>I was able to achieve this</p>
  <pre><code>['روايات وقصص\nروايات اجتماعية\n', '\nروايات وقصص\nروايات واقعية\n']
  </code></pre>
  <p>but the desired output is this `</p>
  <pre><code> ['روايات وقصص' ,'روايات اجتماعية','روايات وقصص', 'روايات واقعية']
  </code></pre>
  <p>I've looked into many questions similar to mine but haven't found a solution that works for me.</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/44227748/removing-newlines-from-messy-strings-in-pandas-dataframe-cells">removing newlines from messy strings in pandas dataframe cells?</a></li>
  <li><a href="https://stackoverflow.com/questions/52254186/remove-n-in-text-in-pandas-python">Remove &#39;\n&#39; in text in pandas python</a></li>
  <li><a href="https://stackoverflow.com/questions/67607354/removing-n-character-from-a-column-in-python-dataframe">Removing /N character from a column in Python Dataframe</a></li>
  </ul>