Home > other >  Consult, how to use a dataframe for another assignment, how to check for duplicate data in the proce
Consult, how to use a dataframe for another assignment, how to check for duplicate data in the proce

Time:11-19

Consult, how to use a dataframe for another assignment, how to check for duplicate data in the process of assignment?

CodePudding user response:

Your question is a bit wider, I also don't know how to answer, just answer one is:
 the from pandas import DataFrame 
The import pandas as pd
Df1=DataFrame ({' key ':' a ', 'a', 'b', 'b'],
"Data" : the range (4)})
Df2=DataFrame ({' key ':' a ', 'b', 'd'],
"Data" : the range (3)})
Print (df1)
Print (df2)
Df=pd concat ([df1, df2])
Df. Drop_duplicates (inplace=True)
Print (df)


The key data
0 a 0
1 a, 1
2 b 2
3 b 3
The key data
0 a 0
1 b 1
2 d 2
The key data
0 a 0
1 a, 1
2 b 2
3 b 3
1 b 1
2 d 2