Pandas documentation has the following:
With sep = None, read_csv will try to draw the separator output automatically in some cases by "sniffing".
How can I access pandas' for a delimiter?
I want to read in 10 lines of my file, pandas guess the separator and run my GUI with the separator already selected. But I donβt know how to access what pandas considers a delimiter.
Also, is there a way to pass pandas a list of strings to limit his guesses?
, , read_csv. pandas Sniffer csv. , :
read_csv
pandas
Sniffer
csv
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
:
, ; #
, Sniffer.sniff(), .
Sniffer.sniff()
csv.Sniffer - , , . , , :
csv.Sniffer
reader = pd.read_csv('path/to/file.tar.gz', sep=None, engine='python', iterator=True) sep = reader._engine.data.dialect.delimiter reader.close()