
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
924 Views
To append rows to a DataFrame, use the append() method. Here, we will create two DataFrames and append one after the another.At first, import the pandas library with an alias −import pandas as pdNow, create the 1st DataFramedataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Jaguar'] } )Create ... Read More

AmitDiwan
494 Views
To create a subset of DataFrame by column name, use the square brackets. Use the DataFrame with square brackets (indexing operator) and the specific column name like this −dataFrame[‘column_name’]At first, import the required library with alias −import pandas as pdCreate a Pandas DataFrame with Product records −dataFrame = pd.DataFrame({"Product": ["SmartTV", ... Read More

AmitDiwan
698 Views
The equals() function is used to check if two dataframes are exactly same. At first, let us create DataFrame1 with two columns −dataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley', 'Jaguar'], "Units": [100, ... Read More

AmitDiwan
789 Views
To find the difference between two DataFrame, you need to check for its equality. Also, check the equality of columns.Let us create DataFrame1 with two columns −dataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley', 'Jaguar'], ... Read More

AmitDiwan
289 Views
To create a subset of columns, we can use filter(). Through this, we can filter column values with similar pattern using like operator. At first, let us create a DataFrame with 3 columns −dataFrame = pd.DataFrame({"Product": ["SmartTV", "ChromeCast", "Speaker", "Earphone"], "Opening_Stock": [300, 700, 1200, 1500], "Closing_Stock": [200, 500, 1000, 900]})Now, ... Read More

AmitDiwan
115 Views
When it is required to construct equi-digit tuples, the ‘//’ operator and the list slicing is used.ExampleBelow is a demonstration of the samemy_list = [5613, 1223, 966143, 890, 65, 10221] print("The list is :") print(my_list) my_result = [] for sub in my_list: mid_index = ... Read More

AmitDiwan
194 Views
When it is required to omit K length rows, a simple iteration and the ‘len’ method along with ‘append’ method are used.ExampleBelow is a demonstration of the samemy_list = [[41, 7], [8, 10, 12, 8], [10, 11], [6, 82, 10]] print("The list is :") print(my_list) my_k = 2 ... Read More

AmitDiwan
111 Views
When it is required to extract rows with common difference elements, an iteration and a flag value is used.ExampleBelow is a demonstration of the samemy_list = [[31, 27, 10], [8, 11, 12], [11, 12, 13], [6, 9, 10]] print("The list is :") print(my_list) my_result = [] for ... Read More

AmitDiwan
319 Views
When it is required to compute a polynomial equation, a simple iteration along with the ‘*’ operator is used.ExampleBelow is a demonstration of the samemy_list = [3, -6, 3, -1, 23, -11, 0, -8] print("The list is :") print(my_list) x = 3 my_list_length = len(my_list) my_result = 0 ... Read More

AmitDiwan
314 Views
When it is required to test if a tuple list contains a single element, a flag value and a simple iteration is used.ExampleBelow is a demonstration of the samemy_list = [(72, 72, 72), (72, 72), (72, 72)] print("The list is :") print(my_list) my_result = True for sub in ... Read More