
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
2K+ Views
When it is required to get all the unique keys from a list of dictionary, the dictionary values are iterated over and converted into a set. This is converted to a list and displayed on the console.ExampleBelow is a demonstration of the samemy_list = [{'hi' : 11, 'there' : 28}, ... Read More

AmitDiwan
214 Views
When it is required to print all the distinct uncommon digits that are present in two numbers, a method is defined that takes two integers as parameters. The method ‘symmetric_difference’ is used to get the uncommon digits.ExampleBelow is a demonstration of the samedef distinct_uncommon_nums(val_1, val_2): val_1 ... Read More

AmitDiwan
2K+ Views
To fetch columns between two DataFrames by Intersection, use the intersection() method. Let us create two DataFrames −# creating dataframe1 dataFrame1 = pd.DataFrame({"Car": ['Bentley', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, 3000], "Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000], }) # creating dataframe2 dataFrame2 = ... Read More

AmitDiwan
202 Views
When it is required to get ‘K’ length groups with a given summation, an empty list, the ‘product’ method, the ‘sum’ method and the ‘append’ method can be used.ExampleBelow is a demonstration of the samefrom itertools import product my_list = [45, 32, 67, 11, 88, 90, 87, 33, 45, ... Read More

AmitDiwan
287 Views
When it is required to split the joined consecutive characters that are similar in nature, the ‘groupby’ method and the ‘join’ method are used.ExampleBelow is a demonstration of the samefrom itertools import groupby my_string = 'pppyyytthhhhhhhoooooonnn' print("The string is :") print(my_string) my_result = ["".join(grp) for elem, grp in ... Read More

AmitDiwan
658 Views
When it is required to determine the index rank of elements in a data structure, a method is defined that takes a list as a parameter. It iteeates over the elements in the list, and performs certain comparisons before changing the values of two variables.ExampleBelow is a demonstration of the ... Read More

AmitDiwan
812 Views
To append a list to a DataFrame using append(), let us first create a DataFrame. The data is in the form of lists of team rankings for our example − # data in the form of list of team rankings Team = [['India', 1, 100], ['Australia', 2, 85], ['England', 3, ... Read More

AmitDiwan
136 Views
When it is required to remove non-increasing elements, a simple iteration is used along with comparison of elements.ExampleBelow is a demonstration of the samemy_list = [5, 23, 45, 11, 45, 67, 89, 99, 10, 26, 7, 11] print("The list is :") print(my_list) my_result = [my_list[0]] for elem in ... Read More

AmitDiwan
274 Views
When it is required to get the consecutive ranges of ‘K’ which are greater than ‘N’, the ‘enumerate’ attribute and simple iteration is used.ExampleBelow is a demonstration of the samemy_list = [3, 65, 33, 23, 65, 65, 65, 65, 65, 65, 65, 3, 65] print("The list is :") print(my_list) K ... Read More

AmitDiwan
483 Views
To stack a single-level column, use the datafrem.stack(). At first, let us import the required library −import pandas as pdCreate a DataFrame with single-level column −dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35], [40, 45]], index=['w', 'x', 'y', 'z'], columns=['a', 'b'])Stack the DataFrame using the stack() method −dataFrame.stack() ExampleFollowing is ... Read More