
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Pandas - Return if the index is monotonic decreasing (only equal or decreasing) values
To return if the index is monotonic decreasing (only equal or decreasing) values, use the index.is_monotonic_decreasing property.
At first, import the required libraries −
import pandas as pd
Creating the index −
index = pd.Index([50, 40, 30, 30, 30])
Display the index −
print("Pandas Index...\n",index)
Check if the index monotonic decreasing −
print("\nIs the Pandas index monotonic decreasing?\n",index.is_monotonic_decreasing)
Example
Following is the code −
import pandas as pd # Creating the index index = pd.Index([50, 40, 30, 30, 30]) # Display the index print("Pandas Index...\n",index) # Return an array representing the data in the Index print("\nArray...\n",index.values) # Check if the index monotonic decreasing print("\nIs the Pandas index monotonic decreasing?\n",index.is_monotonic_decreasing)
Output
This will produce the following code −
Pandas Index... Int64Index([50, 40, 30, 30, 30], dtype='int64') Array... [50 40 30 30 30] Is the Pandas index monotonic decreasing? True
- Related Articles
- Python Pandas - Return if the index is monotonic increasing (only equal or increasing) values
- Python Pandas - Return unique values in the index
- Python Pandas - Return Index without NaN values
- Python Pandas - Return a list of the Index values
- Python Pandas - Return Index with duplicate values removed
- Python Pandas - Return the memory usage of the Index values
- Strictly increasing or decreasing array - JavaScript
- Python Pandas - Return Index with duplicate values completely removed
- Non-decreasing Array in Python
- Python Pandas - Return the label from the index or if not present, the previous one
- Python - Check if the Pandas Index only consists of booleans
- Python - Check if the Pandas Index only consists of integers
- Python Pandas - Check if the index has unique values
- Python Pandas - Check if the index has duplicate values
- Python Pandas - Determine if two Index objects are equal

Advertisements