pandas.Index¶
- class pandas.Index¶
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
Notes
An Index instance can only contain hashable objects
Attributes
T Same as self.transpose(), except that self is returned if self.ndim < 2. base Base object if memory is from some other object. ctypes An object to simplify the interaction of the array with the ctypes module. data Python buffer object pointing to the start of the array’s data. flags flat A 1-D iterator over the array. imag The imaginary part of the array. is_monotonic itemsize Length of one array element in bytes. names nbytes Total bytes consumed by the elements of the array. ndim Number of array dimensions. nlevels real The real part of the array. shape Tuple of array dimensions. size Number of elements in the array. strides Tuple of bytes to step in each dimension when traversing an array. values asi8 dtype inferred_type is_all_dates is_unique name Methods
all([axis, out]) Returns True if all elements evaluate to True. any([axis, out]) Returns True if any of the elements of a evaluate to True. append(other) Append a collection of Index options together argmax([axis, out]) Return indices of the maximum values along the given axis. argmin([axis, out]) Return indices of the minimum values along the given axis of a. argsort(*args, **kwargs) See docstring for ndarray.argsort 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 astype(dtype) byteswap(inplace) Swap the bytes of the array elements choose(choices[, out, mode]) Use an index array to construct a new array from a set of choices. clip(a_min, a_max[, out]) Return an array whose values are limited to [a_min, a_max]. compress(condition[, axis, out]) Return selected slices of this array along given axis. conj() Complex-conjugate all elements. conjugate() Return the complex conjugate, element-wise. copy([names, name, dtype, deep]) Make a copy of this object. cumprod([axis, dtype, out]) Return the cumulative product of the elements along the given axis. cumsum([axis, dtype, out]) Return the cumulative sum of the elements along the given axis. delete(loc) Make new Index with passed location deleted diagonal([offset, axis1, axis2]) Return specified diagonals. diff(other) Compute sorted set difference of two Index objects dot(b[, out]) Dot product of two arrays. drop(labels) Make new Index with passed list of labels deleted dump(file) Dump a pickle of the array to the specified file. dumps() Returns the pickle of the array as a string. equals(other) Determines if two Index objects contain the same elements. fill(*args, **kwargs) This method will not function because object is immutable. flatten([order]) Return a copy of the array collapsed into one dimension. format([name, formatter]) Render a string representation of the Index get_duplicates() get_indexer(target[, method, limit]) Compute indexer and mask for new index given the current index. get_indexer_non_unique(target, **kwargs) return an indexer suitable for taking from a non unique index get_level_values(level) Return vector of label values for requested level, equal to the length get_loc(key) Get integer location for requested label get_value(series, key) Fast lookup of value from 1-dimensional ndarray. get_values() getfield(dtype[, offset]) Returns a field of the given array as a certain type. groupby(to_groupby) holds_integer() identical(other) Similar to equals, but check that other comparable attributes are insert(loc, item) Make new Index inserting new item at location intersection(other) Form the intersection of two Index objects. Sortedness of the result is is_(other) More flexible, faster check like is but that works through views is_floating() is_integer() is_lexsorted_for_tuple(tup) is_mixed() is_numeric() is_type_compatible(typ) isin(values) Compute boolean array of whether each index value is found in the item(*args) Copy an element of an array to a standard Python scalar and return it. itemset(*args, **kwargs) This method will not function because object is immutable. join(other[, how, level, return_indexers]) Internal API method. Compute join_index and indexers to conform data map(mapper) max([axis, out]) Return the maximum along a given axis. mean([axis, dtype, out]) Returns the average of the array elements along given axis. min([axis, out]) Return the minimum along a given axis. newbyteorder([new_order]) Return the array with the same data viewed with a different byte order. nonzero() Return the indices of the elements that are non-zero. order([return_indexer, ascending]) Return sorted copy of Index prod([axis, dtype, out]) Return the product of the array elements over the given axis ptp([axis, out]) Peak to peak (maximum - minimum) value along a given axis. put(*args, **kwargs) This method will not function because object is immutable. ravel([order]) Return a flattened array. reindex(target[, method, level, limit, ...]) For Index, simply returns the new index and the results of rename(name[, inplace]) Set new names on index. repeat(repeats[, axis]) Repeat elements of an array. reshape(shape[, order]) Returns an array containing the same data with a new shape. resize(new_shape[, refcheck]) Change shape and size of array in-place. round([decimals, out]) Return a with each element rounded to the given number of decimals. searchsorted(v[, side, sorter]) Find indices where elements of v should be inserted in a to maintain order. set_names(names[, inplace]) Set new names on index. set_value(arr, key, value) Fast lookup of value from 1-dimensional ndarray. setfield(val, dtype[, offset]) Put a value into a specified place in a field defined by a data-type. setflags([write, align, uic]) Set array flags WRITEABLE, ALIGNED, and UPDATEIFCOPY, respectively. shift([periods, freq]) Shift Index containing datetime objects by input number of periods and slice_indexer([start, end, step]) For an ordered Index, compute the slice indexer for input labels and slice_locs([start, end]) For an ordered Index, compute the slice locations for input labels sort(*args, **kwargs) squeeze([axis]) Remove single-dimensional entries from the shape of a. std([axis, dtype, out, ddof]) Returns the standard deviation of the array elements along given axis. sum([axis, dtype, out]) Return the sum of the array elements over the given axis. summary([name]) swapaxes(axis1, axis2) Return a view of the array with axis1 and axis2 interchanged. take(indexer[, axis]) Analogous to ndarray.take to_datetime([dayfirst]) For an Index containing strings or datetime.datetime objects, attempt to_native_types([slicer]) slice and dice then format to_series() return a series with both index and values equal to the index keys tofile(fid[, sep, format]) Write array to a file as text or binary (default). tolist() Overridden version of ndarray.tolist tostring([order]) Construct a Python string containing the raw data bytes in the array. trace([offset, axis1, axis2, dtype, out]) Return the sum along diagonals of the array. transpose(*axes) Returns a view of the array with axes transposed. union(other) Form the union of two Index objects and sorts if possible unique() Return array of unique values in the Index. Significantly faster than var([axis, dtype, out, ddof]) Returns the variance of the array elements, along given axis. view(*args, **kwargs)