pandas append on columns with different names
问题 How to append 2 different dataframes with different column names a = pd.DataFrame({ "id": [0,1,2,3], "countryid": [22,36,21,64], "famousfruit": ["banana", "apple", "mango", "orange"], "famousanimal": ["monkey", "elephant", "monkey", "horse"], "waterlvl": [23, 43, 41, 87] }).set_index("id") >> a b = pd.DataFrame({ "id": [0,1,2,3], "cid": [25,27,98,67], "FAM_FRUIT": ["grapes", "pineapple", "avacado", "orange"], "FAM_ANI": ["giraffe", "dog", "cat", "horse"], }).set_index("id") >>b How to append