import pointblank as pb
= pb.load_dataset("game_revenue")
game_revenue_polars
pb.get_row_count(game_revenue_polars)
2000
Get the number of rows in a table.
The get_row_count()
function returns the number of rows in a table. The function works with any table that is supported by the pointblank
library, including Pandas, Polars, and Ibis backend tables (e.g., DuckDB, MySQL, PostgreSQL, SQLite, Parquet, etc.).
data : FrameT | Any
The table for which to get the row count, which could be a DataFrame object or an Ibis table object. Read the Supported Input Table Types section for details on the supported table types.
: int
The number of rows in the table.
The data=
parameter can be given any of the following table types:
"polars"
)"pandas"
)"duckdb"
)*"mysql"
)*"postgresql"
)*"sqlite"
)*"parquet"
)*The table types marked with an asterisk need to be prepared as Ibis tables (with type of ibis.expr.types.relations.Table
). Furthermore, using get_row_count()
with these types of tables requires the Ibis library (v9.5.0
or above) to be installed. If the input table is a Polars or Pandas DataFrame, the availability of Ibis is not needed.
Getting the number of rows in a table is easily done by using the get_row_count()
function. Here’s an example using the game_revenue
dataset (itself loaded using the load_dataset()
function):
import pointblank as pb
game_revenue_polars = pb.load_dataset("game_revenue")
pb.get_row_count(game_revenue_polars)
2000
This table is a Polars DataFrame, but the get_row_count()
function works with any table supported by pointblank
, including Pandas DataFrames and Ibis backend tables. Here’s an example using a DuckDB table handled by Ibis:
game_revenue_duckdb = pb.load_dataset("game_revenue", tbl_type="duckdb")
pb.get_row_count(game_revenue_duckdb)
2000
The function always returns the number of rows in the table as an integer value, which is 2000
for the game_revenue
dataset.