Select row
Select a row by its position
table: Table = Table(
data=[[1, 2, 3], [3, 4, 6], [3, 7, 6]],
row_names=["NY", "Tokyo", "Paris"],
column_names=["London", "Lisboa", "Beijin"])
# selection the first and second rows
table.select_by_row_positions([0,1])
Select table rows and columns
Select a column by its position
table: Table = Table(
data=[[1, 2, 3], [3, 4, 6], [3, 7, 6]],
row_names=["NY", "Tokyo", "Paris"],
column_names=["London", "Lisboa", "Beijin"])
# selection the first and second columns
table.select_by_column_positions([0,1])
Select a column by its name
table: Table = Table(
data=[[1, 2, 3], [3, 4, 6], [3, 7, 6]],
row_names=["NY", "Tokyo", "Paris"],
column_names=["London", "Lisboa", "Beijin"])
# selection the column "London"
table.select_by_column_names([{"name": "London", "is_regex": False}])
Select columns of which the names start with a given string
table: Table = Table(
data=[[1, 2, 3], [3, 4, 6], [3, 7, 6]],
row_names=["NY", "Tokyo", "Paris"],
column_names=["London", "Lisboa", "Beijin"])
# selection all the columns starting by "L" using a regular expression
table.select_by_column_names([{"name": "L.*", "is_regex": True}])
Drop columns
Drop a column by its name
table: Table = Table(
data=[[1, 2, 3], [3, 4, 6], [3, 7, 6]],
row_names=["NY", "Tokyo", "Paris"],
column_names=["London", "Lisboa", "Beijin"])
# drop the column "London"
table.select_by_column_names([{"name": "^(?!London).*", "is_regex": False}])