ggplot facet_wrapタイプ引数yhat:私はは、私はtxtファイルを経由して読み込まパンダのデータフレームを持っているエラー
>> print training.columns.values
['segment' 'cookie_id' 'num_visits' 'num_page_views']
:
training = pd.read_csv('training_data.txt')
これらは列ですセグメントごとに「num_page_views」の密度を示すグラフに興味があります。
plot = ggplot(training, aes(x='num_visits')) + geom_density()
+ xlim(0,20) + facet_wrap(~ 'segment')
print plot
そして、それは、次のエラー与える:
TypeError Traceback (most recent call last) in() 1 ----> 2 plot = ggplot(training, aes(x='num_visits')) + geom_density() +xlim(0,20) +facet_wrap(~ 'segment') 3 print plot
TypeError: bad operand type for unary ~: 'str'
私は例を見ていますが、ドキュメントはありません。あなたは答えています: "これはドキュメントにあります(便宜上ここにコピーしてあります):" –