• Rename the Column
df.columns = ['a'.'b'.'c']
Copy the code
  • union
df = pd.concat([df1, df2])
Copy the code
  • Index is de-weighted, including column

df3 = df3[~df3.index.duplicated(keep='first')]

  • The Columns to heavy
df = pd.concat([df1, df2, df2]).drop_duplicates(subset=['col1'], keep=False)
Copy the code
  • Iterate over each line
for index, row in df.iterrows():
    # row is dict, key: column name
    print(row['col1'])
for row in df.itertuples():
    # row is a tuple, and the first element is index
    print(row[1])
Copy the code