Pandas documentation has this:
With sep=None, read_csv will try to infer the delimiter automatically
in some cases by “sniffing”.
Looking at the source code, I doubt that it's possible to get the delimiter out of
pandas internally uses the
Sniffer class from the
csv module. Here's an example that should get you going:
import csv s = csv.Sniffer() print s.sniff("a,b,c").delimiter print s.sniff("a;b;c").delimiter print s.sniff("a#b#c").delimiter
, ; #
What remains, is reading the first line from a file and feeding it to the
Sniffer.sniff() function, but I'll leave that up to you.