
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
383 Views
Violin Plot in Seaborn is used to draw a combination of boxplot and kernel density estimate. The seaborn.violinplot() is used for this. Set explicit order using the order parameter of the violinplot().Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the ... Read More

AmitDiwan
12K+ Views
To read all excel files in a directory, use the Glob module and the read_excel() method.Let’s say the following are our excel files in a directory −Sales1.xlsxSales2.xlsxAt first, set the path where all the excel files are located. Get the excel files and read them using glob −path = "C:\Users\amit_\Desktop\" ... Read More

AmitDiwan
2K+ Views
To merge more than one CSV files into a single Pandas dataframe, use read_csv. At first, import the required Pandas library. Here. We have set pd as an alias −import pandas as pdNow, let’s say the following are our CSV Files −Sales1.csvSales2.csvWe have set the path as string. Both the ... Read More

AmitDiwan
2K+ Views
To stack a multi-level column, use the stack() method. At first, import the required library −import pandas as pdCreate a multi-level column −items = pd.MultiIndex.from_tuples([('Maths', 'Mental Maths'), ('Maths', 'Discrete Mathematics'), ('Maths', 'Applied Mathematics')]) Now, create a DataFrame and set multi-level columns we set above −dataFrame = pd.DataFrame([[67, 86, 78], ... Read More

AmitDiwan
1K+ Views
To create a subset and display only the last entry from duplicate values, use the “keep” parameter with the ‘last” value in drop_duplicates() method. The drop_duplicates() method removed duplicates.Let us first create a DataFrame with 3 columns −dataFrame = pd.DataFrame({'Car': ['BMW', 'Mercedes', 'Lamborghini', 'BMW', 'Mercedes', 'Porsche'], 'Place': ['Delhi', 'Hyderabad', 'Chandigarh', ... Read More

AmitDiwan
267 Views
To get the columns shared by two DataFrames, use the intersect1d() method. This method is provided by numpy, so you need to import Numpy also with Pandas. Let us first import the required libraries −import pandas as pd import numpy as npCreate two DataFrames −# creating dataframe1 dataFrame1 = pd.DataFrame({"Car": ... Read More

AmitDiwan
11K+ Views
To merge two Pandas DataFrame with common column, use the merge() function and set the ON parameter as the column name.At first, let us import the pandas library with an alias −import pandas as pdLet us create the 1st DataFrame −dataFrame1 = pd.DataFrame( { "Car": ['BMW', ... Read More

AmitDiwan
779 Views
To merge two Pandas DataFrame, use the merge() function. Just set both the DataFrames as a parameter of the merge() function.At first, let us import the required library with alias “pd” −import pandas as pdCreate the 1st DataFrame −# Create DataFrame1 dataFrame1 = pd.DataFrame( { "Car": ... Read More

AmitDiwan
1K+ Views
The iloc method is an integer-location based indexing for selection by position. We are using iloc to append a list to a DataFrame.Let us first create a DataFrame. The data is in the form of lists of team rankings for our example −# data in the form of list of ... Read More

AmitDiwan
5K+ Views
To add anew column with constant value, use the square bracket i.e. the index operator and set that value.At first, import the required library −import pandas as pdCreating a DataFrame with 4 columns −dataFrame = pd.DataFrame({"Car": ['Bentley', 'Lexus', 'BBMW', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, 3000], "Reg_Price": ... Read More