
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
To check missing dates, at first, let us set a dictionary of list with date records i.e. Date of Purchase in our example −# dictionary of lists d = {'Car': ['BMW', 'Lexus', 'Audi', 'Mercedes', 'Jaguar', 'Bentley'], 'Date_of_purchase': ['2020-10-10', '2020-10-12', '2020-10-17', '2020-10-16', '2020-10-19', '2020-10-22']}Now, create a dataframe from the above ... Read More

AmitDiwan
2K+ Views
We will match words in the first DataFrame with words in the second DataFrame. For closest matches, we will use threshold. We took the value of threshold as 70 i.e., match occurs when the strings at more than 70% close to each other.Let us first create Dictionaries and convert to ... Read More

AmitDiwan
321 Views
Use the Series.value_counts() method to count frequency of itemsets. At first, let us create a DataFrame −# Create DataFrame dataFrame = pd.DataFrame({'Car': ['BMW', 'Mercedes', 'Lamborghini', 'Audi', 'Mercedes', 'Porsche', 'Lamborghini', 'BMW'], 'Place': ['Delhi', 'Hyderabad', 'Chandigarh', 'Bangalore', 'Hyderabad', 'Mumbai', 'Mumbai', 'Pune'], 'UnitsSold': [95, 80, 80, 75, ... Read More

AmitDiwan
6K+ Views
The insert() method is used to add a column from another DataFrame. At first, let us create our first DataFrame −dataFrame1 = pd.DataFrame({"Car": ["Audi", "Lamborghini", "BMW", "Lexus"], "Place": ["US", "UK", "India", "Australia"], "Units": [200, 500, 800, 1000]})Now, let us create our second DataFrame −dataFrame2 = pd.DataFrame({"Model": [2018, 2019, ... Read More

AmitDiwan
349 Views
Multiindex Data Frame is a data frame with more than one index. Let’s say the following is our csv stored on the Desktop −At first, import the pandas library and read the above CSV file −import pandas as pd df = pd.read_csv("C:/Users/amit_/Desktop/sales.csv") print(df)We will form the ‘Car‘ and ‘Place‘ ... Read More

AmitDiwan
4K+ Views
When it is required to find the most frequent character in a string, an empty dictionary is created, and the elements in the string are iterated over. When a character is found in the dictionary, it is increment, else it is assigned to 1. The maximum of the values in ... Read More

AmitDiwan
225 Views
When it is required to find the decreasing point in a list, a simple iteration and the ‘break’ statement are used.ExampleBelow is a demonstration of the same −my_list = [21, 62, 53, 94, 55, 66, 18, 1, 0] print("The list is :") print(my_list) my_result = -1 for index ... Read More

AmitDiwan
316 Views
When it is required to get the count of the unique values in a list of tuple, ‘defaultdict’, ‘set’ operator and the ‘append’ method are used.ExampleBelow is a demonstration of the same −from collections import defaultdict my_list = [(12, 32), (12, 21), (21, 32), (89, 21), (71, 21), (89, ... Read More

AmitDiwan
167 Views
When it is required to sort the list by rear character, a method is defined that uses negative indexing to return the result.ExampleBelow is a demonstration of the same −def get_rear_position(element): return element[-1] my_list = ['python', 'is', 'fun', 'to', 'learn'] print("The list is : ") print(my_list) ... Read More

AmitDiwan
147 Views
When it is required to sort a matrix by ‘None’ frequency, a method is defined that takes a parameter and uses list comprehension, ‘not’ operator and ‘len’ method to determine the result.ExampleBelow is a demonstration of the same −def get_None_freq(row): return len([element for element in row if not element]) ... Read More