Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dataframe delete duplicate rows with same column value

df = df.drop_duplicates(subset=['Column1', 'Column2'], keep='first')

# Exemple
import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
Comment

dataframe delete duplicate rows with same column value

df = df.drop_duplicates(subset=['Column1', 'Column2'], keep='first')

# Exemple
import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
Comment

drop row with duplicate value

import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
Comment

PREVIOUS NEXT
Code Example
Python :: python requests-session for websites with login 
Python :: multiprocessing pool pass additional arguments 
Python :: decrypt vnc password 
Python :: floating point python 
Python :: random.choices in python 
Python :: flask url_for 
Python :: python schedule task every hour 
Python :: is coumn exist then delete in datafrmae 
Python :: python logo png 
Python :: how to check if a variable in python is a specific data type 
Python :: sqlite operational error no such column 
Python :: python csv reader cast to float 
Python :: Python write value in next row of existing .text file 
Python :: how to change todays date formate in python 
Python :: how to input n space separated integers in python 
Python :: Python IDLE Shell Run Command 
Python :: migrations.rename_field django 
Python :: pip install opencv 
Python :: how to remove some characters from a string in python 
Python :: hash python png 
Python :: wav file to array python 
Python :: pip matplotlib 
Python :: why to use self in python 
Python :: pip --version 
Python :: python if condition 
Python :: send serial commands in python 
Python :: python .findall 
Python :: remove file os python 
Python :: pandas add prefix zeros to column values 
Python :: muliline comment in pyhton 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =