Python Convert Datetime from csv for matplotlib
<p>I am trying to plot from a csv file with column 1 as a datetime value, as below</p>

<pre><code> 27-08-2016 08:43   21.38329164
</code></pre>

<p>using this code:</p>

<pre><code>from matplotlib import pyplot as plt
from matplotlib import style
import numpy as np
import datetime as dt
from datetime import datetime
import matplotlib.dates as mdates

style.use('ggplot')

x,y = np.genfromtxt('I112-1a.csv', unpack=True,dtype=None, delimiter = ',', converters={0: lambda x: datetime.strptime(x, '%d-%m-%Y %H:%M')})


plt.title('Panel Charge')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()
</code></pre>

<p>I am getting this error:</p>

<pre><code>    x,y = np.genfromtxt('I112-1a.csv', unpack=True,dtype=None, delimiter = ',', converters={0: lambda x: datetime.strptime(x, '%d-%m-%Y %H:%M')})
ValueError: too many values to unpack
</code></pre>

<p>Please help! 
Thanks</p>

<pre><code>from matplotlib import pyplot as plt
from matplotlib import style
import numpy as np
import datetime as dt
from datetime import datetime
import matplotlib.dates as mdates


style.use('ggplot')
data = np.genfromtxt('I112-1.csv', unpack=True,dtype=None, names=True,delimiter = ',', converters={0: lambda x: datetime.strptime(x, '%d-%m-%Y %H:%M')})
x = data['Time']
y = data['Charge']

plt.plot (x,y)                
plt.title('Panel Charge')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()
</code></pre>

python csv pandas matplotlib genfromtxt