Columns

Columns.rename(source_col: str, dest_col: str)

Renames a column in the main dataframe

Parameters:
  • source_col (str) – name of the column to rename
  • dest_col (str) – new name of the column
Example:

ds.rename("Col 1", "New col")

Columns.add(col: str, value)

Add a column with default values

Parameters:
  • col (str) – column name
  • value (any) – column value
Example:

ds.add("Col 4", 0)

Columns.keep(*cols)

Limit the dataframe to some columns

Parameters:cols (str) – names of the columns
Example:ds.keep("Col 1", "Col 2")
Columns.keep_(*cols) → Ds

Returns a dataswim instance with a dataframe limited to some columns

Parameters:cols (str) – names of the columns
Returns:a dataswim instance
Return type:Ds
Example:ds2 = ds.keep_("Col 1", "Col 2")
Columns.drop(*cols)

Drops columns from the main dataframe

Parameters:cols (str) – names of the columns
Example:ds.drop("Col 1", "Col 2")
Columns.exclude(col: str, val)

Delete rows based on value

Parameters:
  • col (str) – column name
  • val (any) – value to delete
Example:

ds.exclude("Col 1", "value")

Columns.copycol(origin_col: str, dest_col: str)

Copy a columns values in another column

Parameters:
  • origin_col (str) – name of the column to copy
  • dest_col (str) – name of the new column
Example:

ds.copy("col 1", "New col")

Columns.indexcol(col: str)

Add a column from the index

Parameters:col (str) – name of the new column
Example:ds.index_col("New col")