Skip to content

Instantly share code, notes, and snippets.

@edwintyh
Created February 2, 2022 04:07
Show Gist options
  • Save edwintyh/24be1cdad7ffddb20436b8b0f5b1e2d0 to your computer and use it in GitHub Desktop.
Save edwintyh/24be1cdad7ffddb20436b8b0f5b1e2d0 to your computer and use it in GitHub Desktop.
def shape(self):
'''
Find the number of rows and columns in a DataFrame
'''
return self.count(), len(self.schema.names)
pyspark.sql.DataFrame.shape = shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment