Skip to content
Advertisement

Importing count() data for use within bokeh

I am trying to create a visualisation using the bokeh package which I have imported into the Databricks environment. I have transformed the data from a raw data frame into something resembling the following (albeit much larger):

JavaScript

From there, I wish to create a line graph using the bokeh package to show the number of papers released per month (for the last 12 months). I have started using the code below:

JavaScript

Which has produced the table of results I need in the correct order. However, when I use the code below to try to transform the resulting data (from the df above) into the line plot, I am receiving an error.

The code:

JavaScript

The error:

JavaScript

Now, I can only assume this is because I am trying to use the ‘count’ column, created by a ‘built in function’ to create the variables for my plot. My question is, is there a different way to approach the creating of my table of results so that bokeh recognising this ‘count’ column as a string or a int, instead of a built-in function?

Advertisement

Answer

count is a method of a Row, so you can’t get the count column of the Row using the dot notation. Instead, you can use the square brackets notation, e.g.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement