python - Pandas read_csv do not interprete quotechar -


using following csv file:

"aa"!#"2811"!#"location"!#"11"!#"67000"!#"zz" "bb"!#2812!#"location"!#"22"!#"67540"!#"xx" "cc"!#"2813"!#location!#"33"!#"67117"!#"yy" "dd"!#"2452"!#"location"!#"44"!#"67000"!#"zz" 

and using following python code :

import pandas import csv pandas.read_csv("test.csv", sep="!#", header=none, quotechar='"') 

give following result:

      0      0       1           2     3        4     5 0  "aa"  "2811"  "location"  "11"  "67000"  "zz" 1  "bb"    2812  "location"  "22"  "67540"  "xx" 2  "cc"  "2813"    location  "33"  "67117"  "yy" 3  "dd"  "2452"  "location"  "44"  "67000"  "zz" 

however, specified quotechar='"', result should be

    0     1         2   3      4   5 0  aa  2811  location  11  67000  zz 1  bb  2812  location  22  67540  xx 2  cc  2813  location  33  67117  yy 3  dd  2452  location  44  67000  zz 

am missing ?

edit: replacing !# , makes work, apparently, quotechar isn't interpreted sep more 1 char. i'm looking solution without str.replace() (i can't change !#, , " important !# can found within column.

please see here: python pandas read_csv quotechar not work

the quotechar not work if separator more 1 character. tried comma separator , works.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -