Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to remove duplicate values of a variable using python?

Description

To remove duplicate values in a variable by using python.

Process

  Read the sample data.

  Import necessary packages.

  Create data frame.

  Remove the duplicate by using df.drop_duplicates().

Sample Code

#import library functions

import pandas as pd

#Read the data set

data=pd.read_csv(‘/home/soft27/soft27

/Sathish/Pythonfiles/Employee.csv’)

#create data frame

df=pd.DataFrame(data)

print(“Original data frame\n”)

print(df)

#Remove duplicate

rem_dup=df.drop_duplicates([‘name’])

print(“After removing duplicate\n”)

print(rem_dup)

Screenshots
remove duplicate values of a variable using python
import pandas as pd