Add primary_table property to Inspector to allow access without indexing
Opened this issue · 0 comments
NickPapONS commented
The primary table of a data set is an object of type TableInspector
that can be accessed using the Inspector
class, and it is important for functionality like getting the csv url (to get a Pandas dataframe) or accessing the different columns of the data set. However at the moment, the way the primary table is accessed is by indexing the first element of the tables
list object that can be accessed from the Inspector
.
This is a simple task to make this process more user friendly as it is something that could be done quite often by users of the Inspect API.
- Add a new
primary_table
property to theInspector
class that stores the primary (0th index) table from the existingtables
list of TableComponent objects. - There are several unit tests in the file
test_browsers.py
that currently access the primary table using list indexing. Change them to instead use the new property you created and ensure the tests still pass as expected. (This file may be called "test_inspectors" if ticket #852 has been completed. If this ticket is done first, please rename it to that, as "test_browsers" is outdated.) - Update the worked example 3 documentation page (external-docs > docs > guides > inspect-api > example3.md) that shows the retrieval of the primary table from a data set, so it accesses the new property instead of list indexing the
tables
list. This is done in line 27 and 159.