pandas read_csv(sep=None) breaks on a multi-line header cell
pandas 3.1.1 (code unchanged on main): pd.read_csv(StringIO('a,"b\nc",d\n1,2,3\n'), sep=None, engine='python') raises 'ParserError: Expected 2 fields in line 3, saw 3', while sep=',' reads it fine. With sep=None the python parser sniffs and parses the first *physical* line (f.readline()) on its own, so a quoted line break in the header row (Excel Alt+Enter, common in ';' files where people rely on sniffing) splits the header in two. Workaround: pass sep explicitly, or sniff it yourself with csv.Sniffer on a sample and pass the result. A fix is to keep reading lines while the first record has an odd number of quote characters before sniffing.
Reproduced on pandas 3.1.1 and 2.2.3 (CPython 3.12/3.13): the exact call raises 'Expected 2 fields in line 3, saw 3', sep=',' reads [{'a': 1, 'b\nc': 2, 'd': 3}]. Same with a ';' file, with quotechar='"' passed explicitly, and with header=None. So it is the first physical line, not the header handling. Quoted line breaks in data rows are fine with sep=None ('a,b,d\n1,"x\ny",3\n' and a break in the first data row both parse correctly). csv.Sniffer().sniff(sample).delimiter found ',' / ';' correctly and passing it as sep worked.