
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
245 Views
To return a Series containing counts of unique values from Index object sorted in Ascending Order, use the index.value_counts() method with parameter ascending as True.At first, import the required libraries -import pandas as pdCreating Pandas index −index = pd.Index([50, 10, 70, 110, 90, 50, 110, 90, 30]) Display the Pandas ... Read More

AmitDiwan
317 Views
To return a Series containing counts of unique values from Index object, use the index.value_counts() method in Pandas.At first, import the required libraries -import pandas as pdCreating Pandas index −index = pd.Index([50, 10, 70, 110, 90, 50, 110, 90, 30]) Display the Pandas index −print("Pandas Index...", index)Count of unique values ... Read More

AmitDiwan
123 Views
To return number of unique elements in the Index object, use the index.nunique() method in Pandas. At first, import the required libraries −import pandas as pdCreating Pandas index −index = pd.Index([50, 10, 70, 110, 90, 50, 110, 90, 30]) Display the Pandas index −print("Pandas Index...", index)Get the number of unique ... Read More

AmitDiwan
4K+ Views
To return unique values in the index, use the index.unique() method in Pandas. At first, import the required libraries -import pandas as pdCreating Pandas index −index = pd.Index([10, 50, 70, 10, 90, 50, 10, 30]) Display the Pandas index −print("Pandas Index...", index)Get the unique values from the index. Unique values ... Read More

AmitDiwan
1K+ Views
To mask and replace NaNs with a specific value, use the index.putmask() method. Within that, set the index.isna() method.At first, import the required libraries -import pandas as pd import numpy as npCreating Pandas index with some NaNs −index = pd.Index([5, 65, 10, np.nan, 75, np.nan]) Display the Pandas index −print("Pandas ... Read More

AmitDiwan
392 Views
To return a new Index of the values set with the mask, use the index.putmask() method in Pandas. At first, import the required libraries −import pandas as pdCreating Pandas index −index = pd.Index([5, 65, 10, 17, 75, 40]) Display the Pandas index −print("Pandas Index...", index)Mask and place index values less ... Read More

AmitDiwan
131 Views
To return a new Index of the values selected by the indices, use the index.take() method in Pandas. At first, import the required libraries -import pandas as pdCreating Pandas index −index = pd.Index(['Electronics', 'Accessories', 'Decor', 'Books', 'Toys'], name ='Products') Display the Pandas index −print("Pandas Index...", index)Getting a new index of ... Read More

AmitDiwan
257 Views
To replace index values where the condition is False, use the index.isin() method in Pandas. At first, import the required libraries −import pandas as pdCreating Pandas index −index = pd.Index(['Electronics', 'Accessories', 'Decor', 'Books', 'Toys'], name ='Products') Display the Pandas index −print("Pandas Index...", index)Replace values where condition is False. Here, except ... Read More

AmitDiwan
172 Views
To repeat each element of a Pandas Series in a dissimilar way, use the index.repeat() method. At first, import the required libraries -import pandas as pdCreating Pandas index −index = pd.Index(['Car', 'Bike', 'Airplane', 'Ship'], name ='Transport') Display the Pandas index −print("Pandas Index...", index)Repeat each element of the index in a ... Read More

AmitDiwan
507 Views
To repeat elements of an Index, use the index.repeat() method in Pandas. Set the number of repetitions as an argument. At first, import the required libraries −import pandas as pdCreating Pandas index −index = pd.Index(['Car', 'Bike', 'Airplane', 'Ship', 'Truck', 'Suburban'], name ='Transport') Display the Pandas index −print("Pandas Index...", index)Repeat elements ... Read More