Why Python ggplot returns name 'aes' is not defined?

一世执手 提交于 2019-12-23 07:49:38

问题


When I use the following comand

p = ggplot(aes(x='DTM',y='TMP1'), data=data)

I get the following error

NameError: name 'aes' is not defined

Could you help me?


回答1:


You need to import aes:

from ggplot import aes

Alternatively, you can just import everything in the ggplot namespace (though * imports are usually frowned upon as they make it difficult to track down where a name is coming from):

from ggplot import *


来源:https://stackoverflow.com/questions/23457513/why-python-ggplot-returns-name-aes-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!