pandas.read_csv: how to skip comment lines

后端 未结 3 1069
礼貌的吻别
礼貌的吻别 2020-12-05 07:00

I think I misunderstand the intention of read_csv. If I have a file \'j\' like

# notes
a,b,c
# more notes
1,2,3

How can I pandas.read_csv t

3条回答
  •  甜味超标
    2020-12-05 07:19

    So I believe in the latest releases of pandas (version 0.16.0), you could throw in the comment='#' parameter into pd.read_csv and this should skip commented out lines.

    These github issues shows that you can do this:

    • https://github.com/pydata/pandas/issues/10548
    • https://github.com/pydata/pandas/issues/4623

    See the documentation on read_csv: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html

提交回复
热议问题