
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
4K+ Views
Use the get_dummies() method to convert categorical DataFrame to binary data. Following is our Pandas DataFrame with 2 columns −dataFrame = pd.DataFrame( { "Student": ['Jack', 'Robin', 'Ted', 'Scarlett', 'Kat'], "Result": ['Pass', 'Fail', 'Fail', 'Pass', 'Pass'] } )Use the get_dummies() and set the column ... Read More

AmitDiwan
281 Views
We can use the rename() method to rename column names. Let’s say the following is our Pandas DataFrame with 3 columns −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000], "Units": [90, 120, 100, 150, 200, 130] ... Read More

AmitDiwan
1K+ Views
When it is required to limit the values to keys in a list of dictionary, the keys are accessed and the ‘min’ and ‘max’ methods are used to limit the values.ExampleBelow is a demonstration of the samemy_list = [{"python": 4, "is": 7, "best": 10}, {"python": 2, "is": 5, "best": 9}, ... Read More

AmitDiwan
534 Views
We can easily rename a column by index i.e. without using rename(). Import the required library −import pandas as pdCreate a DataFrame with 3 columns −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000], "Units": [90, 120, ... Read More

AmitDiwan
410 Views
When it is required to find the distance between the first and last even elements of a list, list elements are accessed using indexing and the difference is found.ExampleBelow is a demonstration of the samemy_list = [2, 3, 6, 4, 6, 2, 9, 1, 14, 11] print("The list is ... Read More

AmitDiwan
482 Views
When it is required to filter the rows that contains only alphabets in a list of lists, the list is iterated over and the ‘isalpha’ method is used to check if an alphabet is present or not.ExampleBelow is a demonstration of the samemy_list = [["python", "is", "best"], ["abc123", "good"], ["abc ... Read More

AmitDiwan
284 Views
When it is required to find the sum of the length of string at specific indices, the ‘enumerate’ is used to iterate through the elements in the list and adding the length of the element to a list.ExampleBelow is a demonstration of the samemy_list = ["python", "is", "best", "for", "coders"] ... Read More

AmitDiwan
565 Views
When it is required to test if the elements are in the min/max range, the list elements are iterated over, and are checked to see if it is equal to ‘max’ value.ExampleBelow is a demonstration of the samemy_list = [5, 6, 4, 7, 8, 13, 15] print("The list is : ... Read More

AmitDiwan
791 Views
When it is required to find the mean deviation of the elements of a list, the ‘sum’ method and the ‘len’ method is used.ExampleBelow is a demonstration of the samemy_list = [3, 5, 7, 10, 12] print("The list is :") print(my_list) my_mean = sum(my_list) / len(my_list) my_variance = ... Read More

AmitDiwan
310 Views
To find rolling mean, we will use the apply() function in Pandas. At first, let us import the required library −import pandas as pdCreate a DataFrame with 2 columns. One is an int column −dataFrame = pd.DataFrame( { "Car": ['Tesla', 'Mercedes', 'Tesla', 'Mustang', 'Mercedes', 'Mustang'], ... Read More