Is there a difference between read_table and read_csv in pandas?

The only difference is in fact the default value for the sep argument.

read_csv uses sep=',', read_table uses sep='\t' and that's it.

We can confirm this with the help of the inspect module by getting the signature parameters as ordered mappings.

import inspect                                                                                                     
import pandas as pd                                                                                                

params_csv = inspect.signature(pd.read_csv).parameters                                                                
params_table = inspect.signature(pd.read_table).parameters

There are only two elements in the symmetric difference of the parameters which both correspond to the sep argument and its different default value for the two functions.

>>> params_csv.items() ^ params_table.items()                                                                                
{('sep', <Parameter "sep=','">), ('sep', <Parameter "sep='\t'">)}

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


Edit: Upon discussion, it was decided to keep the read_table, so this function is now undeprecated.

If you check out ~~ the Pandas documentation for read_table:

Deprecated since version 0.24.0.

Use pandas.read_csv() instead, passing sep='\t' if necessary.

So it is advised not to use read_table().