python - Pandas read_csv. Using '^A' as a delimeter -
i have csv file field separators ^a characters. when try
df = pd.read_csv(p_file, sep='^a') the file looks follows:
0j0nrqdhhx^a989.0^a1 0j0nrqdhhx^a1204.0^a1 0u0nrqdhhx^a1654.0^a1 0n0nrqdhhx^a1679.0^a3 ... however, when run command above, in 1 column. why?
use sep='\^a:
pd.read_csv(p_file, sep='\^a') reason sep accepts regular expressions, , ^ has special meaning in regular expressions, \ used escape this.
Comments
Post a Comment