Index[source]

class pandas.Index [source] Immutable ndarray implementing an ordered, sliceable set. The basic object storing axis labels for all pandas objects Parameters: data : array-like (1-dimensional) dtype : NumPy dtype (default: object) copy : bool Make a copy of input ndarray name : object Name to be stored in the index tupleize_cols : bool (default: True) When True, attempt to create a MultiIndex if possible Notes An Index instance can only contain hashable objects Attributes T return th

Indexing and Selecting Data

The axis labeling information in pandas objects serves many purposes: Identifies data (i.e. provides metadata) using known indicators, important for analysis, visualization, and interactive console display Enables automatic and explicit data alignment Allows intuitive getting and setting of subsets of the data set In this section, we will focus on the final point: namely, how to slice, dice, and generally get and set subsets of pandas objects. The primary focus will be on Series and DataFra

Index.where()

Index.where(cond, other=None) [source] New in version 0.19.0. Return an Index of same shape as self and whose corresponding entries are from self where cond is True and otherwise are from other. Parameters: cond : boolean same length as self other : scalar, or array-like

Index.view()

Index.view(cls=None) [source]

Index.value_counts()

Index.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True) [source] Returns object 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: normalize : boolean, default False If True then the object returned will contain the relative frequencies of the unique values. sort : boolean, default True Sort by values ascending

Index.values

Index.values return the underlying data as an ndarray

Index.unique()

Index.unique() [source] Return Index of unique values in the object. Significantly faster than numpy.unique. Includes NA values. The order of the original is preserved. Returns: uniques : Index

Index.union()

Index.union(other) [source] Form the union of two Index objects and sorts if possible. Parameters: other : Index or array-like Returns: union : Index Examples >>> idx1 = pd.Index([1, 2, 3, 4]) >>> idx2 = pd.Index([3, 4, 5, 6]) >>> idx1.union(idx2) Int64Index([1, 2, 3, 4, 5, 6], dtype='int64')

Index.transpose()

Index.transpose(*args, **kwargs) [source] return the transpose, which is by definition self

Index.to_series()

Index.to_series(**kwargs) [source] Create a Series with both index and values equal to the index keys useful with map for returning an indexer based on an index Returns: Series : dtype will be based on the type of the Index values.