beta_plot_table
beta_plot_table(
df,
columnsDefs,
pageSize=10
)
Parameters:
df (pandas.DataFrame) The data that's plotted on the table chart.
columnsDef (json) An array that defines the mapping between the underlying data and the table columns. Here is an example:
[ {"field":"effectiveAt", "headerName":"Time"}, {"field":"price", "headerName":"ETH Price"}, {"field":"rate", "headerName":"Funding Rate(%)"} ]
pageSize (number) Number of items per page. Default is 20 items per page
Example:
The "Data" tab shows what the chart data looks like. It will be stored in a variable called "result". The "Code" tab shows the code to render the data in a table chart.
market rate price effectiveAt
ETH-USD 0.017317 3153.070000 2021-09-24T00:00:00.000Z
ETH-USD 0.011305 3149.238083 2021-09-23T23:00:00.000Z
ETH-USD 0.013579 3140.940000 2021-09-23T22:00:00.000Z
ETH-USD 0.024556 3142.499055 2021-09-23T21:00:00.000Z
ETH-USD 0.009134 3147.510000 2021-09-23T20:00:00.000Z
... ... ... ...
ETH-USD 0.038591 3282.006159 2021-09-20T01:00:00.000Z
ETH-USD 0.029667 3327.353273 2021-09-20T00:00:00.000Z
ETH-USD 0.028357 3298.808664 2021-09-19T23:00:00.000Z
ETH-USD 0.043455 3343.372434 2021-09-19T22:00:00.000Z
ETH-USD 0.049426 3357.050000 2021-09-19T21:00:00.000Z
Output:

In many cases, you actually might want to format the data in the columns before displaying them. The sample code below will round up the ETH Price to an integer and only keeps 3 digits of the Funding Rate.
bubbletea.beta_plot_table(
df=result,
columnDefs=[
{
"field":"effectiveAt",
"headerName":"Time"
},
{
"field":"price",
"headerName":"ETH Price",
"valueFormatter": 'value.toFixed(0)'
},
{
"field":"rate",
"headerName":"Funding Rate(%)",
"valueFormatter": 'value.toFixed(3)'
}
],
pageSize=50
)
Here is the result. For more details on how to use valueFormatter, please refer to the documentation of ag-grid

Last updated
Was this helpful?