Index objects

Index

All supported Index APIs

Constructor

Index([data, dtype, copy, name, ...])

Properties

Index.values

Return an array representing the data in the Index.

Index.is_monotonic_increasing

Return a boolean if the values are equal or increasing.

Index.is_monotonic_decreasing

Return a boolean if the values are equal or decreasing.

Index.is_unique

Return if the index has unique values.

Index.has_duplicates

Check if the Index has duplicate values.

Index.dtype

Get the dtype object of the underlying data.

Index.shape

Get a tuple of the shape of the underlying data.

Index.name

Get the index name.

Index.names

Get names of index

Index.ndim

Number of dimensions of the underlying data, by definition 1.

Index.size

Get the number of elements in the underlying data.

Index.empty

Whether the index is empty.

Index.T

Return the transpose, which is by definition self.

Index.nlevels

Number of levels.

Index.array

return the array of values

Index.str

Vectorized string functions for Series and Index.

Snowflake Specific

Index.to_pandas(*[, statement_params])

Convert Snowpark pandas Index to pandas Index.

Modifying and computations

Index.all(*args, **kwargs)

Return whether all elements are Truthy.

Index.any(*args, **kwargs)

Return whether any element is Truthy.

Index.argmin([axis, skipna])

Return int position of the smallest value in the Series.

Index.argmax([axis, skipna])

Return int position of the largest value in the Series.

Index.copy([name, deep])

Make a copy of this object.

Index.equals(other)

Determine if two Index objects are equal.

Index.identical(other)

Similar to equals, but checks that object attributes and types are also equal.

Index.is_boolean()

Check if the Index only consists of booleans.

Index.is_floating()

Check if the Index is a floating type.

Index.is_integer()

Check if the Index only consists of integers.

Index.is_numeric()

Check if the Index only consists of numeric data.

Index.is_object()

Check if the Index is of the object dtype.

Index.item()

Return the first element of the underlying data as a Python scalar.

Index.min([axis, skipna])

Return the minimum value of the Index.

Index.max([axis, skipna])

Return the maximum value of the Index.

Index.reindex(target[, method, level, ...])

Create index with target's values.

Index.rename(name[, inplace])

Alter Index or MultiIndex name.

Index.unique([level])

Return unique values in the index.

Index.nunique([dropna])

Return number of unique elements in the object.

Index.value_counts([normalize, sort, ...])

Return a Series containing counts of unique values.

Compatibility with MultiIndex

Index.set_names(names[, level, inplace])

Set Index name.

Conversion

Index.astype(dtype[, copy])

Create an Index with values cast to dtypes.

Index.item()

Return the first element of the underlying data as a Python scalar.

Index.to_list()

Return a list of the values.

Index.tolist()

Return a list of the values.

Index.to_series([index, name])

Create a Series with both index and values equal to the index keys.

Index.to_frame([index, name])

Create a DataFrame with a column containing the Index.

Sorting

Index.sort_values([return_indexer, ...])

Return a sorted copy of the index.

DatetimeIndex

DatetimeIndex([data, freq, tz, normalize, ...])

DatetimeIndex Time/date components

DatetimeIndex.year

The year of the datetime.

DatetimeIndex.month

The month as January=1, December=12.

DatetimeIndex.day

The day of the datetime.

DatetimeIndex.hour

The hours of the datetime.

DatetimeIndex.minute

The minutes of the datetime.

DatetimeIndex.second

The seconds of the datetime.

DatetimeIndex.microsecond

The microseconds of the datetime.

DatetimeIndex.nanosecond

The nanoseconds of the datetime.

DatetimeIndex.date

Returns the date part of Timestamps without time and timezone information.

DatetimeIndex.time

Returns the time part of the Timestamps.

DatetimeIndex.timetz

Returns the time part of the Timestamps with timezone.

DatetimeIndex.dayofyear

The ordinal day of the year.

DatetimeIndex.day_of_year

The ordinal day of the year.

DatetimeIndex.dayofweek

The day of the week with Monday=0, Sunday=6.

DatetimeIndex.day_of_week

The day of the week with Monday=0, Sunday=6.

DatetimeIndex.weekday

The day of the week with Monday=0, Sunday=6.

