如何解决AttributeError:模块“ matplotlib”没有属性“ xlabel”
我的代码是:
import matplotlib as plt
sns.distplot(CMSU['Spending'],kde = False)
plt.xlabel("Spending",size=15)
plt.ylabel("Probablity",size=15)
plt.title("distribution for the variable - Spending",size=18);
我遇到了错误:
AttributeError Traceback (most recent call last)
<ipython-input-32-1c6eb744a592> in <module>
1 sns.distplot(CMSU['Spending'],kde = False)
----> 2 plt.xlabel("Spending",size=15)
3 plt.ylabel("Probablity",size=15)
4 plt.title("distribution for the variable - Spending",size=18);
AttributeError: module 'matplotlib' has no attribute 'xlabel'
有什么可能出问题?
解决方法
我认为您需要做import matplotlib.pyplot as plt
而不只是matplotlib as plt
,因为xlabel
以及matplotlib中可能不存在其他各种功能。
您的return jsonify({'location': filename})
语句是错误的。这些方法属于import
。也就是说,您应该这样导入它:
pyplot
,
使用:
$param_var = New-Object MySql.Data.MySqlClient.MySqlParameter("@my_col_bool",$SqlDbType.TinyInt)
$oMYSQLCommand.Parameters.Add($param_var) | Out-Null
$oMYSQLCommand.ExecuteNonQuery()/*Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Incorrect integer value: 'false' for column 'my_col_bool' at row 1" */
与matplotlib.pyplot.xlabel()
和ylabel
相同:
title
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。