Data Tables
If a Python cell outputs a Pandas DataFrame, then Constellate will show the table using a fairly sophisticated component. Some features to note:
- Numbers, booleans, datetimes, currencies, and JSON are automatically recognized: note how the numeric columns, including the dollar values, are right-aligned while everything else is left-aligned. This also allows for intelligent sorting behavior.
- Pagination is automatic, allowing for a relatively efficient render even for large datasets.
- Note that, while Constellate's DataFrame rendering scales relatively well, it still keeps the entire dataset in memory and sends it to the client when they load the page. Anything not on the first page doesn't have to be rendered, but it does have to be sent to the browser, which will cripple load times for very large datasets. Instead, use a
Tabulator
widget as a Panel plot, which can send a server request to get more data.
- Note that, while Constellate's DataFrame rendering scales relatively well, it still keeps the entire dataset in memory and sends it to the client when they load the page. Anything not on the first page doesn't have to be rendered, but it does have to be sent to the browser, which will cripple load times for very large datasets. Instead, use a
Like Plotly, Constellate has to guess what the DataFrame value is: there's no "current DataFrame" feature in Pandas. The heuristic Constellate applies is simple: the last non-empty line is assumed to be the one that produces the DataFrame. This is usually correct, but is not bulletproof, and so be aware that you will most likely run into issues if you do things like display a DataFrame manually instead of simply having it be the last expression. To make sure Constellate knows exactly what to do, give it a directive: #constellate: dataframe [expr]
where expr
is a Python expression to be run after the cell that produces a DataFrame. The code for this Star would produce the same results if I had started with #constellate: dataframe
or #constellate: dataframe exch
.
currency_code | value | date | country | currency_name | is_dollar | inverse |
---|---|---|---|---|---|---|
currency_code AUD | value $1.500101 | date 2022-05-14T00:00:00.000Z | country Australia | currency_name Dollar | is_dollar true | inverse 0.6666 |
currency_code GBP | value $0.848814 | date 2022-05-14T00:00:00.000Z | country Great Britain | currency_name Pound | is_dollar false | inverse 1.1781 |
currency_code EUR | value $1.0 | date 2022-05-14T00:00:00.000Z | country Euro | currency_name Euro | is_dollar false | inverse 1 |
currency_code JPY | value $134.573925 | date 2022-05-14T00:00:00.000Z | country Japan | currency_name Yen | is_dollar false | inverse 0.0074 |
currency_code CHF | value $1.042767 | date 2022-05-14T00:00:00.000Z | country Switzerland | currency_name Franc | is_dollar false | inverse 0.959 |
currency_code USD | value $1.04107 | date 2022-05-14T00:00:00.000Z | country USA | currency_name Dollar | is_dollar true | inverse 0.9606 |
currency_code AFN | value $91.614523 | date 2022-05-14T00:00:00.000Z | country Afghanistan | currency_name Afghani | is_dollar false | inverse 0.0109 |
currency_code ALL | value $120.608353 | date 2022-05-14T00:00:00.000Z | country Albania | currency_name Lek | is_dollar false | inverse 0.0083 |
currency_code DZD | value $152.410574 | date 2022-05-14T00:00:00.000Z | country Algeria | currency_name Dinar | is_dollar false | inverse 0.0066 |
currency_code AOA | value $426.006586 | date 2022-05-14T00:00:00.000Z | country Angola | currency_name Kwanza | is_dollar false | inverse 0.0023 |
Data Tables
If a Python cell outputs a Pandas DataFrame, then Constellate will show the table using a fairly sophisticated component. Some features to note:
- Numbers, booleans, datetimes, currencies, and JSON are automatically recognized: note how the numeric columns, including the dollar values, are right-aligned while everything else is left-aligned. This also allows for intelligent sorting behavior.
- Pagination is automatic, allowing for a relatively efficient render even for large datasets.
- Note that, while Constellate's DataFrame rendering scales relatively well, it still keeps the entire dataset in memory and sends it to the client when they load the page. Anything not on the first page doesn't have to be rendered, but it does have to be sent to the browser, which will cripple load times for very large datasets. Instead, use a
Tabulator
widget as a Panel plot, which can send a server request to get more data.
- Note that, while Constellate's DataFrame rendering scales relatively well, it still keeps the entire dataset in memory and sends it to the client when they load the page. Anything not on the first page doesn't have to be rendered, but it does have to be sent to the browser, which will cripple load times for very large datasets. Instead, use a
Like Plotly, Constellate has to guess what the DataFrame value is: there's no "current DataFrame" feature in Pandas. The heuristic Constellate applies is simple: the last non-empty line is assumed to be the one that produces the DataFrame. This is usually correct, but is not bulletproof, and so be aware that you will most likely run into issues if you do things like display a DataFrame manually instead of simply having it be the last expression. To make sure Constellate knows exactly what to do, give it a directive: #constellate: dataframe [expr]
where expr
is a Python expression to be run after the cell that produces a DataFrame. The code for this Star would produce the same results if I had started with #constellate: dataframe
or #constellate: dataframe exch
.
currency_code | value | date | country | currency_name | is_dollar | inverse |
---|---|---|---|---|---|---|
currency_code AUD | value $1.500101 | date 2022-05-14T00:00:00.000Z | country Australia | currency_name Dollar | is_dollar true | inverse 0.6666 |
currency_code GBP | value $0.848814 | date 2022-05-14T00:00:00.000Z | country Great Britain | currency_name Pound | is_dollar false | inverse 1.1781 |
currency_code EUR | value $1.0 | date 2022-05-14T00:00:00.000Z | country Euro | currency_name Euro | is_dollar false | inverse 1 |
currency_code JPY | value $134.573925 | date 2022-05-14T00:00:00.000Z | country Japan | currency_name Yen | is_dollar false | inverse 0.0074 |
currency_code CHF | value $1.042767 | date 2022-05-14T00:00:00.000Z | country Switzerland | currency_name Franc | is_dollar false | inverse 0.959 |
currency_code USD | value $1.04107 | date 2022-05-14T00:00:00.000Z | country USA | currency_name Dollar | is_dollar true | inverse 0.9606 |
currency_code AFN | value $91.614523 | date 2022-05-14T00:00:00.000Z | country Afghanistan | currency_name Afghani | is_dollar false | inverse 0.0109 |
currency_code ALL | value $120.608353 | date 2022-05-14T00:00:00.000Z | country Albania | currency_name Lek | is_dollar false | inverse 0.0083 |
currency_code DZD | value $152.410574 | date 2022-05-14T00:00:00.000Z | country Algeria | currency_name Dinar | is_dollar false | inverse 0.0066 |
currency_code AOA | value $426.006586 | date 2022-05-14T00:00:00.000Z | country Angola | currency_name Kwanza | is_dollar false | inverse 0.0023 |