Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Multiple Character Delimiter in Python Pandas read_csv

Tags:

It appears that the pandas read_csv function only allows single character delimiters/separators. Is there some way to allow for a string of characters to be used like, "*|*" or "%%" instead?

like image 911
slaw Avatar asked Jul 02 '15 21:07

slaw


People also ask

Can a delimiter be multiple characters?

When using MS Excel's Text to column feature, you can tell Excel what to use as a delimiter in order to split text into columns.


1 Answers

Pandas does now support multi character delimiters

import panda as pd
pd.read_csv(csv_file, sep="\*\|\*")
like image 75
jvans Avatar answered Sep 20 '22 09:09

jvans