Index objects#
Index#
Many of these methods or variants thereof are available on the objects that contain an index (Series/DataFrame) and those should most likely be used before calling these methods directly.
|
Immutable sequence used for indexing and alignment. |
Properties#
Return an array representing the data in the Index. |
|
Return a boolean if the values are equal or increasing. |
|
Return a boolean if the values are equal or decreasing. |
|
Return if the index has unique values. |
|
Check if the Index has duplicate values. |
|
Return True if there are any NaNs. |
|
Return the dtype object of the underlying data. |
|
Return a string of the type inferred from the values. |
|
Return a tuple of the shape of the underlying data. |
|
Return Index or MultiIndex name. |
|
Get names on index. |
|
Return the number of bytes in the underlying data. |
|
Number of dimensions of the underlying data, by definition 1. |
|
Return the number of elements in the underlying data. |
|
Indicator whether Index is empty. |
|
Return the transpose, which is by definition self. |
|
|
Memory usage of the values. |
The ExtensionArray of the data backing this Series or Index. |
Modifying and computations#
|
Return whether all elements are Truthy. |
|
Return whether any element is Truthy. |
|
Return int position of the smallest value in the Series. |
|
Return int position of the largest value in the Series. |
|
Make a copy of this object. |
|
Make new Index with passed location(-s) deleted. |
|
Make new Index with passed list of labels deleted. |
|
Return Index with duplicate values removed. |
|
Indicate duplicate index values. |
|
Determine if two Index object are equal. |
|
Encode the object as an enumerated type or categorical variable. |
|
Similar to equals, but checks that object attributes and types are also equal. |
|
Make new Index inserting new item at location. |
|
More flexible, faster check like |
|
Return the minimum value of the Index. |
|
Return the maximum value of the Index. |
|
Create index with target's values. |
|
Alter Index or MultiIndex name. |
|
Repeat elements of a Index. |
|
Replace values where the condition is False. |
|
Return a new Index of the values selected by the indices. |
|
Return a new Index of the values set with the mask. |
|
Return unique values in the index. |
|
Return number of unique elements in the object. |
|
Return a Series containing counts of unique values. |
Compatibility with MultiIndex#
|
Set Index or MultiIndex name. |
|
Return index with requested level(s) removed. |
Missing values#
|
Fill NA/NaN values with the specified value. |
|
Return Index without NA/NaN values. |
Detect missing values. |
|
Detect existing (non-missing) values. |
Conversion#
|
Create an Index with values cast to dtypes. |
Return the first element of the underlying data as a Python scalar. |
|
|
Map values using an input mapping or function. |
|
Return a view on self. |
Return a list of the values. |
|
|
Create a Series with both index and values equal to the index keys. |
|
Create a DataFrame with a column containing the Index. |
|
A NumPy ndarray representing the values in this Series or Index. |
|
Return a view of the Index with the specified dtype or a new Index instance. |
Sorting#
|
Return the integer indices that would sort the index. |
|
Find indices where elements should be inserted to maintain order. |
|
Return a sorted copy of the index. |
Time-specific operations#
|
Shift index by desired number of time frequency increments. |
Combining / joining / set operations#
|
Append a collection of Index options together. |
|
Compute join_index and indexers to conform data structures to the new index. |
|
Form the intersection of two Index objects. |
|
Form the union of two Index objects. |
|
Return a new Index with elements of index not in other. |
|
Compute the symmetric difference of two Index objects. |
Selecting#
|
Return the label from the index, or, if not present, the previous one. |
|
Return the locations (indices) of labels in the index. |
|
Compute indexer and mask for new index given the current index. |
|
Guaranteed return of an indexer even when non-unique. |
|
Compute indexer and mask for new index given the current index. |
|
Return an Index of values for requested level. |
|
Get integer location, slice or boolean mask for requested label. |
|
Calculate slice bound that corresponds to given label. |
|
Return a boolean array where the index values are in values. |
|
Compute the slice indexer for input labels and step. |
|
Compute slice locations for input labels. |
Numeric Index#
|
Immutable Index implementing a monotonic integer range. |
The value of the start parameter ( |
|
The value of the stop parameter. |
|
The value of the step parameter ( |
|
|
Create |
CategoricalIndex#
|
Index based on an underlying |
Categorical components#
The category codes of this categorical index. |
|
The categories of this categorical. |
|
Whether the categories have an ordered relationship. |
|
Rename categories. |
|
|
Reorder categories as specified in new_categories. |
|
Add new categories. |
|
Remove the specified categories. |
Remove categories which are not used. |
|
|
Set the categories to the specified new categories. |
Set the Categorical to be ordered. |
|
Set the Categorical to be unordered. |
Modifying and computations#
|
Map values using input an input mapping or function. |
|
Determine if two CategoricalIndex objects contain the same elements. |
IntervalIndex#
|
Immutable index of intervals that are closed on the same side. |
IntervalIndex components#
|
Construct from two arrays defining the left and right bounds. |
|
Construct an IntervalIndex from an array-like of tuples. |
|
Construct an IntervalIndex from an array of splits. |
Return left bounds of the intervals in the IntervalIndex. |
|
Return right bounds of the intervals in the IntervalIndex. |
|
Return the midpoint of each interval in the IntervalIndex as an Index. |
|
String describing the inclusive side the intervals. |
|
Calculate the length of each interval in the IntervalIndex. |
|
Return an array representing the data in the Index. |
|
Indicates if an interval is empty, meaning it contains no points. |
|
Return a boolean whether the IntervalArray/IntervalIndex is non-overlapping and monotonic. |
|
Return True if the IntervalIndex has overlapping intervals, else False. |
|
Get integer location, slice or boolean mask for requested label. |
|
|
Compute indexer and mask for new index given the current index. |
|
Return an identical IntervalArray closed on the specified side. |
|
Check elementwise if the Intervals contain the value. |
|
Check elementwise if an Interval overlaps the values in the IntervalArray. |
|
Return an ndarray (if self is IntervalArray) or Index (if self is IntervalIndex) of tuples of the form (left, right). |
MultiIndex#
|
A multi-level, or hierarchical, index object for pandas objects. |
MultiIndex constructors#
|
Convert arrays to MultiIndex. |
|
Convert list of tuples to MultiIndex. |
|
Make a MultiIndex from the cartesian product of multiple iterables. |
|
Make a MultiIndex from a DataFrame. |
MultiIndex properties#
Names of levels in MultiIndex. |
|
Levels of the MultiIndex. |
|
Codes of the MultiIndex. |
|
Integer number of levels in this MultiIndex. |
|
A tuple with the length of each level. |
|
Return the dtypes as a Series for the underlying MultiIndex. |
MultiIndex components#
|
Set new levels on MultiIndex. |
|
Set new codes on MultiIndex. |
Convert a MultiIndex to an Index of Tuples containing the level values. |
|
|
Create a DataFrame with the levels of the MultiIndex as columns. |
|
Sort MultiIndex at the requested level. |
|
Return index with requested level(s) removed. |
|
Swap level i with level j. |
|
Rearrange levels using input order. |
Create new MultiIndex from current that removes unused levels. |
|
|
Make a new |
|
Make a copy of this object. |
|
Append a collection of Index options together. |
|
Slice index between two labels / tuples, return new MultiIndex. |
MultiIndex selecting#
|
Get location for a label or a tuple of labels. |
|
Get location for a sequence of labels. |
|
Get location and sliced index for requested label(s)/level(s). |
|
Compute indexer and mask for new index given the current index. |
|
Return vector of label values for requested level. |
Create an object to more easily perform multi-index slicing. |
DatetimeIndex#
|
Immutable ndarray-like of datetime64 data. |
Time/date components#
The year of the datetime. |
|
The month as January=1, December=12. |
|
The day of the datetime. |
|
The hours of the datetime. |
|
The minutes of the datetime. |
|
The seconds of the datetime. |
|
The microseconds of the datetime. |
|
The nanoseconds of the datetime. |
|
Returns numpy array of python |
|
Returns numpy array of |
|
Returns numpy array of |
|
The ordinal day of the year. |
|
The ordinal day of the year. |
|
The day of the week with Monday=0, Sunday=6. |
|
The day of the week with Monday=0, Sunday=6. |
|
The day of the week with Monday=0, Sunday=6. |
|
The quarter of the date. |
|
Return the timezone. |
|
Return the frequency object if it is set, otherwise None. |
|
Return the frequency object as a string if it's set, otherwise None. |
|
Indicates whether the date is the first day of the month. |
|
Indicates whether the date is the last day of the month. |
|
Indicator for whether the date is the first day of a quarter. |
|
Indicator for whether the date is the last day of a quarter. |
|
Indicate whether the date is the first day of a year. |
|
Indicate whether the date is the last day of the year. |
|
Boolean indicator if the date belongs to a leap year. |
|
Tries to return a string representing a frequency generated by infer_freq. |
Selecting#
|
Return index locations of values at particular time of day. |
|
Return index locations of values between particular times of day. |
Time-specific operations#
Convert times to midnight. |
|
|
Convert to Index using specified date_format. |
|
Snap time stamps to nearest occurring frequency. |
Convert tz-aware Datetime Array/Index from one time zone to another. |
|
|
Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index. |
|
Perform round operation on the data to the specified freq. |
|
Perform floor operation on the data to the specified freq. |
|
Perform ceil operation on the data to the specified freq. |
|
Return the month names with specified locale. |
|
Return the day names with specified locale. |
Conversion#
|
Convert to a dtype with the given unit resolution. |
|
Cast to PeriodArray/PeriodIndex at a particular frequency. |
Return an ndarray of |
|
|
Create a Series with both index and values equal to the index keys. |
|
Create a DataFrame with a column containing the Index. |
Methods#
|
Return the mean value of the Array. |
|
Return sample standard deviation over requested axis. |
TimedeltaIndex#
|
Immutable Index of timedelta64 data. |
Components#
Number of days for each element. |
|
Number of seconds (>= 0 and less than 1 day) for each element. |
|
Number of microseconds (>= 0 and less than 1 second) for each element. |
|
Number of nanoseconds (>= 0 and less than 1 microsecond) for each element. |
|
Return a DataFrame of the individual resolution components of the Timedeltas. |
|
Tries to return a string representing a frequency generated by infer_freq. |
Conversion#
|
Convert to a dtype with the given unit resolution. |
Return an ndarray of datetime.timedelta objects. |
|
|
Create a Series with both index and values equal to the index keys. |
|
Perform round operation on the data to the specified freq. |
|
Perform floor operation on the data to the specified freq. |
|
Perform ceil operation on the data to the specified freq. |
|
Create a DataFrame with a column containing the Index. |
Methods#
|
Return the mean value of the Array. |
PeriodIndex#
|
Immutable ndarray holding ordinal values indicating regular periods in time. |
Properties#
The days of the period. |
|
The day of the week with Monday=0, Sunday=6. |
|
The day of the week with Monday=0, Sunday=6. |
|
The ordinal day of the year. |
|
The ordinal day of the year. |
|
The number of days in the month. |
|
The number of days in the month. |
|
Get the Timestamp for the end of the period. |
|
Return the frequency object if it is set, otherwise None. |
|
Return the frequency object as a string if it's set, otherwise None. |
|
The hour of the period. |
|
Logical indicating if the date belongs to a leap year. |
|
The minute of the period. |
|
The month as January=1, December=12. |
|
The quarter of the date. |
|
The second of the period. |
|
Get the Timestamp for the start of the period. |
|
The week ordinal of the year. |
|
The day of the week with Monday=0, Sunday=6. |
|
The week ordinal of the year. |
|
The year of the period. |
Methods#
|
Convert the PeriodArray to the specified frequency freq. |
|
Convert to Index using specified date_format. |
|
Cast to DatetimeArray/Index. |
|
Construct a PeriodIndex from fields (year, month, day, etc.). |
|
Construct a PeriodIndex from ordinals. |