Skip to main content
New in version 0.8.0 Column mapping:
  1. If input_columns is given, those columns become inputs and any column not mapped elsewhere goes to extras.
  2. If input_columns is None, every column not mapped elsewhere becomes an input.
  3. The id and source columns, when present, become the item’s id, source_name and source_id. Rows without an id get a new one; an id already in the dataset makes Dataset.update_items() replace that item.

Parameters

pd.DataFrame
required
The rows to convert. Must not be empty.
list[str] | None
default:"None"
Columns to use as inputs.
list[str] | None
default:"None"
Columns holding the expected outputs.
list[str] | None
default:"None"
Columns to store as metadata.
list[str] | None
default:"None"
Columns to store as extras.
str
default:"\"id\""
Column holding each item’s id. Defaults to “id”.
str
default:"\"source_name\""
Column holding the source name. Defaults to “source_name”.
str
default:"\"source_id\""
Column holding the source id. Defaults to “source_id”.

Returns

One item per row, in row order.

Raises

  • ValueError – If the DataFrame is empty or a named column is missing.
  • ImportError – If pandas is not installed.

Example