
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
290 Views
When it is required to compute the power by index element in a list, the simple iteration along with the ‘**’ operator is used.ExampleBelow is a demonstration of the samemy_list = [62, 18, 12, 63, 44, 75] print("The list is :") print(my_list) my_result = [] for my_index, ... Read More

AmitDiwan
527 Views
To Groupby value counts, use the groupby(), size() and unstack() methods of the Pandas DataFrame. At first, create a DataFrame with 3 columns −dataFrame = pd.DataFrame({ 'Product Category': ['Computer', 'Mobile Phone', 'Electronics', 'Electronics', 'Computer', 'Mobile Phone'], 'Product Name': ['Keyboard', 'Charger', 'SmartTV', 'Camera', 'Graphic Card', 'Earphone'], 'Quantity': [10, 50, 10, ... Read More

AmitDiwan
263 Views
When it is required to find the most common combination in a matrix, a simple iteration, along with the ‘sort’ method and ‘Counter’ method is used.ExampleBelow is a demonstration of the samefrom collections import Counter from itertools import combinations my_list = [[31, 25, 77, 82], [96, 15, 23, 32]] ... Read More

AmitDiwan
248 Views
When it is required to filter dictionaries by values in ‘K’th key in a list, a simple iteration by specifying the condition is used.ExampleBelow is a demonstration of the samemy_list = [{"Python": 2, "is": 4, "cool": 11}, {"Python": 5, "is": 1, "cool": 1}, {"Python": ... Read More

AmitDiwan
606 Views
When it is required to get all pairwise combinations from a list, an iteration along with the ‘append’ method is used.ExampleBelow is a demonstration of the samemy_list = [15, "John", 2, "Will", 53, 'Rob'] print("The list is :") print(my_list) my_result = [] for i in range(0, len(my_list)): ... Read More

AmitDiwan
1K+ Views
To calculate the count of column values, use the count() method. At first, import the required Pandas library −import pandas as pdCreate a DataFrame with two columns −dataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'], ... Read More

AmitDiwan
391 Views
When it is required to find unique values count of every key, an iteration along with the ‘append’ method is used.ExampleBelow is a demonstration of the samemy_list = [12, 33, 33, 54, 84, 16, 16, 16, 58] print("The list is :") print(my_list) filtered_list = [] elem_count = ... Read More

AmitDiwan
227 Views
When it is required to mark duplicate elements in a string, list comprehension along with the ‘count’ method is used.ExampleBelow is a demonstration of the samemy_list = ["python", "is", "fun", "python", "is", "fun", "python", "fun"] print("The list is :") print(my_list) my_result = [value + str(my_list[:index].count(value) + 1) if ... Read More

AmitDiwan
267 Views
When it is required to index directory of elements in a list, list comprehension along with ‘set’ operator is used.ExampleBelow is a demonstration of the samemy_list = [81, 36, 42, 57, 68, 12, 26, 26, 38] print("The list is :") print(my_list) my_result = {key: [index for index, value in ... Read More

AmitDiwan
215 Views
When it is required to convert a list to a customized overlapping nested list, an iteration along with the ‘append’ method can be used.ExampleBelow is a demonstration of the samemy_list = [31, 25, 36, 76, 73, 89, 91, 100] print("The list is :") print(my_list) my_step, my_size = 3, 4 ... Read More