DatetimeIndex.quarter

The quarter of the date.

DatetimeIndex.tz

Return the timezone.

DatetimeIndex.freq

Return the frequency object if it's set, otherwise None.

DatetimeIndex.freqstr

Return the frequency object as a string if it's set, otherwise None.

DatetimeIndex.is_month_start

Indicates whether the date is the first day of the month.

DatetimeIndex.is_month_end

Indicates whether the date is the last day of the month.

DatetimeIndex.is_quarter_start

Indicator for whether the date is the first day of a quarter.

DatetimeIndex.is_quarter_end

Indicator for whether the date is the last day of a quarter.

DatetimeIndex.is_year_start

Indicate whether the date is the first day of a year.

DatetimeIndex.is_year_end

Indicate whether the date is the last day of the year.

DatetimeIndex.is_leap_year

Boolean indicator if the date belongs to a leap year.

DatetimeIndex.inferred_freq

Tries to return a string representing a frequency generated by infer_freq.

DatetimeIndex Selecting

DatetimeIndex.indexer_at_time(time[, asof])

Return index locations of values at particular time of day.

DatetimeIndex.indexer_between_time(...[, ...])

Return index locations of values between particular times of day.

DatetimeIndex Time-specific operations

DatetimeIndex.normalize()

Convert times to midnight.

DatetimeIndex.strftime(date_format)

Convert to Index using specified date_format.

DatetimeIndex.snap([freq])

Snap time stamps to nearest occurring frequency.

DatetimeIndex.tz_convert(tz)

Convert tz-aware Datetime Array/Index from one time zone to another.

DatetimeIndex.tz_localize(tz[, ambiguous, ...])

Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index.

DatetimeIndex.round(freq[, ambiguous, ...])

Perform round operation on the data to the specified freq.

DatetimeIndex.floor(freq[, ambiguous, ...])

Perform floor operation on the data to the specified freq.

DatetimeIndex.ceil(freq[, ambiguous, ...])

Perform ceil operation on the data to the specified freq.

DatetimeIndex.month_name([locale])

Return the month names with specified locale.

DatetimeIndex.day_name([locale])

Return the day names with specified locale.

DatetimeIndex Conversion

DatetimeIndex.as_unit(unit)

Convert to a dtype with the given unit resolution.

DatetimeIndex.to_period([freq])

Cast to PeriodArray/PeriodIndex at a particular frequency.

DatetimeIndex.to_pydatetime()

Return a ndarray of datetime.datetime objects.

DatetimeIndex.to_series([index, name])

Create a Series with both index and values equal to the index keys.

DatetimeIndex.to_frame([index, name])

Create a DataFrame with a column containing the Index.

DatetimeIndex Methods

DatetimeIndex.mean(*[, skipna, axis])

Return the mean value of the Array.

DatetimeIndex.std([axis, ddof, skipna])

Return sample standard deviation over requested axis.

TimedeltaIndex

TimedeltaIndex([data, unit, freq, dtype, ...])

TimedeltaIndex Components

TimedeltaIndex.days

Number of days for each element.

TimedeltaIndex.seconds

Number of seconds (>= 0 and less than 1 day) for each element.

TimedeltaIndex.microseconds

Number of microseconds (>= 0 and less than 1 second) for each element.

TimedeltaIndex.nanoseconds

Number of nonoseconds (>= 0 and less than 1 microsecond) for each element.

TimedeltaIndex.components

Return a DataFrame of the individual resolution components of the Timedeltas.

TimedeltaIndex.inferred_freq

Tries to return a string representing a frequency generated by infer_freq.

TimedeltaIndex Conversion

TimedeltaIndex.as_unit(unit)

Convert to a dtype with the given unit resolution.

TimedeltaIndex.to_pytimedelta()

Return an ndarray of datetime.timedelta objects.

TimedeltaIndex.round(freq)

Perform round operation on the data to the specified freq.

TimedeltaIndex.floor(freq)

Perform floor operation on the data to the specified freq.

TimedeltaIndex.ceil(freq)

Perform ceil operation on the data to the specified freq.

TimedeltaIndex Methods

TimedeltaIndex.mean(*[, skipna, axis])

Return the mean value of the Timedelta values.