
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
Mode is the value that appears the most in a set of values. Use the fillna() method and set the mode to fill missing columns with mode. At first, let us import the required libraries with their respective aliases −import pandas as pd import numpy as npCreate a DataFrame with ... Read More

AmitDiwan
2K+ Views
We can search DataFrame for a specific value. Use iloc to fetch the required value and display the entire row. At first, import the required library −import pandas as pdCreate a DataFrame with 4 columns −dataFrame = pd.DataFrame({"Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, ... Read More

AmitDiwan
824 Views
The sort_index() is used to sort index in ascending and descending order. If you won’t mention any parameter, then index sorts in ascending order.At first, import the required library −import pandas as pdCreate a new DataFrame. It has unsorted indexes −dataFrame = pd.DataFrame([100, 150, 200, 250, 250, 500], index=[4, 8, ... Read More

AmitDiwan
317 Views
To add a prefix to all the column names, use the add_prefix() method. At first, import the required Pandas library −import pandas as pdCreate a DataFrame with 4 columns −dataFrame = pd.DataFrame({"Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, 3000], "Reg_Price": [7000, 1500, 5000, 8000, ... Read More

AmitDiwan
751 Views
To reverse the column order, use the dataframe.columns and set as -1 −dataFrame[dataFrame.columns[::-1]At first, import the required library −import pandas as pd Create a DataFrame with 4 columns −dataFrame = pd.DataFrame({"Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, 3000], "Reg_Price": [7000, 1500, 5000, 8000, 9000, ... Read More

AmitDiwan
1K+ Views
To remove a column with all null values, use the dropna() method and set the “how” parameter to “all” −how='all'At first, let us import the required libraries with their respective aliases −import pandas as pd import numpy as npCreate a DataFrame. We have set the NaN values using the Numpy ... Read More

AmitDiwan
182 Views
To fetch only capital words, we are using regex. The re module is used here and imported. Let us import all the libraries −import re import pandas as pdCreate a DataFrame −data = [['computer', 'mobile phone', 'ELECTRONICS', 'electronics'], ['KEYBOARD', 'charger', 'SMARTTV', 'camera']] dataFrame = pd.DataFrame(data)Now, extract capital words −for ... Read More

AmitDiwan
311 Views
Use the isin() method to display True for infinite values. At first, let us import the required libraries with their respective aliases −import pandas as pd import numpy as npCreate a dictionary of list. We have set the infinity values using the Numpy np.inf −d = { "Reg_Price": [7000.5057, np.inf, ... Read More

AmitDiwan
1K+ Views
To check and display row index, use the isinf() with any(). At first, let us import the required libraries with their respective aliases −import pandas as pd import numpy as npCreate a dictionary of list. We have set the infinity values using the Numpy np.inf −d = { "Reg_Price": [7000.5057, ... Read More

AmitDiwan
1K+ Views
To count the observations, first use the groupby() and then use count() on the result. At first, import the required library −dataFrame = pd.DataFrame({'Product Name': ['Keyboard', 'Charger', 'SmartTV', 'Camera', 'Graphic Card', 'Earphone'], 'Product Category': ['Computer', 'Mobile Phone', 'Electronics', 'Electronics', 'Computer', 'Mobile Phone'], 'Quantity': [10, 50, 10, 20, 25, 50]})Group the ... Read More