Plot a CSV file where the delimiter is '; ' (semicolon + space)
<p>I'm learning how to plot things (CSV files) in Python, using <code>import matplotlib.pyplot as plt</code>. </p>

<pre><code>Column1;Column2;Column3;
1;4;6;
2;2;6;
3;3;8;
4;1;1;
5;4;2;
</code></pre>

<p>I can plot the one above with <code>plt.plotfile('test0.csv', (0, 1), delimiter=';')</code>, getting the figure below.</p>

<p><a href="http://i.stack.imgur.com/mYkFJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/mYkFJ.png" alt="enter image description here"></a></p>

<p>I can also plot that data if I change the separator from <code>';'</code> (semicolon) to <code>','</code> (comma).</p>

<pre><code>Column1,Column2,Column3,
1,4,6,
2,2,6,
3,3,8,
4,1,1,
5,4,2,
</code></pre>

<p>using <code>plt.plotfile('test0.csv', (0, 1), delimiter=',')</code>.</p>

<p>But didn't managed to plot data where the separator is <code>'; '</code> (semicolon + space), as show below. Can I still shoot this with <code>matplotlib.pyplot</code> or it's time to something else?</p>

<pre><code>Column1; Column2; Column3; 
1; 4; 6; 
2; 2; 6; 
3; 3; 8; 
4; 1; 1; 
5; 4; 2; 
</code></pre>

<p>So the error matplotlib is throwing you is</p>

<pre><code> TypeError: "delimiter" must be a 1-character string
</code></pre>

<p>Which makes it seem very unlikely you can use <code>'; '</code>. I also had errors thrown when I tried <code>delimiter=';'</code> although you may wish to check that that is reproducible.</p>

<p>However pandas handles this just fine with <code>pd.read_csv</code> if you have it available.</p>

<pre><code>import pandas as pd
alpha = pd.read_csv(filepath,delimiter=';')
alpha.Column1
0    1
1    2
2    3
3    4
4    5
Name: Column1, dtype: int64
</code></pre>

python python-2.7 matplotlib