Skip to content

Instantly share code, notes, and snippets.

@prakashrd
Created June 29, 2017 03:09
Show Gist options
  • Save prakashrd/3c1153eee8597d96340735081f4c75e2 to your computer and use it in GitHub Desktop.
Save prakashrd/3c1153eee8597d96340735081f4c75e2 to your computer and use it in GitHub Desktop.
PySpark displaying limited columns from a dataframe
# having started spark journey everything is a discovery for me so jolting few notes
df = sqlContext.createDataFrame([{'name': 'Alice', 'age': 1, 'gender' : 'F'}])
# display all the columns
df.show()
# limit to few
df.select('name', 'age').show()
# another way
df['name', 'age'].show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment