Skip to content

Index objects

Index

Properties

pd.Index.name

  • pandas.Index.name

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.name
    
    >>> I = pd.Index([1,2,3], name = "hello world")
    >>> f(I)
    "hello world"
    

pd.Index.names

  • pandas.Index.names

    Important

    Bodo returns a tuple instead of a FrozenList.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.names
    
    >>> I = pd.MultiIndex.from_product([[1, 2], ["A", "B"]], names=["C1", "C2"])
    >>> f(I)
    ('C1', 'C2')
    

pd.Index.shape

  • pandas.Index.shape

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.shape
    
    >>> I = pd.Index([1,2,3])
    >>> f(I)
    (3,)
    

pd.Index.size

  • pandas.Index.size

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.size
    
    >>> I = pd.Index([1,7,8,6])
    >>> f(I)
    4
    

pd.Index.empty

  • pandas.Index.empty

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.empty
    
    >>> I = pd.Index(["A", "B", "C"])
    >>> f(I)
    False
    

pd.Index.is_monotonic_increasing

  • pandas.Index.is_monotonic_increasing and pandas.Index.is_monotonic

    Unsupported Index Types

    • StringIndex
    • BinaryIndex
    • IntervalIndex
    • CategoricalIndex
    • PeriodIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_monotonic_increasing
    
    >>> I = pd.Index([1,2,3])
    >>> f(I)
    True
    
    >>> @bodo.jit
    ... def g(I):
    ...   return I.is_monotonic
    
    >>> I = pd.Index(1,2,3])
    >>> g(I)
    True
    

pd.Index.is_monotonic_decreasing

  • pandas.Index.is_monotonic_decreasing

    Unsupported Index Types

    • StringIndex
    • BinaryIndex
    • IntervalIndex
    • CategoricalIndex
    • PeriodIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_monotonic_decreasing
    
    >>> I = pd.Index([1,2,3])
    >>> f(I)
    False
    

pd.Index.values

  • pandas.Index.values

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.values
    
    >>> I = pd.Index([1,2,3])
    >>> f(I)
    [1 2 3]
    

pd.Index.nbytes

  • pandas.Index.nbytes

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Important

    Currently, Bodo upcasts all numeric index data types to 64 bitwidth.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.nbytes
    
    >>> I1 = pd.Index([1,2,3,4,5,6], dtype = np.int64)
    >>> f(I1)
    48
    >>> I2 = pd.Index([1,2,3], dtype = np.int64)
    >>> f(I2)
    24
    >>> I3 = pd.Index([1,2,3], dtype = np.int32)
    >>> f(I3)
    24
    

pd.Index.ndim

  • pandas.Index.ndim

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.ndim
    
    >>> I = pd.Index([1,2,3,4])
    >>> f(I)
    1
    

pd.Index.nlevels

  • pandas.Index.nlevels

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.nlevels
    
    >>> I = pd.MultiIndex.from_arrays([[1, 2, 3, 4],["A", "A", "B", "B"]])
    >>> f(I)
    2
    

#### pd.Index.dtype

  • pandas.Index.dtype

    Unsupported Index Types

    • PeriodIndex
    • IntervalIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.dtype
    
    >>> I = pd.Index([1,2,3,4])
    >>> f(I)
    dtype('int64')
    

#### pd.Index.inferred_type

  • pandas.Index.inferred_type

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.dtype
    
    >>> I = pd.Index(["A", "E", "I", "O", "U"])
    >>> f(I)
    'string'
    

#### pd.Index.is_all_dates

  • pandas.Index.is_all_dates

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_all_dates
    
    >>> I = pd.date_range("2018-01-01", "2018-01-06")
    >>> f(I)
    True
    

#### pd.Index.T

  • pandas.Index.T

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.T
    
    >>> I = pd.Index(["A", "E", "I", "O", "U"])
    >>> f(I)
    Index(["A", "E", "I", "O", "U"], dtype='object')
    

Type information

pd.Index.is_numeric

  • pandas.Index.is_numeric()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_numeric()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    True
    

pd.Index.is_integer

  • pandas.Index.is_integer()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_integer()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    True
    

pd.Index.is_floating

  • pandas.Index.is_floating()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_floating()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    False
    

pd.Index.is_boolean

  • pandas.Index.is_boolean()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_boolean()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    False
    

