Created
June 29, 2017 03:09
-
-
Save prakashrd/3c1153eee8597d96340735081f4c75e2 to your computer and use it in GitHub Desktop.
PySpark displaying limited columns from a dataframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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