繁体   English   中英

NameError: name "variable names" 未定义 Notebook

[英]NameError: name "variable names" is not defined Notebook

%matplotlib inline
import seaborn as sns
sns.set_style("darkgrid")
# import warnings
# warnings.filterwarnings("ignore")

# Select rows where both 'Rating' and 'Size' values are present (ie. the two values are not null)
apps_with_size_and_rating_present = apps[(~apps['Rating'].isnull()) & (~apps['Size'].isnull())]

# Subset for categories with at least 250 apps
large_categories = apps_with_size_and_rating_present.groupby(['Category']).filter(lambda x: len(x) >= 250)

# Plot size vs. rating
plt1 = sns.jointplot(x = large_categories['Size'], y = large_categories['Rating'])

# Select apps whose 'Type' is 'Paid'
paid_apps = apps_with_size_and_rating_present[apps_with_size_and_rating_present['Type'] == 'Paid']

# Plot price vs. rating
plt2 = sns.jointplot(x = paid_apps['Price'], y = paid_apps['Rating'])

测试用例提示错误。

NameError:未定义名称“apps_with_size_and_rating_present”

NameError:未定义名称“large_categories”

NameError: 名称 'plt1' 未定义

NameError:未定义名称“paid_apps”

NameError: 名称 'plt2' 未定义

这里有什么问题?

# Select rows where both 'Rating' and 'Size' values are present (ie. the two values are not null)
apps_with_size_and_rating_present = apps[apps["Rating"].notnull() & apps["Size"].notnull()]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM