Frame

Overview: Frame

class Frame(data: Union[Iterable[Iterable[Any]], numpy.ndarray] = <object object>, *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, name: Optional[Hashable] = <object object>, index_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, own_data: bool = False, own_index: bool = False, own_columns: bool = False)[source]

A two-dimensional ordered, labelled collection, immutable and of fixed size.

Frame: Constructor

Overview: Frame: Constructor

Frame.__init__(data: Union[Iterable[Iterable[Any]], numpy.ndarray] = <object object>, *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, name: Optional[Hashable] = <object object>, index_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, own_data: bool = False, own_index: bool = False, own_columns: bool = False)None[source]

Initializer.

Parameters
  • data – Default Frame initialization requires typed data such as a NumPy array. All other initialization should use specialized constructors.

  • index – Optional index initializer. If provided in addition to data values, lengths must be compatible.

  • columns – Optional column initializer. If provided in addition to data values, lengths must be compatible.

  • own_data – Flag the data values as ownable by this static_frame.Frame. Primarily used by internal clients.

  • own_index – Flag the passed index as ownable by this static_frame.Frame. Primarily used by internal clients.

  • own_columns – Flag the passed columns as ownable by this static_frame.Frame. Primarily used by internal clients.

>>> sf.Frame(np.array([[76.1, 0.967], [3.3, 0.847]]), columns=('Period', 'Eccentricity'), index=('Halley', 'Encke'), name='Orbits')
<Frame: Orbits>
<Index>         Period    Eccentricity <<U12>
<Index>
Halley          76.1      0.967
Encke           3.3       0.847
<<U6>           <float64> <float64>

classmethod Frame.from_arrow(value: pyarrow.Table, *, index_depth: int = 0, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Hashable = None, consolidate_blocks: bool = False)Frame[source]

Realize a Frame from an Arrow Table.

Parameters
  • value – A pyarrow.Table instance.

  • index_depth – integer specification of how many columns to use in forming the index. A value of 0 will select none; a value greater than 1 will create an IndexHierarchy.

  • columns_depth – integer specification of how many rows to use in forming the columns. A value of 0 will select none; a value greater than 1 will create an IndexHierarchy.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

classmethod Frame.from_clipboard(*, delimiter: str = '\t', index_depth: int = 0, index_column_first: Optional[Union[int, str]] = None, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Create a Frame from the contents of the clipboard (assuming a table is stored as delimited file).

Returns

static_frame.Frame

classmethod Frame.from_concat(frames: Iterable[Union[static_frame.core.frame.Frame, static_frame.core.series.Series]], *, axis: int = 0, union: bool = True, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, name: Optional[Hashable] = None, fill_value: object = nan, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Concatenate multiple Frames into a new Frame. If index or columns are provided and appropriately sized, the resulting Frame will use those indices. If the axis along concatenation (index for axis 0, columns for axis 1) is unique after concatenation, it will be preserved; otherwise, a new index or an IndexAutoFactory must be supplied.

Parameters
  • frames – Iterable of Frames.

  • axis – Integer specifying 0 to concatenate supplied Frames vertically (aligning on columns), 1 to concatenate horizontally (aligning on rows).

  • union – If True, the union of the aligned indices is used; if False, the intersection is used.

  • index – Optionally specify a new index.

  • columns – Optionally specify new columns.

  • name – A hashable object to label the container.f

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

>>> f1 = sf.Frame.from_dict(dict(diameter=(12756, 142984), mass=(5.97, 1898)), index=('Earth', 'Jupiter'))
>>> f2 = sf.Frame.from_dict(dict(mass=(0.642, 102), moons=(2, 14)), index=('Mars', 'Neptune'))
>>> sf.Frame.from_concat((f1, f2))
<Frame>
<Index> diameter  mass      moons     <<U8>
<Index>
Earth   12756.0   5.97      nan
Jupiter 142984.0  1898.0    nan
Mars    nan       0.642     2.0
Neptune nan       102.0     14.0
<<U7>   <float64> <float64> <float64>

>>> sf.Frame.from_concat((f1, f2), union=False)
<Frame>
<Index> mass      <<U8>
<Index>
Earth   5.97
Jupiter 1898.0
Mars    0.642
Neptune 102.0
<<U7>   <float64>

classmethod Frame.from_concat_items(items: Iterable[Tuple[Hashable, Union[static_frame.core.frame.Frame, static_frame.core.series.Series]]], *, axis: int = 0, union: bool = True, name: Optional[Hashable] = None, fill_value: object = nan, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Produce a Frame with a hierarchical index from an iterable of pairs of labels, Frame. The IndexHierarchy is formed from the provided labels and the Index if each Frame.

Parameters

items – Iterable of pairs of label, Frame

classmethod Frame.from_csv(fp: Union[str, os.PathLike, TextIO, Iterator[str]], *, index_depth: int = 0, index_column_first: Optional[Union[int, str]] = None, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Specialized version of Frame.from_delimited for CSV files.

Returns

Frame

>>> from io import StringIO
>>> filelike = StringIO('name,mass,temperature\\nVenus,4.87,464\\nNeptune,102,-200')
>>> sf.Frame.from_csv(filelike, index_depth=1, dtypes=dict(temperature=np.int64))
<Frame>
<Index> mass      temperature <<U11>
<Index>
Venus   4.87      464
Neptune 102.0     -200
<<U7>   <float64> <int64>

classmethod Frame.from_delimited(fp: Union[str, os.PathLike, TextIO, Iterator[str]], *, delimiter: str, index_depth: int = 0, index_column_first: Optional[Union[int, str]] = None, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Create a Frame from a file path or a file-like object defining a delimited (CSV, TSV) data file.

Parameters
  • fp – A file path or a file-like object.

  • delimiter – The character used to seperate row elements.

  • index_depth – Specify the number of columns used to create the index labels; a value greater than 1 will attempt to create a hierarchical index.

  • index_column_first – Optionally specify a column, by position or name, to become the start of the index if index_depth is greater than 0. If not set and index_depth is greater than 0, the first column will be used.

  • index_name_depth_level – If columns_depth is greater than 0, interpret values over index as the index name.

  • columns_depth – Specify the number of rows after the skip_header used to create the column labels. A value of 0 will be no header; a value greater than 1 will attempt to create a hierarchical index.

  • columns_name_depth_level – If index_depth is greater than 0, interpret values over index as the columns name.

  • skip_header – Number of leading lines to skip.

  • skip_footer – Number of trailing lines to skip.

  • store_filter – A StoreFilter instance, defining translation between unrepresentable types. Presently nly the to_nan attributes is used.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_dict(mapping: Dict[Hashable, Iterable[Any]], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, fill_value: object = nan, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Create a Frame from a dictionary (or any object that has an items() method) where keys are column labels and values are columns values (either sequence types or Series).

Parameters
  • mapping – a dictionary or similar mapping interface.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

>>> sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

classmethod Frame.from_dict_records(records: Iterable[Dict[Hashable, Any]], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, fill_value: object = nan, consolidate_blocks: bool = False, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from an iterable of dictionaries, where each dictionary represents a row; column names will be derived from the union of all row dictionary keys.

Parameters
  • records – Iterable of row values, where row values are dictionaries.

  • index – Optionally provide an iterable of index labels, equal in length to the number of records. If a generator, this value will not be evaluated until after records are loaded.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_dict_records_items(items: Iterator[Tuple[Hashable, Iterable[Any]]], *, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from iterable of pairs of index label, row, where row is a dictionary. Column names will be derived from the union of all row dictionary keys.

Parameters
  • items – Iterable of pairs of index label, row values, where row values are arrays, tuples, lists, dictionaries, or namedtuples.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_element(element: Any, *, index: Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]], columns: Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]], dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False, own_columns: bool = False)static_frame.core.frame.Frame[source]

Create a Frame from an element, i.e., a single value stored in a single cell. Both index and columns are required, and cannot be specified with IndexAutoFactory.

classmethod Frame.from_element_items(items: Iterable[Tuple[Tuple[Hashable, Hashable], Any]], *, index: Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]], columns: Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]], dtype: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, axis: Optional[int] = None, name: Optional[Hashable] = None, fill_value: object = <object object>, index_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False, own_columns: bool = False)static_frame.core.frame.Frame[source]

Create a Frame from an iterable of key, value, where key is a pair of row, column labels.

This function is partialed (setting the index and columns) and used by IterNodeDelegate as the apply constructor for doing application on element iteration.

Parameters
  • items – an iterable of pairs of 2-tuples of row, column loc labels and values.

  • axis – when None, items can be in an order; when 0, items must be well-formed and ordered row major; when 1, items must be well-formed and ordered columns major.

Returns

static_frame.Frame

classmethod Frame.from_elements(elements: Iterable[Any], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Type[static_frame.core.index_auto.IndexAutoFactory]]] = None, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False, own_columns: bool = False)static_frame.core.frame.Frame[source]

Create a Frame from an iterable of elements, to be formed into a Frame with a single column.

