Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data1 = '''#PARTNER_NAME TOTAL_NO_OF_RECORDS TOTAL_QUANTITY
- a 22142 309941.01
- b 1719 34301.67
- d 4376 345460.7
- e 73723 2166729.41
- c 2045 165651
- f 307 1827993.54
- b 1719 34301.67
- c 2039 165674'''
- data2 = '''Records Quantity
- 2045 165651
- 22142 309941.01
- 17 312
- 2 300
- 640 9375.75
- 68 256
- 1719 34301.67
- 2899 219700.8707
- 451 6658.06
- 70 3179.24
- 776 6849.52'''
- import io
- import pandas as pd
- f1 = io.StringIO(data1)
- f2 = io.StringIO(data2)
- df1 = pd.read_csv(f1, sep="\s+")
- df2 = pd.read_csv(f2, sep="\s+")
- #print(df1)
- #print(df1.columns)
- #print(df2)
- #print(df2.columns)
- #print('---')
- print(pd.merge(df1, df2, left_on='TOTAL_NO_OF_RECORDS', right_on='Records',
- how='inner', sort=False))
- '''
- #PARTNER_NAME TOTAL_NO_OF_RECORDS TOTAL_QUANTITY Records Quantity
- 0 a 22142 309941.01 22142 309941.01
- 1 b 1719 34301.67 1719 34301.67
- 2 b 1719 34301.67 1719 34301.67
- 3 c 2045 165651.00 2045 165651.00
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement