How to read strange csv files in Pandas?
<p>I would like to read sample csv file shown in below</p>

<pre><code>--------------
 |A|B|C| 
--------------
 |1|2|3| 
--------------
 |4|5|6| 
--------------
 |7|8|9| 
--------------
</code></pre>

<p>I tried </p>

<pre><code>pd.read_csv("sample.csv",sep="|")
</code></pre>

<p>But it didn't work well.</p>

<p>How can I read this csv?</p>

<p>Try "import csv" rather than directly use pandas.</p>

<pre><code>import csv

easy_csv = []

with open('sample.csv', 'rb') as csvfile:
   test = csv.reader(csvfile, delimiter=' ', quotechar='|')
   for row in test:
      row_preprocessed = """ handling rows at here; removing |, ignoring row that has ----"""
      easy_csv.append([row_preprocessed])
</code></pre>

<p>After this preprocessing, you can save it into comma separated csv files to easily handle on pandas.</p>

python csv pandas