pd.Index.is_categorical

  • pandas.Index.is_categorical()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_categorical()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    False
    

pd.Index.is_interval

  • pandas.Index.is_interval()


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_interval()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    False
    

pd.Index.is_object

  • pandas.Index.is_object()

    Important

    Currently, Bodo diverges from the Pandas API for Indices of boolean values. Bodo always returns True, whereas Pandas returns False if the index was constructed from a pd.array of booleans.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_object()
    
    >>> I = pd.Index([1, 2, 3])
    >>> f(I)
    False
    

Modifications and computations

pd.Index.copy

  • pandas.Index.copy(name=None, deep=False, dtype=None, names=None)

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Supported arguments

    • name

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.copy(name="new_name")
    
    >>> I = pd.Index([1,2,3], name = "origial_name")
    >>> f(I)
    Int64Index([1, 2, 3], dtype='int64', name='new_name')
    

pd.Index.get_loc

  • pandas.Index.get_loc(key, method=None, tolerance=None)

    Note

    Should be about as fast as standard python, maybe slightly slower.

    Unsupported Index Types

    • CategoricalIndex
    • MultiIndex
    • IntervalIndex

    Supported Arguments

    • key: must be of same type as the index

    Important

    • Only works for index with unique values (scalar return).
    • Only works with replicated Index

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.get_loc(2)
    
    >>> I = pd.Index([1,2,3])
    >>> f(I)
    1
    

pd.Index.take

  • pandas.Index.take(indices, axis=0, allow_fill=True, fill_value=None, **kwargs)

    Supported Arguments

    • indices: can be boolean Array like, integer Array like, or slice

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Important

    Bodo Does Not support kwargs, even for compatibility.

pd.Index.min

  • pandas.Index.min(axis=None, skipna=True, args, *kwargs)

    Supported Arguments: None

    Supported Index Types

    • NumericIndex
    • RangeIndex
    • CategoricalIndex
    • TimedeltaIndex
    • DatetimeIndex

    Important

    • Bodo Does Not support args and kwargs, even for compatibility.
    • For DatetimeIndex, will throw an error if all values in the index are null.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.min()
    
    >>> I = pd.Index(pd.date_range(start="2018-04-24", end="2018-04-25", periods=5))
    >>> f(I)
    2018-04-24 00:00:00
    

pd.Index.max

  • pandas.Index.max(axis=None, skipna=True, args, *kwargs)

    Supported Arguments: None

    Supported Index Types

    • NumericIndex
    • RangeIndex
    • CategoricalIndex
    • TimedeltaIndex
    • DatetimeIndex

    Important

    • Bodo Does Not support args and kwargs, even for compatibility.
    • For DatetimeIndex, will throw an error if all values in the index are null.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.min()
    
    >>> I = pd.Index(pd.date_range(start="2018-04-24", end="2018-04-25", periods=5))
    >>> f(I)
    2018-04-25 00:00:00
    

pd.Index.rename

  • pandas.Index.rename(name, inplace=False)

    Supported Arguments

    • name: label or list of labels

    Unsupported Index Types

    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I, name):
    ...   return I.rename(name)
    
    >>> I = pd.Index(["a", "b", "c"])
    >>> f(I, "new_name")
    Index(['a', 'b', 'c'], dtype='object', name='new_name')
    

pd.Index.duplicated

  • pandas.Index.duplicated(keep='first')

    Supported Arguments: None

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.duplicated()
    
    >>> idx = pd.Index(['a', 'b', None, 'a', 'c', None, 'd', 'b'])
    >>> f(idx)
    array([False, False, False,  True, False,  True, False,  True])
    

pd.Index.drop_duplicates

  • pandas.Index.drop_duplicates(keep='first')

    Supported Arguments: None

    Unsupported Index Types

    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.drop_duplicates()
    
    >>> I = pd.Index(["a", "b", "c", "a", "b", "c"])
    >>> f(I)
    Index(['a', 'b', 'c'], dtype='object')
    

pd.Index.isin

  • pandas.Index.isin(values)

    Supported Arguments

    • values: list-like or array-like of values

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex
    • PeriodIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.isin([0, 2, 4])
    
    >>> I = pd.Index([2, 4, 3, 4, 0, 3, 3, 5])
    >>> f(I)
    array([ True,  True, False,  True,  True, False, False, False])
    

