class pandas.Index
[source]
Immutable ndarray implementing an ordered, sliceable set. The basic object storing axis labels for all pandas objects
Parameters: |
dtype : NumPy dtype (default: object) If dtype is None, we find the dtype that best fits the data. If an actual dtype is provided, we coerce to that dtype if it’s safe. Otherwise, an error will be raised. 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 |
---|
See also
RangeIndex
CategoricalIndex
Categorical
s.MultiIndex
IntervalIndex
Interval
s.DatetimeIndex
, TimedeltaIndex
, PeriodIndex
, Int64Index
, UInt64Index
, Float64Index
An Index instance can only contain hashable objects
>>> pd.Index([1, 2, 3]) Int64Index([1, 2, 3], dtype='int64')
>>> pd.Index(list('abc')) Index(['a', 'b', 'c'], dtype='object')
T | return the transpose, which is by definition self |
base | return the base object if the memory of the underlying data is shared |
data | return the data pointer of the underlying data |
dtype | return the dtype object of the underlying data |
dtype_str | return the dtype str of the underlying data |
flags | |
hasnans | return if I have any nans; enables various perf speedups |
inferred_type | return a string of the type inferred from the values |
is_monotonic | alias for is_monotonic_increasing (deprecated) |
is_monotonic_decreasing | return if the index is monotonic decreasing (only equal or decreasing) values. |
is_monotonic_increasing | return if the index is monotonic increasing (only equal or increasing) values. |
is_unique | return if the index has unique values |
itemsize | return the size of the dtype of the item of the underlying data |
nbytes | return the number of bytes in the underlying data |
ndim | return the number of dimensions of the underlying data, by definition 1 |
shape | return a tuple of the shape of the underlying data |
size | return the number of elements in the underlying data |
strides | return the strides of the underlying data |
values | return the underlying data as an ndarray |
asi8 | |
empty | |
has_duplicates | |
is_all_dates | |
name | |
names | |
nlevels |
all (*args, **kwargs) | Return whether all elements are True. |
any (*args, **kwargs) | Return whether any element is True. |
append (other) | Append a collection of Index options together |
argmax ([axis]) | return a ndarray of the maximum argument indexer |
argmin ([axis]) | return a ndarray of the minimum argument indexer |
argsort (*args, **kwargs) | Return the integer indicies that would sort the index. |
asof (label) | For a sorted index, return the most recent label up to and including the passed label. |
asof_locs (where, mask) | where : array of timestamps mask : array of booleans where data is not NA |
astype (dtype[, copy]) | Create an Index with values cast to dtypes. |
contains (key) | return a boolean if this key is IN the index |
copy ([name, deep, dtype]) | Make a copy of this object. |
delete (loc) | Make new Index with passed location(-s) deleted |
difference (other) | Return a new Index with elements from the index that are not in other . |
drop (labels[, errors]) | Make new Index with passed list of labels deleted |
drop_duplicates ([keep]) | Return Index with duplicate values removed. |
dropna ([how]) | Return Index without NA/NaN values |
duplicated ([keep]) | Indicate duplicate index values. |
equals (other) | Determines if two Index objects contain the same elements. |
factorize ([sort, na_sentinel]) | Encode the object as an enumerated type or categorical variable. |
fillna ([value, downcast]) | Fill NA/NaN values with the specified value |
format ([name, formatter]) | Render a string representation of the Index |
get_duplicates () | (DEPRECATED) Extract duplicated index elements. |
get_indexer (target[, method, limit, tolerance]) | Compute indexer and mask for new index given the current index. |
get_indexer_for (target, **kwargs) | guaranteed return of an indexer even when non-unique This dispatches to get_indexer or get_indexer_nonunique as appropriate |
get_indexer_non_unique (target) | Compute indexer and mask for new index given the current index. |
get_level_values (level) | Return an Index of values for requested level, equal to the length of the index. |
get_loc (key[, method, tolerance]) | Get integer location, slice or boolean mask for requested label. |
get_slice_bound (label, side, kind) | Calculate slice bound that corresponds to given label. |
get_value (series, key) | Fast lookup of value from 1-dimensional ndarray. |
get_values () | Return Index data as an numpy.ndarray . |
groupby (values) | Group the index labels by a given array of values. |
identical (other) | Similar to equals, but check that other comparable attributes are also equal |
insert (loc, item) | Make new Index inserting new item at location. |
intersection (other) | Form the intersection of two Index objects. |
is_ (other) | More flexible, faster check like is but that works through views |
is_categorical () | Check if the Index holds categorical data. |
isin (values[, level]) | Return a boolean array where the index values are in values . |
isna () | Detect missing values. |
isnull () | Detect missing values. |
item () | return the first element of the underlying data as a python scalar |
join (other[, how, level, return_indexers, sort]) | this is an internal non-public method |
map (mapper[, na_action]) | Map values using input correspondence (a dict, Series, or function). |
max () | Return the maximum value of the Index. |
memory_usage ([deep]) | Memory usage of the values |
min () | Return the minimum value of the Index. |
notna () | Detect existing (non-missing) values. |
notnull () | Detect existing (non-missing) values. |
nunique ([dropna]) | Return number of unique elements in the object. |
putmask (mask, value) | return a new Index of the values set with the mask |
ravel ([order]) | return an ndarray of the flattened values of the underlying data |
reindex (target[, method, level, limit, …]) | Create index with target’s values (move/add/delete values as necessary) |
rename (name[, inplace]) | Set new names on index. |
repeat (repeats, *args, **kwargs) | Repeat elements of an Index. |
searchsorted (value[, side, sorter]) | Find indices where elements should be inserted to maintain order. |
set_names (names[, level, inplace]) | Set new names on index. |
set_value (arr, key, value) | Fast lookup of value from 1-dimensional ndarray. |
shift ([periods, freq]) | Shift index by desired number of time frequency increments. |
slice_indexer ([start, end, step, kind]) | For an ordered or unique index, compute the slice indexer for input labels and step. |
slice_locs ([start, end, step, kind]) | Compute slice locations for input labels. |
sort_values ([return_indexer, ascending]) | Return a sorted copy of the index. |
sortlevel ([level, ascending, sort_remaining]) | For internal compatibility with with the Index API |
str | alias of pandas.core.strings.StringMethods
|
summary ([name]) | (DEPRECATED) Return a summarized representation .. |
symmetric_difference (other[, result_name]) | Compute the symmetric difference of two Index objects. |
take (indices[, axis, allow_fill, fill_value]) | return a new Index of the values selected by the indices |
to_frame ([index]) | Create a DataFrame with a column containing the Index. |
to_native_types ([slicer]) | Format specified values of self and return them. |
to_series ([index, name]) | Create a Series with both index and values equal to the index keys useful with map for returning an indexer based on an index |
tolist () | Return a list of the values. |
transpose (*args, **kwargs) | return the transpose, which is by definition self |
union (other) | Form the union of two Index objects and sorts if possible. |
unique ([level]) | Return unique values in the index. |
value_counts ([normalize, sort, ascending, …]) | Returns object containing counts of unique values. |
where (cond[, other]) |
New in version 0.19.0. |
holds_integer | |
is_boolean | |
is_floating | |
is_integer | |
is_interval | |
is_lexsorted_for_tuple | |
is_mixed | |
is_numeric | |
is_object | |
is_type_compatible | |
sort | |
view |
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.Index.html