
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
352 Views
When it is required to flatten a nested list into a tuple list, a method is defined that takes a list as a parameter, and uses the ‘isinstance’ method to check if an element belongs to a specific type. Depending on this, the output is displayed.ExampleBelow is a demonstration of ... Read More

AmitDiwan
777 Views
We will be using the iat attribute to access the last element, since it is used to access a single value for a row/column pair by integer position.Let us first import the required Pandas library −import pandas as pdCreate a Pandas series with numbers −data = pd.Series([10, 20, 5, 65, ... Read More

AmitDiwan
234 Views
When it is required to create a nested list containing values as the count of list elements, a simple iteration is used.ExampleBelow is a demonstration of the samemy_list = [11, 25, 36, 24] print("The list is :") print(my_list) for element in range(len(my_list)): my_list[element] = [element+1 for j ... Read More

AmitDiwan
220 Views
When it is required to count the frequency of the matrix row length, it is iterated over and its frequency is added to the empty dictionary or incremented if found again.ExampleBelow is a demonstration of the samemy_list = [[42, 24, 11], [67, 18], [20], [54, 10, 25], [45, 99]] ... Read More

AmitDiwan
160 Views
When it is required to get the character repetitions of a given character, a method is defined that uses the index value to print the repetitions.ExampleBelow is a demonstration of the samedef to_string(my_list): return ''.join(my_list) def lex_recurrence(my_string, my_data, last_val, index_val): length = len(my_string) ... Read More

AmitDiwan
217 Views
When it is required to group the contiguous elements of a string that are present in a list, a method is defined that uses ‘groupby’, and ‘yield’.ExampleBelow is a demonstration of the samefrom itertools import groupby def string_check(elem): return isinstance(elem, str) def group_string(my_list): ... Read More

AmitDiwan
152 Views
To get the datatypes of columns, use the info() method. Let us first import the required library −import pandas as pdCreate a DataFrame with 2 columns having different datatypes −dataFrame = pd.DataFrame( { "Student": ['Jack', 'Robin', 'Ted', 'Marc', 'Scarlett', 'Kat', 'John'], "Roll Number": [ 5, 10, ... Read More

AmitDiwan
198 Views
To select columns with specific datatypes, use the select_dtypes() method and the include parameter. At first, create a DataFrame with 2 columns −dataFrame = pd.DataFrame( { "Student": ['Jack', 'Robin', 'Ted', 'Marc', 'Scarlett', 'Kat', 'John'], "Roll Number": [ 5, 10, 3, 8, 2, 9, 6] ... Read More

AmitDiwan
2K+ Views
To add a zero column to a Pandas DataFrame, use the square bracket and set it to 0. At first, import te required library −import pandas as pdCreate a DataFrame with 3 columns −dataFrame = pd.DataFrame( { "Student": ['Jack', 'Robin', 'Ted', 'Marc', 'Scarlett', 'Kat', 'John'], "Result": ... Read More

AmitDiwan
313 Views
When it is required to find the element frequencies in the percentage range, the ‘Counter’ is used along with a simple iteration technique.ExampleBelow is a demonstration of the samefrom collections import Counter my_list = [56, 34, 78, 90, 11, 23, 6, 56, 79, 90] print("The list is :") ... Read More