Skip to content

_check_for_bom at parsers.py remove all the fields behind BOM #31609

Closed
@limitspro

Description

@limitspro

Code Sample, a copy-pastable example if possible

import pandas as pd # version 0.23.0, the same as 1.0.0
df=pd.read_csv("1.csv",sep=r",") # 1.csv treat first row as header, which start with BOM due to some unknow reason.
print(df.columns)

Problem description

_check_for_bom will not just remove BOM, but also remove all the fields except for the first one.
due to code:

first_row = first_row[0] // line 2571 at parsers.py @0.23.0
first_row_bom = first_row[0] // line 2758 at parsers.py @latest code at github

Solution:
Change line 2775 at parsers.py @latest code at github to

return [first_row_bom[1:]]+first_row[1:]

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO CSVread_csv, to_csv

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions