Actions

Data

From Future Skill

Revision as of 12:54, 19 March 2024 by Henrik Rostedt (talk | contribs) (Created page with "This article goes through how to use the Data library to manage data and create tables in the canvas. == Overview == The library can currently only be used to make tables, b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This article goes through how to use the Data library to manage data and create tables in the canvas.

Overview

The library can currently only be used to make tables, but other types of data views might be available in the future.

TODO

Tables

TODO

DataTable

The DataTable class is used to create tables by manually entering data.

This is done through indexing:

table = DataTable(header_row_count=1)
table[1, 1] = 5  # Set value for a single table cell
table[0, :] = ["Name", "Count"]  # Set values for multiple cells (first row)
table[1:, :] = [["Jane", 9], ["Joe", 7]]  # Set values for multiple rows and columns
# table will now contain:
# |------|-------|
# | Name | Count |
# |------|-------|
# | Jane |   9   |
# |------|-------|
# | Joe  |   7   |
# |------|-------|

The same indexing syntax can be used to extract data from the table.

You will have to manually specify the number of header/footer rows and columns using header_row_count, header_column_count, footer_row_count, and footer_column_count.