classmethod Frame.from_fields(fields: Iterable[Iterable[Any]], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, fill_value: object = nan, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False, own_columns: bool = False, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from an iterator of columns, where columns are iterables. Series can be provided as values if an index argument is supplied.

Parameters
  • fields – Iterable of column values.

  • index – Iterable of values to create an Index.

  • fill_value – If pairs include Series, they will be reindexed with the provided index; reindexing will use this fill value.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_hdf5(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, index_depth: int = 0, columns_depth: int = 1, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Load Frame from the contents of a table in an HDF5 file.

classmethod Frame.from_items(pairs: Iterable[Tuple[Hashable, Iterable[Any]]], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, fill_value: object = nan, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from an iterator of pairs, where the first value is the column label and the second value is an iterable of column values. Series can be provided as values if an index argument is supplied.

Parameters
  • pairs – Iterable of pairs of column name, column values.

  • index – Iterable of values to create an Index.

  • fill_value – If pairs include Series, they will be reindexed with the provided index; reindexing will use this fill value.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

>>> sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

classmethod Frame.from_json(json_data: str, *, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from an in-memory JSON document.

Parameters
  • json_data – a string of JSON, encoding a table as an array of JSON objects.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_json_url(url: str, *, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from a JSON documenst provided via a URL.

Parameters
  • url – URL to the JSON resource.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

static Frame.from_msgpack(msgpack_data: bin)static_frame.core.frame.Frame[source]

Frame constructor from an in-memory binary object formatted as a msgpack.

Parameters

msgpack_data – A binary msgpack object, encoding a Frame as produced from to_msgpack()

classmethod Frame.from_overlay(containers: Iterable[static_frame.core.frame.Frame], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, union: bool = True, name: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Return a new Frame made by overlaying containers, filling in missing values (None or NaN) with aligned values from subsequent containers.

Parameters
  • containers – Iterable of Frame.

  • index – An optional Index, IndexHierarchy, or index initializer, to be used as the index upon which all containers are aligned. IndexAutoFactory is not supported.

  • columns – An optional Index, IndexHierarchy, or columns initializer, to be used as the columns upon which all containers are aligned. IndexAutoFactory is not supported.

  • union – If True, and no index or columns argument is supplied, a union index or columns from containers will be used; if False, the intersection index or columns will be used.

classmethod Frame.from_pandas(value: pandas.DataFrame, *, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, name: Optional[Hashable] = <object object>, consolidate_blocks: bool = False, own_data: bool = False)Frame[source]

Given a Pandas DataFrame, return a Frame.

Parameters
  • value – Pandas DataFrame.

  • index_constructor – Optional class or constructor function to create the Index applied to the rows.

  • columns_constructor – Optional class or constructor function to create the Index applied to the columns.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

  • own_data – If True, the underlying NumPy data array will be made immutable and used without a copy.

Returns

Frame

classmethod Frame.from_parquet(fp: Union[str, os.PathLike], *, index_depth: int = 0, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_select: Optional[Iterable[str]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Realize a Frame from a Parquet file.

Parameters
  • fp – A string file path or Path instance.

  • index_depth – integer specification of how many columns to use in forming the index. A value of 0 will select none; a value greater than 1 will create an IndexHierarchy.

  • columns_depth – integer specification of how many rows to use in forming the columns. A value of 0 will select none; a value greater than 1 will create an IndexHierarchy.

  • columns_select – An optional iterable of column names to load.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

classmethod Frame.from_records(records: Iterable[Any], *, index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_index: bool = False, own_columns: bool = False)static_frame.core.frame.Frame[source]

Construct a Frame from an iterable of rows, where rows are defined as iterables, including tuples, lists, and arrays. If each row is a NamedTuple, and columns is not provided, column names will be derived from the NamedTuple fields.

Supplying dtypes will significantly improve performance, as otherwise columnar array types must be derived by element-wise examination.

For records defined as Series, use Frame.from_concat; for records defined as dictionary, use Frame.from_dict_records; for creating a Frame from a single dictionary, where keys are column labels and values are columns, use Frame.from_dict.

Parameters
  • records – Iterable of row values, where row values are arrays, tuples, lists, or namedtuples. For dictionary records, use Frame.from_dict_records.

  • index – Optionally provide an iterable of index labels, equal in length to the number of records. If a generator, this value will not be evaluated until after records are loaded.

  • columns – Optionally provide an iterable of column labels, equal in length to the number of elements in a row.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

Frame

>>> index = ('Mercury', 'Venus', 'Earth', 'Mars')
>>> columns = ('diameter', 'gravity', 'temperature')
>>> records = ((4879, 3.7, 167), (12104, 8.9, 464), (12756, 9.8, 15), (6792, 3.7, -65))
>>> sf.Frame.from_records(records, index=index, columns=columns, dtypes=dict(diameter=np.int64, temperature=np.int64))
<Frame>
<Index> diameter gravity   temperature <<U11>
<Index>
Mercury 4879     3.7       167
Venus   12104    8.9       464
Earth   12756    9.8       15
Mars    6792     3.7       -65
<<U7>   <int64>  <float64> <int64>

classmethod Frame.from_records_items(items: Iterator[Tuple[Hashable, Iterable[Any]]], *, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, index_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None, own_columns: bool = False)static_frame.core.frame.Frame[source]

Frame constructor from iterable of pairs of index value, row (where row is an iterable).

Parameters
  • items – Iterable of pairs of index label, row values, where row values are arrays, tuples, lists, dictionaries, or namedtuples.

  • columns – Optionally provide an iterable of column labels, equal in length to the length of each row.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

classmethod Frame.from_series(series: static_frame.core.series.Series, *, name: Optional[Hashable] = None, columns_constructor: Optional[Callable[[], static_frame.core.index_base.IndexBase]] = None)static_frame.core.frame.Frame[source]

Frame constructor from a Series:

Parameters

series – A Series instance, to be realized as single column, with the column label taken from the name attribute.

classmethod Frame.from_sql(query: str, *, connection: sqlite3.Connection, index_depth: int = 0, columns_depth: int = 1, columns_select: Optional[Iterable[str]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, parameters: Iterable[Any] = ())static_frame.core.frame.Frame[source]

Frame constructor from an SQL query and a database connection object.

Parameters
  • query – A query string.

  • connection – A DBAPI2 (PEP 249) Connection object, such as those returned from SQLite (via the sqlite3 module) or PyODBC.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • columns_select – An optional iterable of field names to extract from the results of the query.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

  • parameters – Provide a list of values for an SQL query expecting parameter substitution.

classmethod Frame.from_sqlite(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, index_depth: int = 0, columns_depth: int = 1, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Load Frame from the contents of a table in an SQLite database file.

classmethod Frame.from_structured_array(array: numpy.ndarray, *, index_depth: int = 0, index_column_first: Optional[Union[int, Hashable]] = None, columns_depth: int = 1, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Convert a NumPy structed array into a Frame.

Parameters
  • array – Structured NumPy array.

  • index_depth – Depth if index levels, where (for example) 0 is no index, 1 is a single column index, and 2 is a two-columns IndexHierarchy.

  • index_column_first – Optionally provide the name or position offset of the column to use as the index.

  • dtypes – Optionally provide an iterable of dtypes, equal in length to the length of each row, or a mapping by column name. If a dtype is given as None, NumPy’s default type determination will be used.

  • name – A hashable object to label the container.

  • consolidate_blocks – Optionally consolidate adjacent same-typed columns into contiguous arrays.

Returns

static_frame.Frame

>>> a = np.array([('Venus', 4.87, 464), ('Neptune', 102, -200)], dtype=[('name', object), ('mass', 'f4'), ('temperature', 'i4')])
>>> sf.Frame.from_structured_array(a, index_depth=1)
<Frame>
<Index>  mass              temperature <<U11>
<Index>
Venus    4.869999885559082 464
Neptune  102.0             -200
<object> <float32>         <int32>

classmethod Frame.from_tsv(fp: Union[str, os.PathLike, TextIO, Iterator[str]], *, index_depth: int = 0, index_column_first: Optional[Union[int, str]] = None, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, name: Optional[Hashable] = None, consolidate_blocks: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Specialized version of Frame.from_delimited for TSV files.

Returns

static_frame.Frame

classmethod Frame.from_xlsx(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, index_depth: int = 0, index_name_depth_level: Optional[Union[int, Iterable[int]]] = None, columns_depth: int = 1, columns_name_depth_level: Optional[Union[int, Iterable[int]]] = None, dtypes: Union[str, numpy.dtype, type, None, Iterable[Optional[Union[str, numpy.dtype, type]]], Dict[Hashable, Optional[Union[str, numpy.dtype, type]]]] = None, consolidate_blocks: bool = False, skip_header: int = 0, skip_footer: int = 0, trim_nadir: bool = False, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)static_frame.core.frame.Frame[source]

Load Frame from the contents of a sheet in an XLSX workbook.

Parameters

label – Optionally provide the sheet name from with to read. If not provided, the first sheet will be used.

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Exporter

Overview: Frame: Exporter

Frame.to_arrow(*, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False)pyarrow.Table[source]

Return a pyarrow.Table from this Frame.

Frame.to_clipboard(*, delimiter: str = '\t', include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False, encoding: Optional[str] = None, line_terminator: str = '\n', quote_char: str = '"', quote_double: bool = True, escape_char: Optional[str] = None, quoting: int = 0, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)None[source]

Given a file path or file-like object, write the Frame as delimited text. The delimiter defaults to a tab.

Parameters
  • file path, PathLib instance, or file-like object. (A) –

  • *

  • delimiter – Character to be used for delimiterarating elements.

  • include_index – If True, the index will be written.

  • include_index_name – If including columns, populate the row above the index with the index name. Cannot be True if include_columns_name is True.

  • include_columns – If True, the columns will be written.

  • include_columns_name – If including index, populate the column to the left of the columns with the columns name. Cannot be True if include_index_name is True.

  • encoding – Encoding type to be used when opening the file.

  • line_terminator – The string used to terminate lines.

  • quote_char – A one-character string used to quote fields containing special characters, such as the delimiter or quote_char, or which contain new-line characters.

  • quote_double – Controls how instances of quote_char appearing inside a field should themselves be quoted. When True, the character is doubled. When False, the escape_char is used as a prefix to the quote_char. It defaults to True.

  • escape_char – A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if quote_double is False.

  • quoting – Controls when quotes should be generated. It can take on any of the QUOTE_* constants from the standard library csv module.

  • store_filter – A StoreFilter instance.

Frame.to_csv(fp: Union[str, os.PathLike, TextIO], *, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False, encoding: Optional[str] = None, line_terminator: str = '\n', quote_char: str = '"', quote_double: bool = True, escape_char: Optional[str] = None, quoting: int = 0, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)None[source]

Given a file path or file-like object, write the Frame as delimited text. The delimiter is set to a comma.

Parameters
  • file path, PathLib instance, or file-like object. (A) –

  • *

  • include_index – If True, the index will be written.

  • include_index_name – If including columns, populate the row above the index with the index name. Cannot be True if include_columns_name is True.

  • include_columns – If True, the columns will be written.

  • include_columns_name – If including index, populate the column to the left of the columns with the columns name. Cannot be True if include_index_name is True.

  • encoding – Encoding type to be used when opening the file.

  • line_terminator – The string used to terminate lines.

  • quote_char – A one-character string used to quote fields containing special characters, such as the delimiter or quote_char, or which contain new-line characters.

  • quote_double – Controls how instances of quote_char appearing inside a field should themselves be quoted. When True, the character is doubled. When False, the escape_char is used as a prefix to the quote_char. It defaults to True.

  • escape_char – A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if quote_double is False.

  • quoting – Controls when quotes should be generated. It can take on any of the QUOTE_* constants from the standard library csv module.

  • store_filter – A StoreFilter instance.

Frame.to_delimited(fp: Union[str, os.PathLike, TextIO], *, delimiter: str, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False, encoding: Optional[str] = None, line_terminator: str = '\n', quote_char: str = '"', quote_double: bool = True, escape_char: Optional[str] = None, quoting: int = 0, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)None[source]

Given a file path or file-like object, write the Frame as delimited text. A delimiter character must be specified.

Parameters
  • file path, PathLib instance, or file-like object. (A) –

  • *

  • delimiter – Character to be used for delimiterarating elements.

  • include_index – If True, the index will be written.

  • include_index_name – If including columns, populate the row above the index with the index name. Cannot be True if include_columns_name is True.

  • include_columns – If True, the columns will be written.

  • include_columns_name – If including index, populate the column to the left of the columns with the columns name. Cannot be True if include_index_name is True.

  • encoding – Encoding type to be used when opening the file.

  • line_terminator – The string used to terminate lines.

  • quote_char – A one-character string used to quote fields containing special characters, such as the delimiter or quote_char, or which contain new-line characters.

  • quote_double – Controls how instances of quote_char appearing inside a field should themselves be quoted. When True, the character is doubled. When False, the escape_char is used as a prefix to the quote_char. It defaults to True.

  • escape_char – A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if quote_double is False.

  • quoting – Controls when quotes should be generated. It can take on any of the QUOTE_* constants from the standard library csv module.

  • store_filter – A StoreFilter instance.

Frame.to_frame()static_frame.core.frame.Frame[source]

Return Frame version of this Frame, which (as the Frame is immutable) is self.

Frame.to_frame_go()static_frame.core.frame.FrameGO[source]

Return a FrameGO version of this Frame.

Frame.to_frame_he()static_frame.core.frame.FrameHE[source]

Return a FrameHE version of this Frame.

Frame.to_hdf5(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, include_index: bool = True, include_columns: bool = True)None[source]

Write the Frame as single-table SQLite file.

Frame.to_html(config: Optional[static_frame.core.display_config.DisplayConfig] = None)str[source]

Return an HTML table representation of this Frame using standard TABLE, TR, and TD tags. This is not a complete HTML page.

Parameters

config – Optional DisplayConfig instance.

Returns

str

Frame.to_html_datatables(fp: Optional[Union[str, os.PathLike, TextIO]] = None, show: bool = True, config: Optional[static_frame.core.display_config.DisplayConfig] = None)Optional[str][source]

Return a complete HTML representation of this Frame using the DataTables JS library for table naviagation and search. The page links to CDNs for JS resources, and thus will not fully render without an internet connection.

Parameters
  • fp – optional file path to write; if not provided, a temporary file will be created. Note: the caller is responsible for deleting this file.

  • show – if True, the file will be opened with a webbrowser.

  • config – Optional DisplayConfig instance.

Returns

str, absolute file path to the file written.

Frame.to_latex(config: Optional[static_frame.core.display_config.DisplayConfig] = None)str[source]

Display the Frame as a LaTeX formatted table.

Frame.to_markdown(config: Optional[static_frame.core.display_config.DisplayConfig] = None)str[source]

Display the Frame as a Markdown formatted table.

Frame.to_msgpack()bin[source]

Return a msgpack.

Frame.to_pairs(axis: int = 0)Iterable[Tuple[Hashable, Iterable[Tuple[Hashable, Any]]]][source]

Return a tuple of major axis key, minor axis key vlaue pairs, where major axis is determined by the axis argument.

Frame.to_pandas()pandas.DataFrame[source]

Return a Pandas DataFrame.

Frame.to_parquet(fp: Union[str, os.PathLike, _io.BytesIO], *, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False)None[source]

Write an Arrow Parquet binary file.

Frame.to_rst(config: Optional[static_frame.core.display_config.DisplayConfig] = None)str[source]

Display the Frame as an RST formatted table.

Frame.to_sqlite(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, include_index: bool = True, include_columns: bool = True)None[source]

Write the Frame as single-table SQLite file.

Frame.to_tsv(fp: Union[str, os.PathLike, TextIO], *, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False, encoding: Optional[str] = None, line_terminator: str = '\n', quote_char: str = '"', quote_double: bool = True, escape_char: Optional[str] = None, quoting: int = 0, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)None[source]

Given a file path or file-like object, write the Frame as delimited text. The delimiter is set to a tab.

Parameters
  • file path, PathLib instance, or file-like object. (A) –

  • *

  • include_index – If True, the index will be written.

  • include_index_name – If including columns, populate the row above the index with the index name. Cannot be True if include_columns_name is True.

  • include_columns – If True, the columns will be written.

  • include_columns_name – If including index, populate the column to the left of the columns with the columns name. Cannot be True if include_index_name is True.

  • encoding – Encoding type to be used when opening the file.

  • line_terminator – The string used to terminate lines.

  • quote_char – A one-character string used to quote fields containing special characters, such as the delimiter or quote_char, or which contain new-line characters.

  • quote_double – Controls how instances of quote_char appearing inside a field should themselves be quoted. When True, the character is doubled. When False, the escape_char is used as a prefix to the quote_char. It defaults to True.

  • escape_char – A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if quote_double is False.

  • quoting – Controls when quotes should be generated. It can take on any of the QUOTE_* constants from the standard library csv module.

  • store_filter – A StoreFilter instance.

Frame.to_xarray()Dataset[source]

Return an xarray Dataset.

In order to preserve columnar types, and following the precedent of Pandas, the Frame, with a 1D index, is translated as a Dataset of 1D arrays, where each DataArray is a 1D array. If the index is an IndexHierarhcy, each column is mapped into an ND array of shape equal to the unique values found at each depth of the index.

Frame.to_xlsx(fp: Union[str, os.PathLike], *, label: Hashable = <object object>, include_index: bool = True, include_index_name: bool = True, include_columns: bool = True, include_columns_name: bool = False, merge_hierarchical_labels: bool = True, store_filter: Optional[static_frame.core.store_filter.StoreFilter] = <static_frame.core.store_filter.StoreFilter object>)None[source]

Write the Frame as single-sheet XLSX file.

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Attribute

Overview: Frame: Attribute

Frame.STATIC: bool = True
Frame.T

Transpose. Return a Frame with index as columns and vice versa.

Frame.columns

The IndexBase instance assigned for column labels.

Frame.dtypes

Return a Series of dytpes for each realizable column.

Returns

static_frame.Series

>>> f = sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))

>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.dtypes
<Series>
<Index>
diameter int64
mass     float64
<<U8>    <object>

Frame.index

The IndexBase instance assigned for row labels.

Frame.mloc

The memory locations, represented as an array of integers, of the underlying NumPy arrays.

Frame.name

A hashable label attached to this container.

Returns

Hashable

Frame.nbytes

Return the total bytes of the underlying NumPy array.

Returns

int

>>> f = sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.nbytes
48

Frame.ndim

Return the number of dimensions, which for a Frame is always 2.

Returns

int

>>> f = sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.ndim
2

Frame.shape

Return a tuple describing the shape of the underlying NumPy array.

Returns

tp.Tuple[int]

>>> f = sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))

>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.shape
(3, 2)

Frame.size

Return the size of the underlying NumPy array.

Returns

int

>>> f = sf.Frame.from_items((('diameter', (12756, 142984, 120536)), ('mass', (5.97, 1898, 568))), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.size
6

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Method

Overview: Frame: Method

Frame.__bool__()bool

Raises ValueError to prohibit ambiguous use of truethy evaluation.

Frame.__deepcopy__(memo: Dict[int, Any])static_frame.core.frame.Frame[source]
Frame.__len__()int[source]

Length of rows in values.

Frame.__round__(decimals: int = 0)static_frame.core.frame.Frame[source]

Return a Frame rounded to the given decimals. Negative decimals round to the left of the decimal point.

Parameters

decimals – number of decimals to round to.

Returns

Frame

Frame.all(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Logical and over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.any(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Logical or over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.astype[key](dtypes, *, consolidate_blocks)
Frame.astype

Retype one or more columns. When used as a function, can provide retype the entire Frame; Alternatively, when used as a __getitem__ interface, loc-style column selection can be used to type one or more coloumns.

Parameters

dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

InterfaceAsType.__getitem__(key: Union[int, numpy.integer, slice, List[Any], None, Index, Series, numpy.ndarray])FrameAsType[source]

Selector of columns by label.

Parameters

key – A loc selector, either a label, a list of labels, a slice of labels, or a Boolean array.

Frame.astype(dtype)
astype

Retype one or more columns. When used as a function, can provide retype the entire Frame; Alternatively, when used as a __getitem__ interface, loc-style column selection can be used to type one or more coloumns.

Parameters

dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

InterfaceAsType.__call__(dtype: numpy.dtype)Frame[source]

Apply a single dtype to all columns.

Frame.clip(*, lower: Optional[Union[float, static_frame.core.series.Series, static_frame.core.frame.Frame]] = None, upper: Optional[Union[float, static_frame.core.series.Series, static_frame.core.frame.Frame]] = None, axis: Optional[int] = None)static_frame.core.frame.Frame[source]

Apply a clip operation to this Frame. Note that clip operations can be applied to object types, but cannot be applied to non-numerical objects (e.g., strings, None)

Parameters
Frame.count(*, skipna: bool = True, axis: int = 0)static_frame.core.series.Series[source]

Return the count of non-NA values along the provided axis, where 0 provides counts per column, 1 provides counts per row.

Parameters

axis

Frame.cov(*, axis: int = 1, ddof: int = 1)static_frame.core.frame.Frame[source]

Compute a covariance matrix.

Parameters
  • axis – if 0, each row represents a variable, with observations as columns; if 1, each column represents a variable, with observations as rows. Defaults to 1.

  • ddof – Delta degrees of freedom, defaults to 1.

Frame.cumprod(axis: int = 0, skipna: bool = True)Any

Return the cumulative product over the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.cumsum(axis: int = 0, skipna: bool = True)Any

Return the cumulative sum over the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.drop_duplicated(*, axis: int = 0, exclude_first: bool = False, exclude_last: bool = False)static_frame.core.frame.Frame[source]

Return a Frame with duplicated rows (axis 0) or columns (axis 1) removed. All values in the row or column are compared to determine duplication.

Parameters
  • axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.

  • exclude_first – Boolean to select if the first duplicated value is excluded.

  • exclude_last – Boolean to select if the last duplicated value is excluded.

Frame.dropna(axis: int = 0, condition: Callable[[numpy.ndarray], bool] = <function all>)static_frame.core.frame.Frame[source]

Return a new Frame after removing rows (axis 0) or columns (axis 1) where condition is True, where condition is an NumPy ufunc that process the Boolean array returned by isna().

Frame.duplicated(*, axis: int = 0, exclude_first: bool = False, exclude_last: bool = False)static_frame.core.series.Series[source]

Return an axis-sized Boolean Series that shows True for all rows (axis 0) or columns (axis 1) duplicated.

Parameters
  • axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.

  • exclude_first – Boolean to select if the first duplicated value is excluded.

  • exclude_last – Boolean to select if the last duplicated value is excluded.

Frame.equals(other: Any, *, compare_name: bool = False, compare_dtype: bool = False, compare_class: bool = False, skipna: bool = True)bool[source]

Return a bool from comparison to any other object.

Parameters
  • compare_name – Include equality of the container’s name (and all composed containers) in the comparison.

  • compare_dtype – Include equality of the container’s dtype (and all composed containers) in the comparison.

  • compare_class – Include equality of the container’s class (and all composed containers) in the comparison.

  • skipna – If True, comparisons between missing values are equal.

Frame.fillna(value: Any)static_frame.core.frame.Frame[source]

Return a new Frame after replacing null (NaN or None) with the supplied value.

Parameters

value – Value to be used to replace missing values (NaN or None).

Frame.fillna_backward(limit: int = 0, *, axis: int = 0)static_frame.core.frame.Frame[source]

Return a new Frame after filling backward null (NaN or None) with the first observed value.

Parameters
  • limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.fillna_forward(limit: int = 0, *, axis: int = 0)static_frame.core.frame.Frame[source]

Return a new Frame after filling forward null (NaN or None) with the last observed value.

Parameters
  • limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.fillna_leading(value: Any, *, axis: int = 0)static_frame.core.frame.Frame[source]

Return a new Frame after filling leading (and only leading) null (NaN or None) with the first observed value.

Parameters
  • value – Value to be used to replace missing values (NaN or None).

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.fillna_trailing(value: Any, *, axis: int = 0)static_frame.core.frame.Frame[source]

Return a new Frame after filling trailing (and only trailing) null (NaN or None) with the last observed value.

Parameters
  • value – Value to be used to replace missing values (NaN or None).

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.head(count: int = 5)static_frame.core.frame.Frame[source]

Return a Frame consisting only of the top elements as specified by count.

Parameters

count – Number of elements to be returned from the top of the Frame

Frame.iloc_max(*, skipna: bool = True, axis: int = 0)static_frame.core.series.Series[source]

Return the integer indices corresponding to the maximum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.iloc_min(*, skipna: bool = True, axis: int = 0)static_frame.core.series.Series[source]

Return the integer indices corresponding to the minimum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.insert_after(key: Hashable, container: Union[static_frame.core.frame.Frame, static_frame.core.series.Series], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Create a new Frame by inserting a named Series or Frame at the position after the label specified by key.

Parameters
  • key – Label after which the new container will be inserted.

  • container – Container to be inserted.

  • fill_value – A value to be used to fill space after reindexing the new container.

Returns

Frame

Frame.insert_before(key: Hashable, container: Union[static_frame.core.frame.Frame, static_frame.core.series.Series], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Create a new Frame by inserting a named Series or Frame at the position before the label specified by key.

Parameters
  • key – Label before which the new container will be inserted.

  • container – Container to be inserted.

  • fill_value – A value to be used to fill space after reindexing the new container.

Returns

Frame

Frame.isin(other: Any)static_frame.core.frame.Frame[source]

Return a same-sized Boolean Frame that shows if the same-positioned element is in the passed iterable.

Frame.isna()static_frame.core.frame.Frame[source]

Return a same-indexed, Boolean Frame indicating True which values are NaN or None.

Frame.join_inner(other: static_frame.core.frame.Frame, *, left_depth_level: Optional[Union[int, Iterable[int]]] = None, left_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, right_depth_level: Optional[Union[int, Iterable[int]]] = None, right_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, left_template: str = '{}', right_template: str = '{}', fill_value: Any = nan, composite_index: bool = True, composite_index_fill_value: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Perform an inner join.

Parameters
  • left_depth_level – Specify one or more left index depths to include in the join predicate.

  • left_columns – Specify one or more left columns to include in the join predicate.

  • right_depth_level – Specify one or more right index depths to include in the join predicate.

  • right_columns – Specify one or more right columns to include in the join predicate.

  • left_template – Provide a format string for naming left columns in the joined result.

  • right_template – Provide a format string for naming right columns in the joined result.

  • fill_value – A value to be used to fill space created in the join.

  • composite_index – If True, an index of tuples will be returned, formed from the left index label and the right index label; if False, an index of matching labels, if unique, will be returned.

  • composite_index_fill_value – Value to be used when forming a composite index when a label is missing.

Returns

Frame

Frame.join_left(other: static_frame.core.frame.Frame, *, left_depth_level: Optional[Union[int, Iterable[int]]] = None, left_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, right_depth_level: Optional[Union[int, Iterable[int]]] = None, right_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, left_template: str = '{}', right_template: str = '{}', fill_value: Any = nan, composite_index: bool = True, composite_index_fill_value: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Perform a left outer join.

Parameters
  • left_depth_level – Specify one or more left index depths to include in the join predicate.

  • left_columns – Specify one or more left columns to include in the join predicate.

  • right_depth_level – Specify one or more right index depths to include in the join predicate.

  • right_columns – Specify one or more right columns to include in the join predicate.

  • left_template – Provide a format string for naming left columns in the joined result.

  • right_template – Provide a format string for naming right columns in the joined result.

  • fill_value – A value to be used to fill space created in the join.

  • composite_index – If True, an index of tuples will be returned, formed from the left index label and the right index label; if False, an index of matching labels, if unique, will be returned.

  • composite_index_fill_value – Value to be used when forming a composite index when a label is missing.

Returns

Frame

Frame.join_outer(other: static_frame.core.frame.Frame, *, left_depth_level: Optional[Union[int, Iterable[int]]] = None, left_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, right_depth_level: Optional[Union[int, Iterable[int]]] = None, right_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, left_template: str = '{}', right_template: str = '{}', fill_value: Any = nan, composite_index: bool = True, composite_index_fill_value: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Perform an outer join.

Parameters
  • left_depth_level – Specify one or more left index depths to include in the join predicate.

  • left_columns – Specify one or more left columns to include in the join predicate.

  • right_depth_level – Specify one or more right index depths to include in the join predicate.

  • right_columns – Specify one or more right columns to include in the join predicate.

  • left_template – Provide a format string for naming left columns in the joined result.

  • right_template – Provide a format string for naming right columns in the joined result.

  • fill_value – A value to be used to fill space created in the join.

  • composite_index – If True, an index of tuples will be returned, formed from the left index label and the right index label; if False, an index of matching labels, if unique, will be returned.

  • composite_index_fill_value – Value to be used when forming a composite index when a label is missing.

Returns

Frame

Frame.join_right(other: static_frame.core.frame.Frame, *, left_depth_level: Optional[Union[int, Iterable[int]]] = None, left_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, right_depth_level: Optional[Union[int, Iterable[int]]] = None, right_columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray] = None, left_template: str = '{}', right_template: str = '{}', fill_value: Any = nan, composite_index: bool = True, composite_index_fill_value: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Perform a right outer join.

Parameters
  • left_depth_level – Specify one or more left index depths to include in the join predicate.

  • left_columns – Specify one or more left columns to include in the join predicate.

  • right_depth_level – Specify one or more right index depths to include in the join predicate.

  • right_columns – Specify one or more right columns to include in the join predicate.

  • left_template – Provide a format string for naming left columns in the joined result.

  • right_template – Provide a format string for naming right columns in the joined result.

  • fill_value – A value to be used to fill space created in the join.

  • composite_index – If True, an index of tuples will be returned, formed from the left index label and the right index label; if False, an index of matching labels, if unique, will be returned.

  • composite_index_fill_value – Value to be used when forming a composite index when a label is missing.

Returns

Frame

Frame.loc_max(*, skipna: bool = True, axis: int = 0)static_frame.core.series.Series[source]

Return the labels corresponding to the maximum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.loc_min(*, skipna: bool = True, axis: int = 0)static_frame.core.series.Series[source]

Return the labels corresponding to the minimum value found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.max(axis: int = 0, skipna: bool = True)Any

Return the maximum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.max()
<Series>
<Index>
diameter 142984.0
mass     1898.0
<<U8>    <float64>

Frame.mean(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Return the mean along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))

>>> f.mean()
<Series>
<Index>
diameter 92092.0
mass     823.9900000000001
<<U8>    <float64>

Frame.median(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Return the median along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.min(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Return the minimum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))

>>> f.min()
<Series>
<Index>
diameter 12756.0
mass     5.97
<<U8>    <float64>

Frame.notna()static_frame.core.frame.Frame[source]

Return a same-indexed, Boolean Frame indicating True which values are not NaN or None.

Frame.pivot(index_fields: Union[Hashable, Iterable[Hashable]], columns_fields: Union[Hashable, Iterable[Hashable]] = (), data_fields: Union[Hashable, Iterable[Hashable]] = (), *, func: Optional[Union[Callable[[], Any], Mapping[Hashable, Callable[[], Any]]]] = None, fill_value: object = nan)static_frame.core.frame.Frame[source]

Produce a pivot table, where one or more columns is selected for each of index_fields, columns_fields, and data_fields. Unique values from the provided index_fields will be used to create a new index; unique values from the provided columns_fields will be used to create a new columns; if one data_fields value is selected, that is the value that will be displayed; if more than one values is given, those values will be presented with a hierarchical index on the columns; if data_fields is not provided, all unused fields will be displayed.

Parameters
  • index_fields

  • columns_fields

  • data_fields

  • fill_value – If the index expansion produces coordinates that have no existing data value, fill that position with this value.

  • func – function to apply to data_fields, or a dictionary of labelled functions to apply to data fields, producing an additional hierarchical level.

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f
<Frame>
<Index> name    mass      charge    type   <<U6>
<Index>
0       muon    0.106     -1.0      lepton
1       tau     1.777     -1.0      lepton
2       charm   1.3       0.666     quark
3       strange 0.1       -0.333    quark
<int64> <<U7>   <float64> <float64> <<U6>

>>> f.pivot(index_fields='type', data_fields='mass', func={'mean':np.mean, 'max':np.max})
<Frame>
<IndexHierarchy: ('values', 'func')> mass               mass      <<U4>
                                     mean               max       <<U4>
<Index: type>
lepton                               0.9415             1.777
quark                                0.7000000000000001 1.3
<<U6>                                <float64>          <float64>

Frame.pivot_stack(depth_level: Union[int, Iterable[int]] = - 1, *, fill_value: object = nan)static_frame.core.frame.Frame[source]

Move labels from the columns to the index, creating or extending an IndexHierarchy on the index.

Parameters

depth_level – selection of columns depth or depth to move onto the index.

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f = f.set_index_hierarchy(('type', 'name'), drop=True)
>>> f
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

>>> f.pivot_stack()
<Frame>
<Index>                         0         <int64>
<IndexHierarchy>
lepton           muon    mass   0.106
lepton           muon    charge -1.0
lepton           tau     mass   1.777
lepton           tau     charge -1.0
quark            charm   mass   1.3
quark            charm   charge 0.666
quark            strange mass   0.1
quark            strange charge -0.333
<<U6>            <<U7>   <<U6>  <float64>

Frame.pivot_unstack(depth_level: Union[int, Iterable[int]] = - 1, *, fill_value: object = nan)static_frame.core.frame.Frame[source]

Move labels from the index to the columns, creating or extending an IndexHierarchy on the columns.

Parameters

depth_level – selection of index depth or depth to move onto the columns.

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f = f.set_index_hierarchy(('type', 'name'), drop=True)
>>> f
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

>>> f.pivot_unstack(0)
<Frame>
<IndexHierarchy> mass      mass      charge    charge    <<U6>
                 lepton    quark     lepton    quark     <<U6>
<Index>
muon             0.106     nan       -1.0      nan
tau              1.777     nan       -1.0      nan
charm            nan       1.3       nan       0.666
strange          nan       0.1       nan       -0.333
<<U7>            <float64> <float64> <float64> <float64>

>>> f.pivot_unstack(1)
<Frame>
<IndexHierarchy> mass      mass      mass      mass      charge    charge    charge    charge    <<U6>
                 muon      tau       charm     strange   muon      tau       charm     strange   <<U7>
<Index>
lepton           0.106     1.777     nan       nan       -1.0      -1.0      nan       nan
quark            nan       nan       1.3       0.1       nan       nan       0.666     -0.333
<<U6>            <float64> <float64> <float64> <float64> <float64> <float64> <float64> <float64>

>>> f.pivot_unstack([0, 1])
<Frame>
<IndexHierarchy> mass      mass      mass      mass      charge    charge    charge    charge    <<U6>
                 lepton    lepton    quark     quark     lepton    lepton    quark     quark     <<U6>
                 muon      tau       charm     strange   muon      tau       charm     strange   <<U7>
<Index>
0                0.106     1.777     1.3       0.1       -1.0      -1.0      0.666     -0.333
<int64>          <float64> <float64> <float64> <float64> <float64> <float64> <float64> <float64>

Frame.prod(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Return the product along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.rehierarch(index: Optional[Iterable[int]] = None, columns: Optional[Iterable[int]] = None)static_frame.core.frame.Frame[source]

Produce a new Frame with index and/or columns constructed with a transformed hierarchy.

Frame.reindex(index: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, columns: Optional[Union[static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, *, fill_value: object = nan, own_index: bool = False, own_columns: bool = False, check_equals: bool = True)static_frame.core.frame.Frame[source]

Return a new Frame with labels defined by the provided index. The size and ordering of the data is determined by the newly provided index, where data will continue to be aligned under labels found in both the new and the old index. Labels found only in the new index will be filled with fill_value.

Parameters
  • index – An iterable of unique, hashable values, or another Index or IndexHierarchy, to be used as the labels of the index.

  • columns – An iterable of unique, hashable values, or another Index or IndexHierarchy, to be used as the labels of the index.

  • fill_value – A value to be used to fill space created by a new index that has values not found in the previous index.

  • own_index – Flag the passed index as ownable by this static_frame.Frame. Primarily used by internal clients.

  • own_columns – Flag the passed columns as ownable by this static_frame.Frame. Primarily used by internal clients.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    6792     0.642
Jupiter 142984   1898.0
<<U7>   <int64>  <float64>

>>> f.reindex(index=('Jupiter', 'Mars', 'Mercury'), columns=('density', 'mass'))
<Frame>
<Index> density   mass      <<U7>
<Index>
Jupiter nan       1898.0
Mars    nan       0.642
Mercury nan       nan
<<U7>   <float64> <float64>

Frame.relabel(index: Optional[Union[Callable[[], Any], Mapping[Hashable, Any], static_frame.core.series.Series, Type[static_frame.core.index_auto.IndexAutoFactory], static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None, columns: Optional[Union[Callable[[], Any], Mapping[Hashable, Any], static_frame.core.series.Series, Type[static_frame.core.index_auto.IndexAutoFactory], static_frame.core.index_base.IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]]]] = None)static_frame.core.frame.Frame[source]

Return a new Frame with transformed labels on the index. The size and ordering of the data is never changed in a relabeling operation. The resulting index must be unique.

Parameters
  • index – One of the following types, used to create a new Index with the same size as the previous index. (a) A mapping (as a dictionary or Series), used to lookup and transform the labels in the previous index. Previous labels not found in the mapping will be reused. (b) A function, returning a hashable, that is applied to each label in the previous index. (c) The IndexAutoFactory type, to apply an auto-incremented integer index. (d) An index initializer, i.e., either an iterable of hashables or an Index instance.

  • columns – One of the following types, used to create a new Index with the same size as the previous index. (a) A mapping (as a dictionary or Series), used to lookup and transform the labels in the previous index. Previous labels not found in the mapping will be reused. (b) A function, returning a hashable, that is applied to each label in the previous index. (c) The IndexAutoFactory type, to apply an auto-incremented integer index. (d) An index initializer, i.e., either an iterable of hashables or an Index instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> f.relabel(index=lambda x: x[:2].upper(), columns={'mass': 'mass(1e24kg)'})
<Frame>
<Index> diameter mass(1e24kg) <<U12>
<Index>
EA      12756    5.97
MA      6792     0.642
JU      142984   1898.0
<<U2>   <int64>  <float64>

Frame.relabel_flat(index: bool = False, columns: bool = False)static_frame.core.frame.Frame[source]

Return a new Frame, where an IndexHierarchy (if defined) is replaced with a flat, one-dimension index of tuples.

Parameters
  • index – Boolean to flag flatening on the index.

  • columns – Boolean to flag flatening on the columns.

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f = f.set_index_hierarchy(('type', 'name'), drop=True)
>>> f
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

>>> f.relabel_flat(index=True)
<Frame>
<Index>              mass      charge    <<U6>
<Index>
('lepton', 'muon')   0.106     -1.0
('lepton', 'tau')    1.777     -1.0
('quark', 'charm')   1.3       0.666
('quark', 'strange') 0.1       -0.333
<object>             <float64> <float64>

Frame.relabel_level_add(index: Optional[Hashable] = None, columns: Optional[Hashable] = None)static_frame.core.frame.Frame[source]

Return a new Frame, adding a new root level to an existing IndexHierarchy, or creating an IndexHierarchy if one is not yet defined.

Parameters
  • index – A hashable value to be used as a new root level, extending or creating an IndexHierarchy

  • columns – A hashable value to be used as a new root level, extending or creating an IndexHierarchy

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f = f.set_index_hierarchy(('type', 'name'), drop=True)
>>> f
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

>>> f.relabel_level_add(index='particle')
<Frame>
<Index>                                           mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
particle                           lepton muon    0.106     -1.0
particle                           lepton tau     1.777     -1.0
particle                           quark  charm   1.3       0.666
particle                           quark  strange 0.1       -0.333
<<U8>                              <<U6>  <<U7>   <float64> <float64>

Frame.relabel_level_drop(index: int = 0, columns: int = 0)static_frame.core.frame.Frame[source]

Return a new Frame, dropping one or more levels from a either the root or the leaves of an IndexHierarchy. The resulting index must be unique.

Parameters
  • index – A positive integer drops that many outer-most (root) levels; a negative integer drops that many inner-most (leaf)levels. Default is zero.

  • columns – A positive integer drops that many outer-most (root) levels; a negative integer drops that many inner-most (leaf)levels. Default is zero.

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f = f.set_index_hierarchy(('type', 'name'), drop=True)
>>> f
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

>>> f.relabel_level_drop(index=1)
<Frame>
<Index>       mass      charge    <<U6>
<Index: name>
muon          0.106     -1.0
tau           1.777     -1.0
charm         1.3       0.666
strange       0.1       -0.333
<<U7>         <float64> <float64>

Frame.relabel_shift_in(key: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray], *, axis: int = 0)static_frame.core.frame.Frame[source]

Create, or augment, an IndexHierarchy by providing one or more selections via axis-appropriate loc selections.

Parameters
  • key – a loc-style selection on the opposite axis.

  • axis – 0 modifies the index by selecting columns with key; 1 modifies the columns by selecting rows with key.

Frame.relabel_shift_out(depth_level: Union[int, Iterable[int]], *, axis: int = 0)static_frame.core.frame.Frame[source]

Shift values from an index on an axis to the Frame by providing one or more depth level selections.

Parameters
  • key – an iloc-style selection on the axis.

  • axis – 0 modifies the index by selecting columns with key; 1 modifies the columns by selecting rows with key.

Frame.rename(name: Optional[Hashable] = <object object>, *, index: Optional[Hashable] = <object object>, columns: Optional[Hashable] = <object object>)static_frame.core.frame.Frame[source]

Return a new Frame with an updated name attribute. Optionally update the name attribute of index and columns.

Frame.roll(index: int = 0, columns: int = 0, *, include_index: bool = False, include_columns: bool = False)static_frame.core.frame.Frame[source]

Roll columns and/or rows by positive or negative integer counts, where columns and/or rows roll around the axis.

Parameters
  • include_index – Determine if index is included in index-wise rotation.

  • include_columns – Determine if column index is included in index-wise rotation.

Frame.sample(index: Optional[int] = None, columns: Optional[int] = None, *, seed: Optional[int] = None)static_frame.core.frame.Frame[source]

Randomly (optionally made deterministic with a fixed seed) extract items from the container to return a subset of the container.

Parameters
  • of labels to select from the index. (Number) –

  • of labels to select from the columns. (Number) –

  • state of random selection. (Initial) –

Frame.set_index(column: Hashable, *, drop: bool = False, index_constructor: Callable[[...], static_frame.core.index_base.IndexBase] = <class 'static_frame.core.index.Index'>)static_frame.core.frame.Frame[source]

Return a new frame produced by setting the given column as the index, optionally removing that column from the new Frame.

Frame.set_index_hierarchy(columns: Union[int, numpy.integer, slice, List[Any], None, static_frame.core.index.Index, static_frame.core.series.Series, numpy.ndarray], *, drop: bool = False, index_constructors: Optional[Sequence[Callable[[], static_frame.core.index_base.IndexBase]]] = None, reorder_for_hierarchy: bool = False)static_frame.core.frame.Frame[source]

Given an iterable of column labels, return a new Frame with those columns as an IndexHierarchy on the index.

Parameters
  • columns – Iterable of column labels.

  • drop – Boolean to determine if selected columns should be removed from the data.

  • index_constructors – Optionally provide a sequence of Index constructors, of length equal to depth, to be used in converting columns Index components in the IndexHierarchy.

  • reorder_for_hierarchy – reorder the rows to produce a hierarchible Index from the selected columns, assuming hierarchability is possible.

Returns

Frame

>>> f = sf.Frame.from_records((('muon', 0.106, -1.0, 'lepton'), ('tau', 1.777, -1.0, 'lepton'), ('charm', 1.3, 0.666, 'quark'), ('strange', 0.1, -0.333, 'quark')), columns=('name', 'mass', 'charge', 'type'))
>>> f
<Frame>
<Index> name    mass      charge    type   <<U6>
<Index>
0       muon    0.106     -1.0      lepton
1       tau     1.777     -1.0      lepton
2       charm   1.3       0.666     quark
3       strange 0.1       -0.333    quark
<int64> <<U7>   <float64> <float64> <<U6>
>>> f.set_index_hierarchy(('type', 'name'), drop=True)
<Frame>
<Index>                                    mass      charge    <<U6>
<IndexHierarchy: ('type', 'name')>
lepton                             muon    0.106     -1.0
lepton                             tau     1.777     -1.0
quark                              charm   1.3       0.666
quark                              strange 0.1       -0.333
<<U6>                              <<U7>   <float64> <float64>

Frame.shift(index: int = 0, columns: int = 0, *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Shift columns and/or rows by positive or negative integer counts, where columns and/or rows fall of the axis and introduce missing values, filled by fill_value.

Frame.sort_columns(*, ascending: bool = True, kind: str = 'mergesort', key: Optional[Callable[[static_frame.core.index_base.IndexBase], Union[numpy.ndarray, static_frame.core.index_base.IndexBase]]] = None)static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted columns.

Parameters
  • ascending – If True, sort in ascending order; if False, sort in descending order.

  • kind – Name of the sort algorithm as passed to NumPy.

  • key – A function that is used to pre-process the selected columns or rows and derive new values to sort by.

Frame.sort_index(*, ascending: bool = True, kind: str = 'mergesort', key: Optional[Callable[[static_frame.core.index_base.IndexBase], Union[numpy.ndarray, static_frame.core.index_base.IndexBase]]] = None)static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted Index.

Parameters
  • ascending – If True, sort in ascending order; if False, sort in descending order.

  • kind – Name of the sort algorithm as passed to NumPy.

  • key – A function that is used to pre-process the selected columns or rows and derive new values to sort by.

Frame.sort_values(label: Union[Hashable, Iterable[Hashable]], *, ascending: bool = True, axis: int = 1, kind: str = 'mergesort', key: Optional[Callable[[Union[static_frame.core.frame.Frame, static_frame.core.series.Series]], Union[numpy.ndarray, static_frame.core.series.Series, static_frame.core.frame.Frame]]] = None)static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted values, where values are given by single column or iterable of columns.

Parameters
  • label – A label or iterable of labels to select the columns (for axis 1) or rows (for axis 0) to sort.

  • *

  • ascending – If True, sort in ascending order; if False, sort in descending order.

  • kind – Name of the sort algorithm as passed to NumPy.

  • key – A function that is used to pre-process the selected columns or rows and derive new values to sort by.

Frame.std(axis: int = 0, skipna: bool = True, ddof: int = 0, out: Optional[numpy.ndarray] = None)Any

Return the standard deviaton along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))

>>> f.std()
<Series>
<Index>
diameter 56842.64155250587
mass     793.344204533358
<<U8>    <float64>

Frame.sum(axis: int = 0, skipna: bool = True, out: Optional[numpy.ndarray] = None)Any

Sum values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.sum()
<Series>
<Index>
diameter 276276.0
mass     2471.9700000000003
<<U8>    <float64>

Frame.tail(count: int = 5)static_frame.core.frame.Frame[source]

Return a Frame consisting only of the bottom elements as specified by count.

Parameters

count – Number of elements to be returned from the bottom of the Frame

Frame.transpose()static_frame.core.frame.Frame[source]

Transpose. Return a Frame with index as columns and vice versa.

Frame.unique(*, axis: Optional[int] = None)numpy.ndarray[source]

Return a NumPy array of unqiue values. If the axis argument is provied, uniqueness is determined by columns or row.

Frame.unset_index(*, names: Iterable[Hashable] = (), consolidate_blocks: bool = False)static_frame.core.frame.Frame[source]

Return a new Frame where the index is added to the front of the data, and an :obj:`IndexAutoFactory is used to populate a new index. If the Index has a name, that name will be used for the column name, otherwise a suitable default will be used. As underlying NumPy arrays are immutable, data is not copied.

Parameters

names – An iterable of hashables to be used to name the unset index. If an Index, a single hashable should be provided; if an IndexHierarchy, as many hashables as the depth must be provided.

Frame.var(axis: int = 0, skipna: bool = True, ddof: int = 0, out: Optional[numpy.ndarray] = None)Any

Return the variance along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Dictionary-Like

Overview: Frame: Dictionary-Like

Frame.__contains__(value: Hashable)bool[source]

Inclusion of value in column labels.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(temperature=np.int64, diameter=np.int64))

>>> 'temperature' in f
True

Frame.__iter__()Iterable[Hashable][source]

Iterator of column labels, same as Frame.keys().

Frame.__reversed__()Iterator[Hashable][source]

Returns a reverse iterator on the frame’s columns.

Frame.get(key: Hashable, default: Optional[static_frame.core.series.Series] = None)static_frame.core.series.Series[source]

Return the value found at the columns key, else the default if the key is not found. This method is implemented to complete the dictionary-like interface.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(temperature=np.int64, diameter=np.int64))

>>> f.get('diameter')
<Series: diameter>
<Index>
Earth              12756
Jupiter            142984
Saturn             120536
<<U7>              <int64>

>>> f.get('mass', np.nan)
nan

Frame.items()Iterator[Tuple[Hashable, static_frame.core.series.Series]][source]

Iterator of pairs of column label and corresponding column Series.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(temperature=np.int64, diameter=np.int64))
>>> f
<Frame>
<Index> diameter temperature <<U11>
<Index>
Earth   12756    15
Jupiter 142984   -110
Saturn  120536   -140
<<U7>   <int64>  <int64>
>>> len(f)
3
>>> [k for k, v in f.items() if (v < 0).any()]
['temperature']

Frame.keys()Iterable[Hashable][source]

Iterator of column labels.

Frame.values: np.ndarray

A 2D NumPy array of all values in the Frame. As this is a single array, heterogenous columnar types might be coerced to a compatible type.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(temperature=np.int64, diameter=np.int64))

>>> f.values.tolist()
[[12756, 15], [142984, -110], [120536, -140]]

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Display

Overview: Frame: Display

Frame.interface

A Frame documenting the interface of this class.

>>> sf.Frame.interface.loc[sf.Frame.interface.index.via_str.startswith('sort')]
<Frame: Frame>
<Index>                              cls_name group  doc                  <<U18>
<Index: signature>
sort_columns(*, ascending, kind, ... Frame    Method Return a new Fram...
sort_index(*, ascending, kind, key)  Frame    Method Return a new Fram...
sort_values(label, *, ascending, ... Frame    Method Return a new Fram...
<<U94>                               <<U5>    <<U18> <<U83>


Frame.__repr__()str

Return repr(self).

Frame.__str__()

Return str(self).

Frame.display(config: Optional[static_frame.core.display_config.DisplayConfig] = None)static_frame.core.display.Display[source]

Return a static_frame.Display, capable of providing a string representation.

Parameters

config – A static_frame.DisplayConfig instance. If not provided, the static_frame.DisplayActive will be used.

Frame.display_tall(config: Optional[static_frame.core.display_config.DisplayConfig] = None)static_frame.core.display.Display

Maximize vertical presentation. Return a static_frame.Display, capable of providing a string representation.

Parameters

config – A static_frame.DisplayConfig instance. If not provided, the static_frame.DisplayActive will be used.

Frame.display_wide(config: Optional[static_frame.core.display_config.DisplayConfig] = None)static_frame.core.display.Display

Maximize horizontal presentation. Return a static_frame.Display, capable of providing a string representation.

Parameters

config – A static_frame.DisplayConfig instance. If not provided, the static_frame.DisplayActive will be used.

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Assignment

Overview: Frame: Assignment

Frame.assign[key](value, *, fill_value)
Frame.assign
FrameAssign.__call__(value: Any, *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters
  • value – Value to assign, which can be a Series, Frame, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    6792     0.642
Jupiter 142984   1898.0
<<U7>   <int64>  <float64>

>>> f.assign['mass'](f['mass'] * .001)
<Frame>
<Index> diameter mass               <<U8>
<Index>
Earth   12756    0.00597
Mars    6792     0.000642
Jupiter 142984   1.8980000000000001
<<U7>   <int64>  <float64>

Frame.assign[key].apply(func, *, fill_value)
Frame.assign
FrameAssign.apply(func: Callable[[], Any], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

Frame.assign.iloc[key](value, *, fill_value)
Frame.assign
FrameAssign.__call__(value: Any, *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters
  • value – Value to assign, which can be a Series, Frame, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

Frame.assign.iloc[key].apply(func, *, fill_value)
Frame.assign
FrameAssign.apply(func: Callable[[], Any], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

Frame.assign.loc[key](value, *, fill_value)
Frame.assign
FrameAssign.__call__(value: Any, *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters
  • value – Value to assign, which can be a Series, Frame, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> f.assign.loc['Mars', 'mass'](0)
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    6792     0.0
Jupiter 142984   1898.0
<<U7>   <int64>  <float64>

>>> f.assign.loc['Mars':, 'diameter'](0)
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    0        0.642
Jupiter 0        1898.0
<<U7>   <int64>  <float64>

>>> f.assign.loc[f['diameter'] > 10000, 'mass'](0)
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    0.0
Mars    6792     0.642
Jupiter 142984   0.0
<<U7>   <int64>  <float64>

Frame.assign.loc[key].apply(func, *, fill_value)
Frame.assign
FrameAssign.apply(func: Callable[[], Any], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

Frame.assign.bloc[key](value, *, fill_value)
Frame.assign
FrameAssign.__call__(value: Any, *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters
  • value – Value to assign, which can be a Series, Frame, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

Frame.assign.bloc[key].apply(func, *, fill_value)
Frame.assign
FrameAssign.apply(func: Callable[[], Any], *, fill_value: Any = nan)static_frame.core.frame.Frame[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Selector

Overview: Frame: Selector

Frame.bloc[key]
Frame.bloc
Frame.drop[key]
Frame.drop
InterfaceSelectTrio.__getitem__(key: Union[int, numpy.integer, slice, List[Any], None, Index, Series, numpy.ndarray])Any[source]

Label-based selection.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64, temperature=np.int64))

>>> f
<Frame>
<Index> diameter temperature <<U11>
<Index>
Earth   12756    15
Jupiter 142984   -110
Saturn  120536   -140
<<U7>   <int64>  <int64>

>>> f.drop['diameter']
<Frame>
<Index> temperature <<U11>
<Index>
Earth   15
Jupiter -110
Saturn  -140
<<U7>   <int64>

Frame.drop.iloc[key]
Frame.drop
InterfaceSelectTrio.iloc

Integer-position based selection.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64, temperature=np.int64))
>>> f
<Frame>
<Index> diameter temperature <<U11>
<Index>
Earth   12756    15
Jupiter 142984   -110
Saturn  120536   -140
<<U7>   <int64>  <int64>

>>> f.drop.iloc[-1, -1]
<Frame>
<Index> diameter <<U11>
<Index>
Earth   12756
Jupiter 142984
<<U7>   <int64>

Frame.drop.loc[key]
Frame.drop
InterfaceSelectTrio.loc

Label-based selection.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), temperature=(15, -110, -140)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64, temperature=np.int64))
>>> f
<Frame>
<Index> diameter temperature <<U11>
<Index>
Earth   12756    15
Jupiter 142984   -110
Saturn  120536   -140
<<U7>   <int64>  <int64>

>>> f.drop.loc[f['temperature'] < 0]
<Frame>
<Index> diameter temperature <<U11>
<Index>
Earth   12756    15
<<U7>   <int64>  <int64>

Frame.mask[key]
Frame.mask
InterfaceSelectTrio.__getitem__(key: Union[int, numpy.integer, slice, List[Any], None, Index, Series, numpy.ndarray])Any[source]

Label-based selection.

Frame.mask.iloc[key]
Frame.mask
InterfaceSelectTrio.iloc

Integer-position based selection.

Frame.mask.loc[key]
Frame.mask
InterfaceSelectTrio.loc

Label-based selection.

Frame.masked_array[key]
Frame.masked_array
InterfaceSelectTrio.__getitem__(key: Union[int, numpy.integer, slice, List[Any], None, Index, Series, numpy.ndarray])Any[source]

Label-based selection.

Frame.masked_array.iloc[key]
Frame.masked_array
InterfaceSelectTrio.iloc

Integer-position based selection.

Frame.masked_array.loc[key]
Frame.masked_array
InterfaceSelectTrio.loc

Label-based selection.

Frame[key]
Frame.__getitem__ = <function Frame.__getitem__>[source]
>>> index = ('Mercury', 'Venus', 'Earth', 'Mars')
>>> columns = ('diameter', 'gravity', 'temperature')
>>> records = ((4879, 3.7, 167), (12104, 8.9, 464), (12756, 9.8, 15), (6792, 3.7, -65))
>>> f = sf.Frame.from_records(records, index=index, columns=columns, dtypes=dict(diameter=np.int64, temperature=np.int64))
>>> f
<Frame>
<Index> diameter gravity   temperature <<U11>
<Index>
Mercury 4879     3.7       167
Venus   12104    8.9       464
Earth   12756    9.8       15
Mars    6792     3.7       -65
<<U7>   <int64>  <float64> <int64>

>>> f['gravity']
<Series: gravity>
<Index>
Mercury           3.7
Venus             8.9
Earth             9.8
Mars              3.7
<<U7>             <float64>
>>> f['gravity':]
<Frame>
<Index> gravity   temperature <<U11>
<Index>
Mercury 3.7       167
Venus   8.9       464
Earth   9.8       15
Mars    3.7       -65
<<U7>   <float64> <int64>
>>> f[['diameter', 'temperature']]
<Frame>
<Index> diameter temperature <<U11>
<Index>
Mercury 4879     167
Venus   12104    464
Earth   12756    15
Mars    6792     -65
<<U7>   <int64>  <int64>

Frame.iloc[key]
Frame.iloc
>>> index = ('Mercury', 'Venus', 'Earth', 'Mars')
>>> columns = ('diameter', 'gravity', 'temperature')
>>> records = ((4879, 3.7, 167), (12104, 8.9, 464), (12756, 9.8, 15), (6792, 3.7, -65))
>>> f = sf.Frame.from_records(records, index=index, columns=columns, dtypes=dict(diameter=np.int64, temperature=np.int64))
>>> f
<Frame>
<Index> diameter gravity   temperature <<U11>
<Index>
Mercury 4879     3.7       167
Venus   12104    8.9       464
Earth   12756    9.8       15
Mars    6792     3.7       -65
<<U7>   <int64>  <float64> <int64>

>>> f.iloc[-2:, -1]
<Series: temperature>
<Index>
Earth                 15
Mars                  -65
<<U7>                 <int64>

Frame.loc[key]
Frame.loc
>>> index = ('Mercury', 'Venus', 'Earth', 'Mars')
>>> columns = ('diameter', 'gravity', 'temperature')
>>> records = ((4879, 3.7, 167), (12104, 8.9, 464), (12756, 9.8, 15), (6792, 3.7, -65))
>>> f = sf.Frame.from_records(records, index=index, columns=columns, dtypes=dict(diameter=np.int64, temperature=np.int64))
>>> f
<Frame>
<Index> diameter gravity   temperature <<U11>
<Index>
Mercury 4879     3.7       167
Venus   12104    8.9       464
Earth   12756    9.8       15
Mars    6792     3.7       -65
<<U7>   <int64>  <float64> <int64>

>>> f.loc['Earth', 'temperature']
15
>>> f.loc['Earth':, 'temperature']
<Series: temperature>
<Index>
Earth                 15
Mars                  -65
<<U7>                 <int64>
>>> f.loc[f['temperature'] > 100, 'diameter']
<Series: diameter>
<Index>
Mercury            4879
Venus              12104
<<U7>              <int64>
>>> f.loc[sf.ILoc[-1], ['gravity', 'temperature']]
<Series: Mars>
<Index>
gravity        3.7
temperature    -65.0
<<U11>         <float64>

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Datetime | Accessor String | Accessor Transpose

Frame: Iterator

Overview: Frame: Iterator

Frame.iter_array(*, axis)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    6792     0.642
Jupiter 142984   1898.0
<<U7>   <int64>  <float64>

>>> [x.tolist() for x in f.iter_array(axis=0)]
[[12756, 6792, 142984], [5.97, 0.642, 1898.0]]

>>> [x.tolist() for x in f.iter_array(axis=1)]
[[12756.0, 5.97], [6792.0, 0.642], [142984.0, 1898.0]]

Frame.iter_array(*, axis).apply(func, *, dtype, name)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Mars    6792     0.642
Jupiter 142984   1898.0
<<U7>   <int64>  <float64>

>>> f.iter_array(axis=0).apply(np.sum)
<Series>
<Index>
diameter 162532.0
mass     1904.612
<<U8>    <float64>

Frame.iter_array(*, axis).apply_iter(func)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_array(*, axis).apply_iter_items(func)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_array(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_array(*, axis).map_all(mapping, *, dtype, name)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array(*, axis).map_all_iter(mapping)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array(*, axis).map_all_iter_items(mapping)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array(*, axis).map_any(mapping, *, dtype, name)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array(*, axis).map_any_iter(mapping)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array(*, axis).map_any_iter_items(mapping)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array(*, axis).map_fill_iter(mapping, *, fill_value)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_array(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_array

Iterator of np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_array_items(*, axis)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'))

>>> [x for x in f.iter_array_items(axis=0)]
[('diameter', array([ 12756,   6792, 142984])), ('mass', array([5.970e+00, 6.420e-01, 1.898e+03]))]

>>> [x for x in f.iter_array_items(axis=1)]
[('Earth', array([1.2756e+04, 5.9700e+00])), ('Mars', array([6.792e+03, 6.420e-01])), ('Jupiter', array([142984.,   1898.]))]

>>> f.iter_array_items(axis=1).apply(lambda k, v: v.sum() if k == 'Earth' else 0)
<Series>
<Index>
Earth    12761.97
Mars     0.0
Jupiter  0.0
<<U7>    <float64>

Frame.iter_array_items(*, axis).apply(func, *, dtype, name)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'))

>>> f.iter_array_items(axis=1).apply(lambda k, v: v.sum() if k == 'Earth' else 0)
<Series>
<Index>
Earth    12761.97
Mars     0.0
Jupiter  0.0
<<U7>    <float64>

Frame.iter_array_items(*, axis).apply_iter(func)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_array_items(*, axis).apply_iter_items(func)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_array_items(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_array_items(*, axis).map_all(mapping, *, dtype, name)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array_items(*, axis).map_all_iter(mapping)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array_items(*, axis).map_all_iter_items(mapping)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array_items(*, axis).map_any(mapping, *, dtype, name)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array_items(*, axis).map_any_iter(mapping)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array_items(*, axis).map_any_iter_items(mapping)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_array_items(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_array_items(*, axis).map_fill_iter(mapping, *, fill_value)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_array_items(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_array_items

Iterator of pairs of label, np.array, where arrays are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_element(*, axis)
iter_element

Iterator of elements, ordered by row then column.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> [x for x in f.iter_element()]
[12756, 5.97, 6792, 0.642, 142984, 1898.0]

Frame.iter_element(*, axis).apply(func, *, dtype, name)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> f.iter_element().apply(lambda x: x ** 2)
<Frame>
<Index> diameter    mass                <<U8>
<Index>
Earth   162715536   35.640899999999995
Mars    46131264    0.41216400000000003
Jupiter 20444424256 3602404.0
<<U7>   <int64>     <float64>

Frame.iter_element(*, axis).apply_iter(func)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_element(*, axis).apply_iter_items(func)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_element(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_element(*, axis).map_all(mapping, *, dtype, name)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element(*, axis).map_all_iter(mapping)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element(*, axis).map_all_iter_items(mapping)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element(*, axis).map_any(mapping, *, dtype, name)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element(*, axis).map_any_iter(mapping)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element(*, axis).map_any_iter_items(mapping)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element(*, axis).map_fill_iter(mapping, *, fill_value)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_element(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_element

Iterator of elements, ordered by row then column.

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_element_items(*, axis)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'))

>>> [x for x in f.iter_element_items()]
[(('Earth', 'diameter'), 12756), (('Earth', 'mass'), 5.97), (('Mars', 'diameter'), 6792), (('Mars', 'mass'), 0.642), (('Jupiter', 'diameter'), 142984), (('Jupiter', 'mass'), 1898.0)]

Frame.iter_element_items(*, axis).apply(func, *, dtype, name)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'))

>>> f.iter_element_items().apply(lambda k, v: v ** 2 if k[0] == 'Mars' else None)
<Frame>
<Index> diameter mass                <<U8>
<Index>
Earth   None     None
Mars    46131264 0.41216400000000003
Jupiter None     None
<<U7>   <object> <object>

Frame.iter_element_items(*, axis).apply_iter(func)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_element_items(*, axis).apply_iter_items(func)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_element_items(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_element_items(*, axis).map_all(mapping, *, dtype, name)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element_items(*, axis).map_all_iter(mapping)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element_items(*, axis).map_all_iter_items(mapping)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element_items(*, axis).map_any(mapping, *, dtype, name)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element_items(*, axis).map_any_iter(mapping)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element_items(*, axis).map_any_iter_items(mapping)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_element_items(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_element_items(*, axis).map_fill_iter(mapping, *, fill_value)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_element_items(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_element_items

Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group(key, *, axis)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

>>> f = sf.Frame.from_dict(dict(mass=(0.33, 4.87, 5.97, 0.642), moons=(0, 0, 1, 2)), index=('Mercury', 'Venus', 'Earth', 'Mars'), dtypes=dict(moons=np.int64))
>>> next(iter(f.iter_group('moons')))
<Frame>
<Index> mass      moons   <<U5>
<Index>
Mercury 0.33      0
Venus   4.87      0
<<U7>   <float64> <int64>
>>> [x.shape for x in f.iter_group('moons')]
[(2, 2), (1, 2), (1, 2)]

Frame.iter_group(key, *, axis).apply(func, *, dtype, name)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group(key, *, axis).apply_iter(func)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_group(key, *, axis).apply_iter_items(func)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_group(key, *, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_group(key, *, axis).map_all(mapping, *, dtype, name)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group(key, *, axis).map_all_iter(mapping)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group(key, *, axis).map_all_iter_items(mapping)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group(key, *, axis).map_any(mapping, *, dtype, name)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group(key, *, axis).map_any_iter(mapping)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group(key, *, axis).map_any_iter_items(mapping)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group(key, *, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group(key, *, axis).map_fill_iter(mapping, *, fill_value)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group(key, *, axis).map_fill_iter_items(mapping, *, fill_value)
iter_group

Iterator of Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_items(key, *, axis)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

>>> f = sf.Frame.from_dict(dict(mass=(0.33, 4.87, 5.97, 0.642), moons=(0, 0, 1, 2)), index=('Mercury', 'Venus', 'Earth', 'Mars'))
>>> [(k, v.index.values.tolist(), v['mass'].mean()) for k, v in f.iter_group_items('moons')]
[(0, ['Mercury', 'Venus'], 2.6), (1, ['Earth'], 5.97), (2, ['Mars'], 0.642)]

Frame.iter_group_items(key, *, axis).apply(func, *, dtype, name)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_items(key, *, axis).apply_iter(func)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_group_items(key, *, axis).apply_iter_items(func)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_group_items(key, *, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_group_items(key, *, axis).map_all(mapping, *, dtype, name)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_items(key, *, axis).map_all_iter(mapping)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_items(key, *, axis).map_all_iter_items(mapping)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_items(key, *, axis).map_any(mapping, *, dtype, name)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_items(key, *, axis).map_any_iter(mapping)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_items(key, *, axis).map_any_iter_items(mapping)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_items(key, *, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_items(key, *, axis).map_fill_iter(mapping, *, fill_value)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_items(key, *, axis).map_fill_iter_items(mapping, *, fill_value)
iter_group_items

Iterator of pairs of label, Frame grouped by unique values found in one or more columns (axis=0) or rows (axis=1).

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_labels(depth_level, *, axis)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

Frame.iter_group_labels(depth_level, *, axis).apply(func, *, dtype, name)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels(depth_level, *, axis).apply_iter(func)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_group_labels(depth_level, *, axis).apply_iter_items(func)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_group_labels(depth_level, *, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_group_labels(depth_level, *, axis).map_all(mapping, *, dtype, name)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels(depth_level, *, axis).map_all_iter(mapping)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels(depth_level, *, axis).map_all_iter_items(mapping)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels(depth_level, *, axis).map_any(mapping, *, dtype, name)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels(depth_level, *, axis).map_any_iter(mapping)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels(depth_level, *, axis).map_any_iter_items(mapping)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels(depth_level, *, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels(depth_level, *, axis).map_fill_iter(mapping, *, fill_value)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_labels(depth_level, *, axis).map_fill_iter_items(mapping, *, fill_value)
iter_group_labels

Iterator of Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_labels_items(depth_level, *, axis)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

Frame.iter_group_labels_items(depth_level, *, axis).apply(func, *, dtype, name)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels_items(depth_level, *, axis).apply_iter(func)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_group_labels_items(depth_level, *, axis).apply_iter_items(func)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_group_labels_items(depth_level, *, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_group_labels_items(depth_level, *, axis).map_all(mapping, *, dtype, name)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels_items(depth_level, *, axis).map_all_iter(mapping)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels_items(depth_level, *, axis).map_all_iter_items(mapping)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels_items(depth_level, *, axis).map_any(mapping, *, dtype, name)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels_items(depth_level, *, axis).map_any_iter(mapping)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels_items(depth_level, *, axis).map_any_iter_items(mapping)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_group_labels_items(depth_level, *, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_group_labels_items(depth_level, *, axis).map_fill_iter(mapping, *, fill_value)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_group_labels_items(depth_level, *, axis).map_fill_iter_items(mapping, *, fill_value)
iter_group_labels_items

Iterator of pairs of label, Frame grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_series(*, axis)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> next(iter(f.iter_series(axis=0)))
<Series: diameter>
<Index>
Earth              12756
Mars               6792
Jupiter            142984
<<U7>              <int64>

>>> next(iter(f.iter_series(axis=1)))
<Series: Earth>
<Index>
diameter        12756.0
mass            5.97
<<U8>           <float64>

Frame.iter_series(*, axis).apply(func, *, dtype, name)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'), dtypes=dict(diameter=np.int64))

>>> f.iter_series(axis=0).apply(lambda s: s.mean())
<Series>
<Index>
diameter 54177.333333333336
mass     634.8706666666667
<<U8>    <float64>

Frame.iter_series(*, axis).apply_iter(func)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_series(*, axis).apply_iter_items(func)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_series(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_series(*, axis).map_all(mapping, *, dtype, name)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series(*, axis).map_all_iter(mapping)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series(*, axis).map_all_iter_items(mapping)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series(*, axis).map_any(mapping, *, dtype, name)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series(*, axis).map_any_iter(mapping)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series(*, axis).map_any_iter_items(mapping)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series(*, axis).map_fill_iter(mapping, *, fill_value)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_series(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_series

Iterator of Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_series_items(*, axis)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 6792, 142984), mass=(5.97, 0.642, 1898)), index=('Earth', 'Mars', 'Jupiter'))

>>> [(k, v.mean()) for k, v in f.iter_series_items(axis=0)]
[('diameter', 54177.333333333336), ('mass', 634.8706666666667)]

>>> [(k, v.max()) for k, v in f.iter_series_items(axis=1)]
[('Earth', 12756.0), ('Mars', 6792.0), ('Jupiter', 142984.0)]

>>> f.iter_series_items(axis=0).apply(lambda k, v: v.mean() if k == 'diameter' else v.sum())
<Series>
<Index>
diameter 54177.333333333336
mass     1904.612
<<U8>    <float64>

Frame.iter_series_items(*, axis).apply(func, *, dtype, name)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a function to each value. Returns a new container.

Parameters
  • func – A function that takes a value.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series_items(*, axis).apply_iter(func)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter(func: Callable[[], Any])Iterator[Any][source]

Apply a function to each value. A generator of resulting values.

Parameters

func – A function that takes a value.

Frame.iter_series_items(*, axis).apply_iter_items(func)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_iter_items(func: Callable[[], Any])Iterator[Tuple[Any, Any]][source]

Apply a function to each value. A generator of resulting key, value pairs.

Parameters

func – A function that takes a value.

Frame.iter_series_items(*, axis).apply_pool(func, *, dtype, name, max_workers, chunksize, use_threads)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.apply_pool(func: Callable[[], Any], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None, max_workers: Optional[int] = None, chunksize: int = 1, use_threads: bool = False)FrameOrSeries[source]

Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.

Parameters
  • func – A function that takes a value.

  • *

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

  • name – A hashable object to label the container.

  • max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor; None defaults to the max number of machine processes.

  • chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.

  • use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.

Frame.iter_series_items(*, axis).map_all(mapping, *, dtype, name)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series_items(*, axis).map_all_iter(mapping)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series_items(*, axis).map_all_iter_items(mapping)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_all_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series_items(*, axis).map_any(mapping, *, dtype, name)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any(mapping: Union[Mapping[Hashable, Any], Series], *, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series_items(*, axis).map_any_iter(mapping)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Any][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series_items(*, axis).map_any_iter_items(mapping)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_any_iter_items(mapping: Union[Mapping[Hashable, Any], Series])Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.

Parameters

mapping – A mapping type, such as a dictionary or Series.

Frame.iter_series_items(*, axis).map_fill(mapping, *, fill_value, dtype, name)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan, dtype: Optional[Union[str, numpy.dtype, type]] = None, name: Optional[Hashable] = None)FrameOrSeries[source]

Apply a mapping; for values not in the mapping, the fill_value is returned. Returns a new container.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

  • dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

Frame.iter_series_items(*, axis).map_fill_iter(mapping, *, fill_value)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Any][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting values.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_series_items(*, axis).map_fill_iter_items(mapping, *, fill_value)
iter_series_items

Iterator of pairs of label, Series, where Series are drawn from columns (axis=0) or rows (axis=1)

IterNodeDelegate.map_fill_iter_items(mapping: Union[Mapping[Hashable, Any], Series], *, fill_value: Any = nan)Iterator[Tuple[Any, Any]][source]

Apply a mapping; for values not in the mapping, the fill_value is returned. A generator of resulting key, value pairs.

Parameters
  • mapping – A mapping type, such as a dictionary or Series.

  • fill_value – Value to be returned if the values is not a key in the mapping.

Frame.iter_tuple(*, axis