pd.Index.unique

  • pandas.Index.unique()

    Unsupported Index Types

    • IntervalIndex
    • PeriodIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.unique()
    
    >>> I = pd.Index([1, 5, 2, 1, 0, 1, 5, 2, 1, 3])
    >>> f(I)
    Int64Index([1, 5, 2, 0, 3], dtype='int64')
    

pd.Index.nunique

  • pandas.Index.nunique(dropna=True)

    Supported Arguments:

    • dropna: can be True or False

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.nunique()
    
    >>> I = pd.Index([1, 5, 2, 1, 0, 1, 5, 2, 1])
    >>> f(I)
    4
    

pd.Index.sort_values

  • pandas.Index.sort_values(return_indexer=False, ascending=True, na_position="last", key=None)

    Supported Arguments:

    • ascending: can be True or False
    • na_position: can be "first" or "last"

    Unsupported Index Types

    • IntervalIndex
    • PeriodIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.sort_values()
    
    >>> I = pd.Index([0, -1, 1, -5, 8, -13, -2, 3])
    >>> f(I)
    Int64Index([-13, -5, -2, -1, 0, 1, 3, 8], dtype='int64')
    

pd.Index.argsort

  • pandas.Index.argsort(args, *kwargs)

    Supported Arguments: None

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.argsort()
    
    >>> I = pd.Index(["A", "L", "P", "H", "A"])
    >>> f(I)
    array([0, 4, 3, 1, 2])
    

pd.Index.all

  • pandas.Index.all(args, kwargs)

    ***Supported Arguments**
    : None

    Supported Index Types

    • NumericIndex (only Integers or Booleans)
    • RangeIndex
    • StringIndex
    • BinaryIndex

    !!! important Bodo diverges from the Pandas API for StringIndex and BinaryIndex by always returning a boolean instead of sometimes returning a string.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.all()
    
    >>> I = pd.Index([1, 4, 9, 0, 3])
    >>> f(I)
    False
    

pd.Index.any

  • pandas.Index.any(args, kwargs)

    ***Supported Arguments**
    : None

    Supported Index Types

    • NumericIndex (only Integers or Booleans)
    • RangeIndex
    • StringIndex
    • BinaryIndex

    !!! important Bodo diverges from the Pandas API for StringIndex and BinaryIndex by always returning a boolean instead of sometimes returning a string.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.any()
    
    >>> I = pd.Index([1, 4, 9, 0, 3])
    >>> f(I)
    True
    

pd.Index.argmax

  • pandas.Index.argmax(axis=None, skipna=True, args, kwargs)

    ***Supported Arguments**
    : None

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.argmax()
    
    >>> I = pd.Index([1, 4, 9, 0, 3])
    >>> f(I)
    2
    

pd.Index.argmin

  • pandas.Index.argmin(axis=None, skipna=True, args, kwargs)

    ***Supported Arguments**
    : None

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.argmin()
    
    >>> I = pd.Index([1, 4, 9, 0, 3])
    >>> f(I)
    3
    

