Screen Link:
My Code:
unrate['MONTH'] = unrate['DATE'].dt.month
fig = plt.figure(figsize=(6,3))
plt.plot(unrate[0:12]['MONTH'], unrate[0:12]['VALUE'], c='red')
plt.plot(unrate[12:24]['MONTH'], unrate[12:24]['VALUE'], c='blue')
plt.show()
What I expected to happen:
In the platform runs ok, but when I run in my Jupiter Notebook I have this error.
What actually happened:
ipython-input-60-0275face953d> in <module>
----> 1 unrate['MONTH'] = unrate['DATE'].dt.month
2 fig = plt.figure(figsize=(6,3))
3 plt.plot(unrate[0:12]['MONTH'], unrate[0:12]['VALUE'], c='red')
4 plt.plot(unrate[12:24]['MONTH'], unrate[12:24]['VALUE'], c='blue')
5 plt.show()
D:\Anaconda\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5173 or name in self._accessors
5174 ):
-> 5175 return object.__getattribute__(self, name)
5176 else:
5177 if self._info_axis._can_hold_identifiers_and_holds_name(name):
D:\Anaconda\lib\site-packages\pandas\core\accessor.py in __get__(self, obj, cls)
173 # we're accessing the attribute of the class, i.e., Dataset.geo
174 return self._accessor
--> 175 accessor_obj = self._accessor(obj)
176 # Replace the property with the accessor object. Inspired by:
177 # http://www.pydanny.com/cached-property.html
D:\Anaconda\lib\site-packages\pandas\core\indexes\accessors.py in __new__(cls, data)
341 pass # we raise an attribute error anyway
342
--> 343 raise AttributeError("Can only use .dt accessor with datetimelike " "values")
AttributeError: Can only use .dt accessor with datetimelike values
what is the issue if is the same code.