Reputation: 71171
Have a need to display certain wide tables - single result vertically to be able to examine the record.
If I have code like the following:
def get_fiscal_df():
q = "select * from fiscal_records where id = 'R20210106'"
df = spark.sql(q)
df = get_fiscal_df()
df.show() # this would be replaced by new code/method
Is there something I could do (idiomatic) to show that would display that data like so:
Field Name | Value |
---|---|
id | R20210106 |
field2 | value2 |
field3 | value3 |
field4 | value4 |
field5 | value5 |
The only difference being I have inherited some tables that are 250 to 300 fields wide.
Upvotes: 2
Views: 1470
Reputation: 42422
You can use df.show(vertical=True)
to display the dataframe in vertical format, with each row/record having its own table.
Upvotes: 1