为什么Python ggplot返回名称"aes"未定义? [英] Why Python ggplot returns name 'aes' is not defined?
本文介绍了为什么Python ggplot返回名称"aes"未定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用以下命令时
p = ggplot(aes(x='DTM',y='TMP1'), data=data)
我收到以下错误
NameError: name 'aes' is not defined
你能帮我吗?
推荐答案
您需要导入aes
:
from ggplot import aes
或者,您可以只导入ggplot
名称空间中的所有内容(尽管*
导入通常会受到限制,因为它们很难追踪名称的来源):
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 *
这篇关于为什么Python ggplot返回名称"aes"未定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文