graviti.dataframe.column.series#

The implementation of the Graviti Series.

Module Contents#

Classes#

SeriesBase

One-dimensional array.

Series

One-dimensional array.

ArraySeries

One-dimensional array for portex builtin type array.

FileSeries

One-dimensional array for file.

EnumSeries

One-dimensional array for portex builtin type enum.

class graviti.dataframe.column.series.SeriesBase[source]#

Bases: graviti.dataframe.container.Container

One-dimensional array.

Parameters
  • data – The data that needs to be stored in Series. Could be ndarray or Iterable.

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

Examples

Constructing Series from a list.

>>> d = [1,2,3,4]
>>> series = Series(data=d)
>>> series
0 1
1 2
2 3
3 4
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.column.indexing.ColumnSeriesILocIndexer

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.column.indexing.ColumnSeriesLocIndexer

Examples

>>> series = Series([1, 2, 3])
>>> series.loc[0]
1
>>> df.loc[[0]]
0    1
dtype: int64
classmethod from_pyarrow(cls, array, schema=None)[source]#

Instantiate a Series backed by an pyarrow array.

Parameters
  • array (pyarrow.Array) – The input pyarrow array.

  • schema (Optional[graviti.portex.PortexType]) – The schema of the series. If None, will be inferred from array.

  • cls (Type[_SB]) –

Raises

TypeError – When the schema is mismatched with the pyarrow array type.

Returns

The loaded Series instance.

Return type

_SB

class graviti.dataframe.column.series.Series[source]#

Bases: SeriesBase

One-dimensional array.

Parameters
  • data – The data that needs to be stored in Series. Could be ndarray or Iterable.

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

Examples

Constructing Series from a list.

>>> d = [1,2,3,4]
>>> series = Series(data=d)
>>> series
0 1
1 2
2 3
3 4
to_pylist(self)[source]#

Convert the Series to a python list.

Returns

The python list representing the Series.

Return type

List[Any]

class graviti.dataframe.column.series.ArraySeries[source]#

Bases: SeriesBase

One-dimensional array for portex builtin type array.

to_pylist(self)[source]#

Convert the Series to a python list.

Returns

The python list representing the Series.

Return type

List[Any]

class graviti.dataframe.column.series.FileSeries[source]#

Bases: Series

One-dimensional array for file.

to_pylist(self)[source]#

Convert the BinaryFileSeries to python list.

Returns

The python list.

Return type

List[graviti.file.FileBase]

class graviti.dataframe.column.series.EnumSeries[source]#

Bases: Series

One-dimensional array for portex builtin type enum.

to_pylist(self)[source]#

Convert the Series to a python list.

Returns

The python list representing the Series.

Return type

List[Any]