Monday 29 July 2019

Visualization - Display Function

Visualization

Databricks provides easy-to-use, built-in visualizations for your data.
Display the data by invoking the Spark display function.
Visualize the query below by selecting the bar graph icon once the table is displayed:

How many women were named Mary in each year?
marysDF = (peopleDF.select(year("birthDate").alias("birthYear")) 
  .filter("firstName = 'Mary' ") 
  .filter("gender = 'F' ") 
  .orderBy("birthYear") 
  .groupBy("birthYear") 
  .count()
)

To start the visualization process, first apply the display function to the DataFrame.
Next, click the graph button in the bottom left corner (second from left) to display data in different ways.
The data initially shows up in html format as an n X 2 column where one column is the birthYear and another column is count.

No comments:

Post a Comment