pd.Index.where

  • pandas.Index.where(cond, other=None)

    Supported Arguments:

    • cond: can be a Series or 1-dim array of booleans
    • other: can be a scalar, non-categorical Series, 1-dim numpy array or StringArray with a matching type for the Index

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Important

    Only supported for CategoricalIndex if the elements of other are the same as (or a subset of) the categories of the CategoricalIndex.

    Example Usage

    >>> @bodo.jit
    ... def f(I, C, O):
    ...   return I.where(C, O)
    
    >>> I = pd.Index(["A", "B", "C", "D", "E"])
    >>> C = pd.array([True, False, True, True, False])
    >>> O = pd.Series(["a", "e", "i", "o", "u")
    >>> f(I, C, O)
    Index(['A', 'e', 'C', 'D', 'u'], dtype='object')
    

pd.Index.putmask

  • pandas.Index.putmask(cond, other=None)

    Supported Arguments:

    • cond: can be a Series or 1-dim array of booleans
    • other: can be a scalar, non-categorical Series, 1-dim numpy array or StringArray with a matching type for the Index

    Unsupported Index Types

    • IntervalIndex
    • MultiIndex

    Important

    Only supported for CategoricalIndex if the elements of other are the same as (or a subset of) the categories of the CategoricalIndex.

    Example Usage

    >>> @bodo.jit
    ... def f(I, C, O):
    ...   return I.putmask(C, O)
    
    >>> I = pd.Index(["A", "B", "C", "D", "E"])
    >>> C = pd.array([True, False, True, True, False])
    >>> O = pd.Series(["a", "e", "i", "o", "u")
    >>> f(I, C, O)
    Index(['a', 'B', 'i', 'o', 'E'], dtype='object')
    

pd.Index.union

  • pandas.Index.union(other, sort=None)

    Supported Arguments:

    • other: can be an Index, Series, or 1-dim numpy array with a matching type for the Index

    Supported Index Types

    • NumericIndex
    • StringIndex
    • BinaryIndex
    • RangeIndex
    • DatetimeIndex
    • TimedeltaIndex

    Important

    Bodo diverges from the Pandas API for Index.union() in several ways: duplicates are removed, the order of elements may be different, the shortcuts for returning the same Index are removed, and a NumericIndex is always returned instead of a RangeIndex.

    Example Usage

    >>> @bodo.jit(distributed=["I", "J"])
    ... def f(I, J):
    ...    return I.union(J)
    
    >>> I = pd.Index([1, 2, 3, 4, 5])
    >>> J = pd.Index([2, 4, 6, 8, 10, 12])
    >>> f(I, J)
    Int64Index([1, 2, 3, 4, 5, 6, 8, 10, 12], dtype='int64')
    

pd.Index.intersection

  • pandas.Index.intersection(other, sort=None)

    Supported Arguments:

    • other: can be an Index, Series, or 1-dim numpy array with a matching type for the Index

    Supported Index Types

    • NumericIndex
    • StringIndex
    • BinaryIndex
    • RangeIndex
    • DatetimeIndex
    • TimedeltaIndex

    Important

    Bodo diverges from the Pandas API for Index.intersection() in several ways: the default is sort=None, and a NumericIndex is always returned instead of a RangeIndex.

    Example Usage

    >>> @bodo.jit(distributed=["I", "J"])
    ... def f(I, J):
    ...    return I.intersection(J)
    
    >>> I = pd.Index([1, 2, 3, 4, 5])
    >>> J = pd.Index([2, 4, 6, 8, 10, 12])
    >>> f(I, J)
    Int64Index([2, 4], dtype='int64')
    

pd.Index.difference

  • pandas.Index.difference(other, sort=None)

    Supported Arguments:

    • other: can be an Index, Series, or 1-dim numpy array with a matching type for the Index

    Supported Index Types

    • NumericIndex
    • StringIndex
    • BinaryIndex
    • RangeIndex
    • DatetimeIndex
    • TimedeltaIndex

    Important

    Bodo diverges from the Pandas API for Index.difference() in several ways: the order of elements may be different and a NumericIndex is always returned instead of a RangeIndex.

    Example Usage

    >>> @bodo.jit(distributed=["I", "J"])
    ... def f(I, J):
    ...    return I.difference(J)
    
    >>> I = pd.Index([1, 2, 3, 4, 5])
    >>> J = pd.Index([2, 4, 6, 8, 10, 12])
    >>> f(I, J)
    Int64Index([1, 3, 5], dtype='int64')
    

pd.Index.symmetric_difference

  • pandas.Index.symmetric_difference(other, sort=None)

    Supported Arguments:

    • other: can be an Index, Series, or 1-dim numpy array with a matching type for the Index

    Supported Index Types

    • NumericIndex
    • StringIndex
    • BinaryIndex
    • RangeIndex
    • DatetimeIndex
    • TimedeltaIndex

    Important

    Bodo diverges from the Pandas API for Index.symmetric_difference() in several ways: the order of elements may be different and a NumericIndex is always returned instead of a RangeIndex.

    Example Usage

    >>> @bodo.jit(distributed=["I", "J"])
    ... def f(I, J):
    ...    return I.difference(J)
    
    >>> I = pd.Index([1, 2, 3, 4, 5])
    >>> J = pd.Index([2, 4, 6, 8, 10, 12])
    >>> f(I, J)
    Int64Index([1, 3, 5, 6, 8, 10, 12], dtype='int64')
    

pd.Index.repeat

  • pandas.Index.repeat(repeats, axis=None)

    Supported Arguments:

    • repeat: can be a non-negative integer or array of non-negative integers

    Supported Index Types

    • NumericIndex
    • StringIndex
    • RangeIndex
    • DatetimeIndex
    • TimedeltaIndex
    • CategoricalIndex

    Important

    If repeats is an integer array but its size is not the same as the length of I, undefined behavior may occur.

    Example Usage

    >>> @bodo.jit(distributed=["I"])
    ... def f(I):
    ...    return I.repeat(3)
    
    >>> I = pd.Index(["A", "B", "C"])
    >>> f(I)
    Index(['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C'], dtype='object')
    

Missing values

pd.Index.isna

  • pandas.Index.isna()

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.isna()
    
    >>> I = pd.Index([1,None,3])
    >>> f(I)
    [False  True False]
    

pd.Index.isnull

  • pandas.Index.isnull()

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.isnull()
    
    >>> I = pd.Index([1,None,3])
    >>> f(I)
    [False  True False]
    

Conversion

pd.Index.map

  • pandas.Index.map(mapper, na_action=None)

    Unsupported Index Types

    • MultiIndex
    • IntervalIndex

    Supported Arguments

    • mapper: must be a function, function cannot return tuple type

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.map(lambda x: x + 2)
    
    >>> I = pd.Index([1,None,3])
    >>> f(I)
    Float64Index([3.0, nan, 5.0], dtype='float64')
    

pd.Index.to_series

  • pandas.Index.to_series(index=None, name=None)

    Supported Arguments:

    • index: can be a Index, Series, 1-dim numpy array, list, or tuple
    • name: can be a string or int

    Unsupported Index Types

    • IntervalIndex
    • PeriodIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I, J):
    ...   return I.to_series(index=J)
    
    >>> I = pd.Index([1, 4, 9, 0, 3])
    >>> J = pd.Index(["A", "B", "C", "D", "E"])
    >>> f(I, J)
    A    1
    B    4
    C    9
    D    0
    E    3
    dtype: int64
    

pd.Index.to_frame

  • pandas.Index.to_frame(index=True, name=None)

    Supported Arguments:

    • index: can be a True or False
    • name: can be a string or int

    Unsupported Index Types

    • IntervalIndex
    • PeriodIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.to_frame(index=False)
    
    >>> I = pd.Index(["A", "E", "I", "O", "U", "Y"], name="vowels")
    >>> f(I)
      vowels
    0      A
    1      E
    2      I
    3      O
    4      U
    5      Y
    

pd.Index.to_numpy

  • pandas.Index.to_numpy(dtype=None, copy=True, na_value=None)

    Supported Arguments:

    • copy: can be a True or False

    Unsupported Index Types

    • PeriodIndex
    • MultiIndex

    Important

    Sometimes Bodo returns a Pandas array instead of a np.ndarray. Cases include a NumericIndex of integers containing nulls, or a CategoricalIndex.

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.numpy()
    
    >>> I = pd.Index([1, 9, -1, 3, 0, 1, 6])
    >>> f(I)
    [ 1  9 -1  3  0  1  6]
    

pd.Index.to_list

  • pandas.Index.to_list()

    Unsupported Index Types

    • PeriodIndex
    • IntervalIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.to_list()
    
    >>> I = pd.RangeIndex(5, -1, -1)
    >>> f(I)
    [5, 4, 3, 2, 1, 0]
    

pd.Index.tolist

  • pandas.Index.tolist()

    Unsupported Index Types

    • PeriodIndex
    • IntervalIndex
    • DatetimeIndex
    • TimedeltaIndex
    • MultiIndex

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.tolist()
    
    >>> I = pd.RangeIndex(5, -1, -1)
    >>> f(I)
    [5, 4, 3, 2, 1, 0]
    

Numeric Index

Numeric index objects RangeIndex, Int64Index, UInt64Index and Float64Index are supported as index to dataframes and series. Constructing them in Bodo functions, passing them to Bodo functions (unboxing), and returning them from Bodo functions (boxing) are also supported.

pd.RangeIndex

  • pandas.RangeIndex(start=None, stop=None, step=None, dtype=None, copy=False, name=None)

    Supported Arguments

    • start: integer
    • stop: integer
    • step: integer
    • name: String

    Example Usage

    >>> @bodo.jit
    ... def f():
    ...   return pd.RangeIndex(0, 10, 2)
    
    >>> f(I)
    RangeIndex(start=0, stop=10, step=2)
    

pd.Int64Index

  • pandas.Int64Index(data=None, dtype=None, copy=False, name=None)

    Example Usage
    >>> @bodo.jit
    ... def f():
    ... return pd.Int64Index(np.arange(3))
    
    >>> f()
    Int64Index([0, 1, 2], dtype='int64')
    

pd.UInt64Index

  • pandas.UInt64Index(data=None, dtype=None, copy=False, name=None)

    Example Usage
    >>> @bodo.jit
    ... def f():
    ... return pd.UInt64Index([1,2,3])
    
    >>> f()
    UInt64Index([0, 1, 2], dtype='uint64')
    

pd.Float64Index

  • pandas.Float64Index(data=None, dtype=None, copy=False, name=None)

    Supported Arguments

    • data: list or array
    • copy: Boolean
    • name: String

    Example Usage

    >>> @bodo.jit
    ... def f():
    ... return pd.Float64Index(np.arange(3))
    
    >>> f()
    Float64Index([0.0, 1.0, 2.0], dtype='float64')
    

DatetimeIndex

DatetimeIndex objects are supported. They can be constructed, boxed/unboxed, and set as index to dataframes and series.

pd.DateTimeIndex

  • pandas.DatetimeIndex

    Supported Arguments

    • data: array-like of datetime64, Integer, or strings

Date fields

pd.DateTimeIndex.year

  • pandas.DatetimeIndex.year

    Example Usage
    >>> @bodo.jit
    ... def f(I):
    ...   return I.year
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([2019, 2019, 2019, 2020, 2020], dtype='int64')
    

pd.DateTimeIndex.month

  • pandas.DatetimeIndex.month

    Example Usage
    >>> @bodo.jit
    ... def f(I):
    ...   return I.month
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([12, 12, 12, 1, 1], dtype='int64')
    

pd.DateTimeIndex.day

  • pandas.DatetimeIndex.day

    Example Usage
    >>> @bodo.jit
    ... def f(I):
    ...   return I.day
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([31, 31, 31, 1, 1], dtype='int64')
    

pd.DateTimeIndex.hour

  • pandas.DatetimeIndex.hour

    Example Usage
    >>> @bodo.jit
    ... def f(I):
    ...   return I.hour
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([2, 12, 22, 9, 19], dtype='int64')
    

pd.DateTimeIndex.minute

  • pandas.DatetimeIndex.minute

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.minute
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([32, 42, 52, 2, 12], dtype='int64')
    

pd.DateTimeIndex.second

  • pandas.DatetimeIndex.second

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.second
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([45, 35, 25, 15, 5], dtype='int64')
    

pd.DateTimeIndex.microsecond

  • pandas.DatetimeIndex.microsecond

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.microsecond
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 01:01:01", end="2019-12-31 01:01:02", periods=5))
    >>> f(I)
    Int64Index([0, 250000, 500000, 750000, 0], dtype='int64')
    

pd.DateTimeIndex.nanosecond

  • pandas.DatetimeIndex.nanosecond

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.nanosecond
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 01:01:01.0000001", end="2019-12-31 01:01:01.0000002", periods=5))
    >>> f(I)
    Int64Index([100, 125, 150, 175, 200], dtype='int64')
    

pd.DateTimeIndex.date

  • pandas.DatetimeIndex.date

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.date
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    [datetime.date(2019, 12, 31) datetime.date(2019, 12, 31) datetime.date(2019, 12, 31) datetime.date(2020, 1, 1) datetime.date(2020, 1, 1)]
    

pd.DateTimeIndex.dayofyear

  • pandas.DatetimeIndex.dayofyear

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.dayofyear
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([365, 365, 365, 1, 1], dtype='int64')
    

pd.DateTimeIndex.day_of_year

  • pandas.DatetimeIndex.day_of_year

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.day_of_year
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([365, 365, 365, 1, 1], dtype='int64')
    

pd.DateTimeIndex.dayofweek

  • pandas.DatetimeIndex.dayofweek

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.dayofweek
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 2, 2], dtype='int64')
    

