CSV data with several lines in a cell is being separated into new rows with pandas read_csv

Viewed 22

In my dataset I have a specific column which takes as input a free text written by the user. In many rows I have a single cell with several lines inside, just like a shopping list. When I read it with pandas, instead of it reading the whole cell as a whole, it sees the independent lines as independent rows and creates rows with just this specific subset of a string between two new lines. I need to make it so that the new lines inside this cell are ignored and it's just read as a single cell in a column. How can I do this?

Data split into two rows which I would like to avoid

Input data that is provided in several lines in a single cell

I would like to keep the data as a string as provided in the input

    file:
    id; Name; Observations
    1; John; Tall Slim Blonde
    2; Anna; Short

    df = pd.read_csv('file.csv', delimiter=';')
    output:
       id    Name    Observations
    0   1    John       Tall
    1  Slim  Blonde
    2   2    Anna       Short

    What I wanted:
       id    Name    Observations
    0   1    John    Tall Slim Blonde
    1   2    Anna       Short
0 Answers
Related