graviti.dataframe.row.series#

The implementation of the Graviti Series.

Module Contents#

Classes#

Series

One-dimensional array.

class graviti.dataframe.row.series.Series(data=None, schema=None, index=None)[source]#

One-dimensional array.

Parameters
  • data (Optional[Dict[str, Any]]) – The data that needs to be stored in Series. Could be ndarray or Iterable.

  • schema (Any) – Data type to force. If None, will be inferred from data.

  • index (Optional[List[str]]) – Index of the data.

Examples

Constructing Series from a list.

>>> d = {"filename": "a.jpg", "attributes": {"color": "red", "pose": "frontal"}}
>>> series = Series(data=d)
>>> series
filename           a.jpg
attributes color     red
            pose frontal
property iloc(self)[source]#

Purely integer-location based indexing for selection by position.

Allowed inputs are:

  • An integer, e.g. 5.

  • A list or array of integers, e.g. [4, 3, 0].

  • A slice object with ints, e.g. 1:7.

  • A boolean array of the same length as the axis being sliced.

Returns

The instance of the ILocIndexer.

Return type

graviti.dataframe.row.indexing.RowSeriesILocIndexer

Examples

>>> series = Series([1, 2, 3])
>>> series.loc[0]
1
>>> df.loc[[0]]
0    1
dtype: int64
property loc(self)[source]#

Access a group of rows and columns by indexes or a boolean array.

Allowed inputs are:

  • A single index, e.g. 5.

  • A list or array of indexes, e.g. [4, 3, 0].

  • A slice object with indexes, e.g. 1:7.

  • A boolean array of the same length as the axis being sliced.

Returns

The instance of the LocIndexer.

Return type

graviti.dataframe.row.indexing.RowSeriesLocIndexer

Examples

>>> series = Series([1, 2, 3])
>>> series.loc[0]
1
>>> df.loc[[0]]
0    1
dtype: int64