Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DataSolveProblems/962a4cd585dac0cd484b593510435ad2 to your computer and use it in GitHub Desktop.
Save DataSolveProblems/962a4cd585dac0cd484b593510435ad2 to your computer and use it in GitHub Desktop.
import pandas as pd
df1 = pd.DataFrame({ 'colA': [10, 20, 30],
'colB': [100, 200, 300]})
df2 = pd.DataFrame({ 'colA': [40, 20, 50],
'colB': [400, 200, 500]})
new_df = pd.concat([df1, df2]).drop_duplicates().reset_index(drop=True)
print(new_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment