Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python将所有数据从一个excel追加到另一个excel_Excel_Python 3.x_Pandas - Fatal编程技术网

使用python将所有数据从一个excel追加到另一个excel

使用python将所有数据从一个excel追加到另一个excel,excel,python-3.x,pandas,Excel,Python 3.x,Pandas,我试图通过使用python脚本将一个excel数据附加到另一个excel数据中,从而将两个excel数据合并为一个。 一个excel是excel_1.xlsx,第二个excel是excel_2.xlsx 在excel_1.xlsx(父表)中,它有以下数据: NAME ROLL_NO SERVICE_NAME Raman 12 Vicky Pinky 3 Raja Sunena 24 Sneha Nita 18 Ra

我试图通过使用python脚本将一个excel数据附加到另一个excel数据中,从而将两个excel数据合并为一个。 一个excel是excel_1.xlsx,第二个excel是excel_2.xlsx

在excel_1.xlsx(父表)中,它有以下数据:

NAME    ROLL_NO  SERVICE_NAME
Raman   12        Vicky
Pinky   3         Raja
Sunena  24        Sneha
Nita    18        Rahul
 NAME   PLACE   ANIMAL  NUMBERS COLORS  LOCATION    TOY
 Neha   Delhi   cat       6                home      1
        Gujrat            4      pink      home      7
 Raja   UP      dog       5      yellow    home      3
 Sneha  Mumbai  owl       1                home      6
        Pune    parrot    3      green     home      2
        Jaipur  pegion    4                home      4
 Rahul  Raipur            4      purple    home      2
        Nashik  rabbit    2      red       home      9
在excel_2.xlsx(子表)中,它有以下数据:

NAME    ROLL_NO  SERVICE_NAME
Raman   12        Vicky
Pinky   3         Raja
Sunena  24        Sneha
Nita    18        Rahul
 NAME   PLACE   ANIMAL  NUMBERS COLORS  LOCATION    TOY
 Neha   Delhi   cat       6                home      1
        Gujrat            4      pink      home      7
 Raja   UP      dog       5      yellow    home      3
 Sneha  Mumbai  owl       1                home      6
        Pune    parrot    3      green     home      2
        Jaipur  pegion    4                home      4
 Rahul  Raipur            4      purple    home      2
        Nashik  rabbit    2      red       home      9
我想知道excel_2.xlsx(子_工作表)“名称”列何时与excel_1.xlsx(父_工作表)“服务名称”匹配。如果两者都匹配,则追加“NAME”列后面的所有数据。例如,如果(子工作表)的“名称”Sneha与(父工作表)的“服务名称”Sneha匹配,则将子工作表的所有数据附加到父工作表

例如

NAME   ROLL_NO  SERVICE_NAME  PLACE   ANIMAL NUMBERS COLORS LOCATION TOY 
Sunena  24       Sneha        Mumbai   owl      1            home    6
                              Pune     parrot   3     green  home    2
                              Jaipur   pegion   4            home    4
因此,我希望得到如下预期结果:

NAME ROLL_NO  SERVICE_NAME  PLACE  ANIMAL  NUMBERS  COLOR   LOCATION  TOY
Raman   12     Vicky                        
Pinky   3      Raja         UP       dog      5     yellow    home     3
Sunena  24     Sneha        Mumbai   owl      1               home     6
                            Pune     parrot   3     green     home     2
                            Jaipur   pegion   4               home     4
Nita    18     Rahul        Raipur            4     purple    home     2
                            Nashik   rabbit   2     red       home     9

请帮我解决这个问题。

@datanoveler需要帮助吗this@Datanovice在这方面需要帮助吗