Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created January 13, 2020 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshay-arora/03025076fc25de99490c28f553516739 to your computer and use it in GitHub Desktop.
Save lakshay-arora/03025076fc25de99490c28f553516739 to your computer and use it in GitHub Desktop.
# register temporary table
data_frame.registerTempTable('sample')
# get the value count using the sql query
gender = sql_context.sql(" SELECT gender, count(*) as freq from sample GROUP BY gender ")
# view the results
gender.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment