Class Index (0.11.0)

Index(data: bigframes.core.blocks.BlockHolder)

Immutable sequence used for indexing and alignment.

The basic object storing axis labels for all objects.

Properties

T

Return the transpose, which is by definition self.

dtype

Return the dtype object of the underlying data.

dtypes

Return the dtypes as a Series for the underlying MultiIndex.

empty

Returns True if the Index is empty, otherwise returns False.

has_duplicates

Check if the Index has duplicate values.

is_monotonic_decreasing

Return a boolean if the values are equal or decreasing.

is_monotonic_increasing

Return a boolean if the values are equal or increasing.

is_unique

Return if the index has unique values.

name

Returns Index name.

names

Returns the names of the Index.

ndim

API documentation for ndim property.

nlevels

Number of levels.

shape

Return a tuple of the shape of the underlying data.

size

Returns the size of the Index.

values

Return an array representing the data in the Index.

Methods

all

all() -> bool

Return whether all elements are Truthy.

Returns
TypeDescription
boolA single element array-like may be converted to bool.

any

any() -> bool

Return whether any element is Truthy.

Returns
TypeDescription
boolA single element array-like may be converted to bool.

argmax

argmax() -> int

Return int position of the largest value in the Series.

If the maximum is achieved in multiple locations, the first row position is returned.

Returns
TypeDescription
intRow position of the maximum value.

argmin

argmin() -> int

Return int position of the smallest value in the Series.

If the minimum is achieved in multiple locations, the first row position is returned.

Returns
TypeDescription
intRow position of the minimum value.

astype

astype(
    dtype: typing.Union[
        typing.Literal[
            "boolean",
            "Float64",
            "Int64",
            "string",
            "string[pyarrow]",
            "timestamp[us, tz=UTC][pyarrow]",
            "timestamp[us][pyarrow]",
            "date32[day][pyarrow]",
            "time64[us][pyarrow]",
        ],
        pandas.core.arrays.boolean.BooleanDtype,
        pandas.core.arrays.floating.Float64Dtype,
        pandas.core.arrays.integer.Int64Dtype,
        pandas.core.arrays.string_.StringDtype,
        pandas.core.dtypes.dtypes.ArrowDtype,
    ]
) -> bigframes.core.indexes.index.Index

Create an Index with values cast to dtypes.

The class of a new Index is determined by dtype. When conversion is impossible, a TypeError exception is raised.

Returns
TypeDescription
IndexIndex with values cast to specified dtype.

drop

drop(labels: typing.Any) -> bigframes.core.indexes.index.Index

Make new Index with passed list of labels deleted.

Returns
TypeDescription
IndexWill be same type as self

drop_duplicates

drop_duplicates(*, keep: str = "first") -> bigframes.core.indexes.index.Index

Return Index with duplicate values removed.

Parameter
NameDescription
keep {'first', 'last', False}, default 'first'

One of: 'first' : Drop duplicates except for the first occurrence. 'last' : Drop duplicates except for the last occurrence. False : Drop all duplicates.

dropna

dropna(how: str = "any") -> bigframes.core.indexes.index.Index

Return Index without NA/NaN values.

Parameter
NameDescription
how {'any', 'all'}, default 'any'

If the Index is a MultiIndex, drop the value when any or all levels are NaN.

fillna

fillna(value=None) -> bigframes.core.indexes.index.Index

Fill NA/NaN values with the specified value.

Parameter
NameDescription
value scalar

Scalar value to use to fill holes (e.g. 0). This value cannot be a list-likes.

isin

isin(values) -> bigframes.core.indexes.index.Index

Return a boolean array where the index values are in values.

Compute boolean array of whether each index value is found in the passed set of values. The length of the returned boolean array matches the length of the index.

Parameter
NameDescription
values set or list-like

Sought values.

Returns
TypeDescription
SeriesSeries of boolean values.

max

max() -> typing.Any

Return the maximum value of the Index.

Returns
TypeDescription
scalarMaximum value.

min

min() -> typing.Any

Return the minimum value of the Index.

Returns
TypeDescription
scalarMinimum value.

nunique

nunique() -> int

Return number of unique elements in the object.

Excludes NA values by default.

rename

rename(
    name: typing.Union[str, typing.Sequence[str]]
) -> bigframes.core.indexes.index.Index

Alter Index or MultiIndex name.

Able to set new names without level. Defaults to returning new index. Length of names must match number of levels in MultiIndex.

Parameter
NameDescription
name label or list of labels

Name(s) to set.

Returns
TypeDescription
IndexThe same type as the caller.

sort_values

sort_values(*, ascending: bool = True, na_position: str = "last")

Return a sorted copy of the index.

Return a sorted copy of the index, and optionally return the indices that sorted the index itself.

Parameters
NameDescription
ascending bool, default True

Should the index values be sorted in an ascending order.

na_position {'first' or 'last'}, default 'last'

Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at the end.

Returns
TypeDescription
pandas.IndexSorted copy of the index.

to_numpy

to_numpy(dtype=None, **kwargs) -> numpy.ndarray

A NumPy ndarray representing the values in this Series or Index.

to_pandas

to_pandas() -> pandas.core.indexes.base.Index

Gets the Index as a pandas Index.

Returns
TypeDescription
pandas.IndexA pandas Index with all of the labels from this Index.

transpose

transpose() -> bigframes.core.indexes.index.Index

Return the transpose, which is by definition self.

value_counts

value_counts(
    normalize: bool = False,
    sort: bool = True,
    ascending: bool = False,
    *,
    dropna: bool = True
)

Return a Series containing counts of unique values.

The resulting object will be in descending order so that the first element is the most frequently-occurring element. Excludes NA values by default.

Parameters
NameDescription
normalize bool, default False

If True then the object returned will contain the relative frequencies of the unique values.

sort bool, default True

Sort by frequencies.

ascending bool, default False

Sort in ascending order.

dropna bool, default True

Don't include counts of NaN.