I have a pandas dataframe with the following columns:
training = pd.read_csv('training_data.txt') print training.columns.values
['segment' 'cookie_id' 'num_visits' 'num_page_views']
I'm interested in a graph that shows the density of 'num_page_views' by segment, like so:
plot = ggplot(training, aes(x='num_visits')) + geom_density() +xlim(0,20) +facet_wrap( ~ 'segment') print plot
And it gives the following error:
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'
yhat ggplot facet_wrap type error
Aucun commentaire:
Enregistrer un commentaire