
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
391 Views
Use the astype() method in Pandas to convert one datatype to another. Import the required library −import pandas as pdCreate a DataFrame. Here, we have 2 columns, “Reg_Price” is a float type and “Units” int type −dataFrame = pd.DataFrame( { "Reg_Price": ... Read More

AmitDiwan
166 Views
When it is required to extract paired rows, a list comprehension and the ‘all’ operator is used.ExampleBelow is a demonstration of the samemy_list = [[10, 21, 34, 21, 37], [41, 41, 52, 68, 68, 41], [12, 29], [30, 30, 51, 51]] print("The list is :") print(my_list) my_result = ... Read More

AmitDiwan
282 Views
When it is required to get the replacement combination from the other list, the ‘combinations’ method and the ‘list’ method is used.ExampleBelow is a demonstration of the samefrom itertools import combinations my_list = [54, 98, 11] print("The list is :") print(my_list) replace_list = [8, 10] my_result ... Read More

AmitDiwan
165 Views
When it is required to sort the rows by frequency of ‘K’, a list comprehension and ‘Counter’ methods are used.ExampleBelow is a demonstration of the samefrom collections import Counter my_list = [34, 56, 78, 99, 99, 99, 99, 99, 12, 12, 32, 51, 15, 11, 0, 0] print ... Read More

AmitDiwan
6K+ Views
To center align column headers, use the display.colheader_justify and ‘center’ value. Import the require library −import pandas as pdCreate a DataFrame with 2 columns −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], ... Read More

AmitDiwan
147 Views
When it is required to find the selective consecutive suffix join, a simple iteration, the ‘endswith’ method and the ‘append’ method can be used.ExampleBelow is a demonstration of the samemy_list = ["Python-", "fun", "to-", "code"] print("The list is :") print(my_list) suffix = '-' print("The suffix is :") print(suffix) ... Read More

AmitDiwan
476 Views
When it is required to print the elements common at a specific index in a list of strings, a ‘min’ method, list comprehension and a Boolean flag value can be used.ExampleBelow is a demonstration of the samemy_list = ["week", "seek", "beek", "reek", 'meek', 'peek'] print("The list is :") print(my_list) ... Read More

AmitDiwan
632 Views
When it is required to print element with maximum vowels from a list, a list comprehension is used.ExampleBelow is a demonstration of the samemy_list = ["this", "week", "is", "going", "great"] print("The list is :") print(my_list) my_result = "" max_length = 0 for element in my_list: ... Read More

AmitDiwan
495 Views
To round number of places after the decimal, use the display.precision attribute of the Pandas.At first, import the required Pandas library −import pandas as pdCreate a DataFrame with 2 columns −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], ... Read More

AmitDiwan
522 Views
When it is required to find the string in a list, a simple ‘if’ condition along with ‘in’ operator can be used.ExampleBelow is a demonstration of the samemy_list = [4, 3.0, 'python', 'is', 'fun'] print("The list is :") print(my_list) key = 'fun' print("The key is :") print(key) print("The ... Read More