Is there a difference between read_table and read_csv in pandas?

前端 未结 3 1250
太阳男子
太阳男子 2021-02-13 11:59

I\'ve tested it and also checked the documentation with no visible differences.Either way i wanted to ask just in case.

Do you think that read_csv should be used only fo

3条回答
  •  礼貌的吻别
    2021-02-13 12:50

    You can get either to work for general delimited files, the difference are the default params, for instance sep is '\t' (tab) for read_table but ',' for read_csv. They're both implemented the same underneath

    If you look at the source

    they call the same function with different separators:

    read_csv = _make_parser_function('read_csv', sep=',')
    read_csv = Appender(_read_csv_doc)(read_csv)
    
    read_table = _make_parser_function('read_table', sep='\t')
    read_table = Appender(_read_table_doc)(read_table)
    

    and _make_parser_function:

    def _make_parser_function(name, sep=','):
    

    is a general method which accepts the sep arg

提交回复
热议问题