pd.DateTimeIndex.day_of_week

  • pandas.DatetimeIndex.day_of_week

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.day_of_week
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 2, 2], dtype='int64')
    

pd.DateTimeIndex.is_leap_year

  • pandas.DatetimeIndex.is_leap_year

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_leap_year
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    [Flase False False True True]
    

pd.DateTimeIndex.is_month_start

  • pandas.DatetimeIndex.is_month_start

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_month_start
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([0, 0, 0, 1, 1], dtype='int64')
    

pd.DateTimeIndex.is_month_end

  • pandas.DatetimeIndex.is_month_end

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_month_end
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 0, 0], dtype='int64')
    

pd.DateTimeIndex.is_quarter_start

  • pandas.DatetimeIndex.is_quarter_start

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_quarter_start
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([0, 0, 0, 1, 1], dtype='int64')
    

pd.DateTimeIndex.is_quarter_end

  • pandas.DatetimeIndex.is_quarter_end

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_quarter_end
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 0, 0], dtype='int64')
    

pd.DateTimeIndex.is_year_start

  • pandas.DatetimeIndex.is_year_start

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_year_start
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([0, 0, 0, 1, 1], dtype='int64')
    

pd.DateTimeIndex.is_year_end

  • pandas.DatetimeIndex.is_year_end

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.is_year_end
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 0, 0], dtype='int64')
    

