2. Container Import & Creation

Rather than offering a complex default initializer with arguments that are sometimes irrelevant, Series and Frame containers offer numerous specialized constructors.

Both Series and Frame have from_items constructors that consume key/value pairs, such as those returned by dict.items() and similar functions.

2.1. Series

classmethod Series.from_element(element: Any, *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None]], dtype: Union[str, numpy.dtype, type, None] = None, name: Hashable = None, index_constructor: Callable[[...], IndexBase] = None, own_index: bool = False)[source]
classmethod Series.from_items(pairs: Iterable[Tuple[Hashable, Any]], *, dtype: Union[str, numpy.dtype, type, None] = None, name: Hashable = None, index_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None) → static_frame.core.series.Series[source]

Series construction from an iterator or generator of pairs, where the first pair value is the index and the second is the value.

Parameters
  • pairs – Iterable of pairs of index, value.

  • dtype – dtype or valid dtype specifier.

Returns

static_frame.Series

>>> sf.Series.from_items(zip(('Mercury', 'Jupiter'), (4879, 12756)), dtype=np.int64)
<Series>
<Index>
Mercury  4879
Jupiter  12756
<<U7>    <int64>

classmethod Series.from_dict(mapping: Dict[Hashable, Any], *, dtype: Union[str, numpy.dtype, type, None] = None, name: Hashable = None, index_constructor: Optional[Callable[[...], static_frame.core.index_base.IndexBase]] = None) → static_frame.core.series.Series[source]

Series construction from a dictionary, where the first pair value is the index and the second is the value.

Parameters
  • mapping – a dictionary or similar mapping interface.

  • dtype – dtype or valid dtype specifier.

Returns

static_frame.Series

classmethod Series.from_concat(containers: Iterable[Series], *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], Type[static_frame.core.index_auto.IndexAutoFactory]] = None, name: Hashable = None) → static_frame.core.series.Series[source]

Concatenate multiple Series into a new Series.

Parameters
  • containers – Iterable of Series from which values in the new Series are drawn.

  • index – If None, the resultant index will be the concatenation of all indices (assuming they are unique in combination). If IndexAutoFactory, the resultant index is a auto-incremented integer index. Otherwise, the value is used as a index initializer.

classmethod Series.from_concat_items(items: Iterable[Tuple[Hashable, Series]]) → static_frame.core.series.Series[source]

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

Parameters

items – Iterable of pairs of label, Series

classmethod Series.from_pandas(value, *, own_data: bool = False) → static_frame.core.series.Series[source]

Given a Pandas Series, return a Series.

Parameters
  • value – Pandas Series.

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

  • own_index – If True, the underlying NumPy index label array will be made immutable and used without a copy.

Returns

static_frame.Series

2.2. Frame

classmethod Frame.from_element(element: Any, *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None]], columns: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None]], dtype: Union[str, numpy.dtype, type, None] = None, name: Hashable = None, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, own_index: bool = False, own_columns: bool = False)[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_elements(elements: Iterable[Any], *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], Type[static_frame.core.index_auto.IndexAutoFactory]] = None, columns: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], Type[static_frame.core.index_auto.IndexAutoFactory]] = None, dtype: Union[str, numpy.dtype, type, None] = None, name: Hashable = None, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, own_index: bool = False, own_columns: bool = False)[source]

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

classmethod Frame.from_series(series: static_frame.core.series.Series, *, name: Hashable = None, columns_constructor: Callable[[...], IndexBase] = None)[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_items(pairs: Iterable[Tuple[Hashable, Iterable[Any]]], *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None]] = None, fill_value: object = nan, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, consolidate_blocks: bool = False)[source]

Frame constructor from an iterator or generator of pairs, where the first value is the column label and the second value is an iterable of a column’s values.

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 name the Frame.

  • 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_records(records: Iterable[Any], *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], None] = None, columns: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], None] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, consolidate_blocks: bool = False, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, own_index: bool = False, own_columns: bool = False) → static_frame.core.frame.Frame[source]

Frame constructor 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.

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 name the Frame.

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

Returns

static_frame.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_dict_records(records: Iterable[Dict[Hashable, Any]], *, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], None] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, fill_value: object = nan, consolidate_blocks: bool = False, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], IndexBase] = None, own_index: bool = False) → static_frame.core.frame.Frame[source]

Frame constructor from an iterable of dictionaries; column names will be derived from the union of all 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 name the Frame.

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

Returns

static_frame.Frame

classmethod Frame.from_records_items(items: Iterator[Tuple[Hashable, Iterable[Any]]], *, columns: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], None] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, consolidate_blocks: 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 name the Frame.

  • 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[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, consolidate_blocks: 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.

  • 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 name the Frame.

  • 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: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None]] = None, fill_value: object = nan, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, index_constructor: Callable[[...], IndexBase] = None, columns_constructor: Callable[[...], 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.

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 name the Frame.

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

classmethod Frame.from_concat(frames: Iterable[Union[Frame, static_frame.core.series.Series]], *, axis: int = 0, union: bool = True, index: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], Type[static_frame.core.index_auto.IndexAutoFactory]] = None, columns: Union[IndexBase, Iterable[Hashable], Iterable[Sequence[Hashable]], Generator[Hashable, None, None], Type[static_frame.core.index_auto.IndexAutoFactory]] = None, name: 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 name the Frame.

  • 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 Series.from_concat_items(items: Iterable[Tuple[Hashable, Series]]) → static_frame.core.series.Series[source]

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

