Pandas makes transposing tables beautifully simple! Read on for a couple examples using the example SQL output below:

Source Count table

This first Python snippet allows you to define your own column headers:

# SQL output is imported as a pandas dataframe variable called "df"
import pandas as pd

df2=df.T
df2.columns=['label 1', 'label 2','label 3','label 4']

# Use Sisense to visualize a dataframe or an image by passing data to sisense.output()
sisense.output(df2)
Label 1 table

And this Python snippet makes the first row your column headers

# SQL output is imported as a pandas dataframe variable called "df"
import pandas as pd
df2=df.T
header=df2.iloc[0]
df2=df2[1:]
df2.columns=header
# Use Sisense to visualize a dataframe or an image by passing data to sisense.output()
sisense.output(df2)
organic table