pd.DateTimeIndex.week

  • pandas.DatetimeIndex.week

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.week
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 1, 1], dtype='int64')
    

pd.DateTimeIndex.weekday

  • pandas.DatetimeIndex.weekday

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.weekday
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 2, 2], dtype='int64')
    

pd.DateTimeIndex.weekofyear

  • pandas.DatetimeIndex.weekofyear

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.weekofyear
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([1, 1, 1, 1,1], dtype='int64')
    

pd.DateTimeIndex.quarter

  • pandas.DatetimeIndex.quarter


    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.quarter
    
    >>> I = pd.DatetimeIndex(pd.date_range(start="2019-12-31 02:32:45", end="2020-01-01 19:12:05", periods=5))
    >>> f(I)
    Int64Index([4, 4, 4, 1, 1], dtype='int64')
    

Subtraction of Timestamp from DatetimeIndex and vice versa is supported.

Comparison operators ==, !=, >=, >, <=, < between DatetimeIndex and a string of datetime are supported.

TimedeltaIndex

TimedeltaIndex objects are supported. They can be constructed, boxed/unboxed, and set as index to dataframes and series.

pd.TimedeltaIndex

  • pandas.TimedeltaIndex(data=None, unit=None, freq=NoDefault.no_default, closed=None, dtype=dtype('<m8[ns]'), copy=False, name=None)

    Supported Arguments

    -data: must be array-like of timedelta64ns or Ingetger.

