from matplotlib import style
fig = plt.figure()
ax1= fig.add_subplot(311)
ax2= fig.add_subplot(312)
ax3= fig.add_subplot(313)
style.use('ggplot')
y_2004 = dataset["2004"]["AEP_MW"].to_list()
x_2004 = dataset["2004"]["Date"].to_list()
ax1.plot(x_2004,y_2004, color="green", linewidth=1.7)
y_2005 = dataset["2005"]["AEP_MW"].to_list()
x_2005 = dataset["2005"]["Date"].to_list()
ax2.plot(x_2005, y_2005, color="green", linewidth=1)
y_2006 = dataset["2006"]["AEP_MW"].to_list()
x_2006 = dataset["2006"]["Date"].to_list()
ax3.plot(x_2006, y_2006, color="green", linewidth=1)
plt.rcParams["figure.figsize"] = (18,8)
plt.title("Energy consumptionnin")
plt.xlabel("Date")
plt.ylabel("Energy in MW")
plt.grid(True, alpha=1)
plt.legend()
for label in ax1.xaxis.get_ticklabels():
label.set_rotation(90)
i am getting this error
AssertionError Traceback (most recent call last)
<ipython-input-37-0608ff1e5b3b> in <module>
11 style.use('ggplot')
12
---> 13 y_2004 = dataset["2004"]["AEP_MW"].to_list()
14 x_2004 = dataset["2004"]["Date"].to_list()
15 ax1.plot(x_2004,y_2004, color="green", linewidth=1.7)
~\Anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
2883 # either we have a slice or we have a string that can be converted
2884 # to a slice for partial-string date indexing
-> 2885 return self._slice(indexer, axis=0)
2886
2887 # Do we have a (boolean) DataFrame?
~\Anaconda3\lib\site-packages\pandas\core\generic.py in _slice(self, slobj, axis)
3555 Slicing with this method is *always* positional.
3556 """
-> 3557 assert isinstance(slobj, slice), type(slobj)
3558 axis = self._get_block_manager_axis(axis)
3559 result = self._constructor(self._mgr.get_slice(slobj, axis=axis))
AssertionError: <class 'numpy.ndarray'>