Skip to content

Exploring data

Douglas Blank edited this page Mar 14, 2023 · 3 revisions

Before heading into DataGrid's UI, it might be useful to explore DataGrid's methods interactively for exploring data.

Data quick peek

See the first and last few rows of a DataGrid:

dg

See the first few rows of a DataGrid:

dg.head()

See the last few rows of a DataGrid:

dg.tail()

Schema

dg.info()

Data iteration

You can iterate over all of the data as lists:

for row in dg:
    print(row)

You can also iterate over all of the data as dicts:

for row in dg.to_dicts():
    print(row)

for row in dg.to_dicts(columns="Column 1"):
    print(row)

for row in dg.to_dicts(columns=["Column 1", "Column 2"]):
    print(row)

Query the DataGrid

Of course, one can iterate over the DataGrid row by row. But you can also query the underlying database using the same syntax used in the UI filters.

data = dg.select("{'score'} < -0.5")

Or directly into a Pandas DataFrame:

df = dg.select_dataframe("{'score'} < -0.5")

For more information on filter syntax, see: https://github.com/comet-ml/kangas/wiki/Filter-Expressions

For more information:

Table of Contents

Clone this wiki locally