Parameters

items – Iterable of pairs of label, Series

classmethod Frame.from_delimited(fp: Union[str, pathlib.Path, TextIO, Iterator[str]], *, delimiter: str, index_depth: int = 0, index_column_first: Union[int, str, None] = None, columns_depth: int = 1, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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.

  • 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.

  • 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 only 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 name the Frame.

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

Returns

static_frame.Frame

classmethod Frame.from_csv(fp: Union[str, pathlib.Path, TextIO, Iterator[str]], *, index_depth: int = 0, index_column_first: Union[int, str, None] = None, columns_depth: int = 1, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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

static_frame.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_tsv(fp: Union[str, pathlib.Path, TextIO, Iterator[str]], *, index_depth: int = 0, index_column_first: Union[int, str, None] = None, columns_depth: int = 1, skip_header: int = 0, skip_footer: int = 0, quote_char: str = '"', encoding: Optional[str] = None, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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, pathlib.Path], *, label: Optional[str] = None, index_depth: int = 0, columns_depth: int = 1, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, consolidate_blocks: bool = False) → 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.

classmethod Frame.from_json(json_data: str, *, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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 name the Frame.

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

Returns

static_frame.Frame

classmethod Frame.from_json_url(url: str, *, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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 name the Frame.

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

Returns

static_frame.Frame

classmethod Frame.from_sql(query: str, *, connection: sqlite3.Connection, index_depth: int = 0, columns_depth: int = 1, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: Hashable = None, consolidate_blocks: bool = False) → 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.

  • name – A hashable object to name the Frame.

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

classmethod Frame.from_structured_array(array: numpy.ndarray, *, index_depth: int = 0, index_column_first: Union[int, str, None] = None, columns_depth: int = 1, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = None, name: 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 name the Frame.

  • 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_pandas(value: pandas.DataFrame, *, consolidate_blocks: bool = False, own_data: bool = False) → Frame[source]

Given a Pandas DataFrame, return a Frame.

Parameters
  • value – Pandas DataFrame.

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

Returns

static_frame.Frame

classmethod Frame.from_sqlite(fp: Union[str, pathlib.Path], *, label: Optional[str] = None, index_depth: int = 0, columns_depth: int = 1, dtypes: Union[Iterable[Union[str, numpy.dtype, type, None]], Dict[Hashable, Union[str, numpy.dtype, type, None]], None] = 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_hdf5(fp: Union[str, pathlib.Path], *, label: str, 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_arrow(value: pyarrow.Table, *, index_depth: int = 0, columns_depth: int = 1, consolidate_blocks: bool = False, name: Hashable = None) → Frame[source]

Convert an Arrow Table into a Frame.

classmethod Frame.from_parquet(fp: Union[str, pathlib.Path], *, index_depth: int = 0, columns_depth: int = 1, consolidate_blocks: bool = False, name: Hashable = None) → static_frame.core.frame.Frame[source]

Realize a Frame from a Parquet file.

2.3. Index

While indices are often specified with their data at container creation team, in some cases explicitly creating indices in advance of the data is practical.

classmethod Index.from_labels(labels: Iterable[Sequence[Hashable]], *, name: Hashable = None) → static_frame.core.index.Index[source]

Construct an Index from an iterable of labels, where each label is a hashable. Provided for a compatible interface to IndexHierarchy.

classmethod IndexHierarchy.from_product(*levels, name: Hashable = None) → IH[source]

Given groups of iterables, return an IndexHierarchy made of the product of a values in those groups, where the first group is the top-most hierarchy.

Returns

static_frame.IndexHierarchy

classmethod IndexHierarchy.from_tree(tree, *, name: Hashable = None) → IH[source]

Convert into a IndexHierarchy a dictionary defining keys to either iterables or nested dictionaries of the same.

Returns

static_frame.IndexHierarchy

classmethod IndexHierarchy.from_labels(labels: Iterable[Sequence[Hashable]], *, name: Hashable = None, reorder_for_hierarchy: bool = False, index_constructors: Optional[Sequence[Callable[[...], IndexBase]]] = None, continuation_token: Optional[Hashable] = <object object>) → IH[source]

Construct an IndexHierarhcy from an iterable of labels, where each label is tuple defining the component labels for all hierarchies.

Parameters
  • labels – an iterator or generator of tuples.

  • reorder_for_hierarchy – reorder the labels to produce a hierarchible Index, assuming hierarchability is possible.

  • continuation_token – a Hashable that will be used as a token to identify when a value in a label should use the previously encountered value at the same depth.

Returns

static_frame.IndexHierarchy