Display df.describe() Output In A Dataframe
The .describe() function in Python is really handy for exploratory analysis! Sometimes, you would want to display this as a table on a dashboard, but how? The output is typically printed out as text, not as a dataframe.
Fear not, getting this into a dataframe is fairly painless!
Before we go on, note that using Python requires the Python/R Integration.
Let's say this is the first 10 rows of your SQL output / starting dataframe (the data below is the User IDs and number of gameplays they made for a fictional gaming company)

print(df['gameplay_number'].describe()) gives you the following output

To get this in a table of its own (rather than a printout), use the code below! Note, the key in the dictionary used as an argument for pd.DataFrame is what we want to name the column of summary values in our final output. I chose to name this 'gameplays.'
df2 = pd.DataFrame({'gameplays': df['gameplay_number'].describe()})
df2 = df2.reset_index()
# Use Sisense for Cloud Data Teams to visualize a dataframe by passing the data to periscope.output()
periscope.output(df2)
And there you have it!


Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022