我有一个dataframe
通过 txt 文件读入的熊猫:
training = pd.read_csv('training_data.txt')
这些是列:
>> print training.columns.values`
['segment' 'cookie_id' 'num_visits' 'num_page_views']
我对显示num_page_views
分段密度的图表感兴趣,如下所示:
plot = ggplot(training, aes(x='num_visits')) + geom_density()
+ xlim(0,20) + facet_wrap( ~ 'segment')
print plot
它给出了以下错误:
TypeError Traceback (last last call last) in () 1 ----> 2 plot = ggplot(training, aes(x='num_visits')) + geom_density() +xlim(0,20) +facet_wrap( ~ 'segment ') 3 打印情节
TypeError:一元操作数类型错误〜:'str'