pd.TimedeltaIndex.days

  • pandas.TimedeltaIndex.days

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.days
    
    >>> I = pd.TimedeltaIndex([pd.Timedelta(3, unit="D"))])
    >>> f(I)
    Int64Index([3], dtype='int64')
    

pd.TimedeltaIndex.seconds

  • pandas.TimedeltaIndex.seconds

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.seconds
    
    >>> I = pd.TimedeltaIndex([pd.Timedelta(-2, unit="S"))])
    >>> f(I)
    Int64Index([-2], dtype='int64')
    

pd.TimedeltaIndex.microseconds

  • pandas.TimedeltaIndex.microseconds

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.microseconds
    
    >>> I = pd.TimedeltaIndex([pd.Timedelta(11, unit="micros"))])
    >>> f(I)
    Int64Index([11], dtype='int64')
    

pd.TimedeltaIndex.nanoseconds

  • pandas.TimedeltaIndex.nanoseconds

    Example Usage

    >>> @bodo.jit
    ... def f(I):
    ...   return I.nanoseconds
    
    >>> I = pd.TimedeltaIndex([pd.Timedelta(7, unit="nanos"))])
    >>> f(I)
    Int64Index([7], dtype='int64')
    

PeriodIndex

PeriodIndex objects can be boxed/unboxed and set as index to dataframes and series. Operations on them will be supported in upcoming releases.

BinaryIndex

BinaryIndex objects can be boxed/unboxed and set as index to dataframes and series. Operations on them will be supported in upcoming releases.

MultiIndex

pd.MultiIndex.from_product

  • pandas.MultiIndex.from_product

    (iterables and names supported as tuples, no parallel support yet)