Python 在pandas中对两个长度不同的数据进行配对

Python 在pandas中对两个长度不同的数据进行配对,python,pandas,dataframe,join,Python,Pandas,Dataframe,Join,我想将数字从何处配对,并尝试使用leftjoin。但是,区号的长度不同,有些是3位数,有些是4位数,有些是5位数 如何将这些表配对并将结果存储在新列中 number _ area _ 0407 | Result| 0161 | Result| 0124 | Result| 0161 | Result| 0114 | Result| Edinburgh 131 | Peterborough 1733 | Worcester 1905 Glasg

我想将数字从何处配对,并尝试使用
leftjoin
。但是,区号的长度不同,有些是3位数,有些是4位数,有些是5位数

如何将这些表配对并将结果存储在新列中

 number _ area _
  0407  | Result|
  0161  | Result|
  0124  | Result|
  0161  | Result|
  0114  | Result|
Edinburgh   131   | Peterborough    1733   | Worcester  1905
Glasgow     141   | Plymouth        1752   | Wormbridge 1981
Gloucester  1452  | Portsmouth      23     | York       1904