Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Overwrite=No,,"* Changing the setting to ?Overwrite=Yes? will have the added effect of deactivating all of your items from the website except for those listed on this datafeed. If this is not intended, keep ?Overwrite=No?.",,,,,,,,
- Part #,Item #,Currency,MSRP,MAP,Checkout MAP,Selling Price,Inventory,Fulfillment Option,Shipping,Activation Mark
- PS2-BEC-5780,9SIAFDG6V86915,USD,,0.00,False,26.98,37,Seller,free,True
- Overwrite = Yes,,* Changing the setting to ?Overwrite=Yes? will have the added effect of deactivating all of your items from the website except for those listed on this datafeed. If this is not intended, keep ?Overwrite=No?.
- Part #,Item #,Currency,MSRP,MAP,Checkout MAP,Selling Price,Inventory,Fulfillment Option,Shipping,Activation Mark
- PS2-BEC-5780,,USD,,0.00,False,26.98,37,Seller,free,True
- import pandas as pd
- d1 = pd.read_csv(filename1, skiprows=1, usecols=['Part #','Item #'])
- d2 = pd.read_csv(filename2, skiprows=1).drop('Item #',axis=1)
- res = d2.merge(d1, on='Part #', how='left')
- d1 = pd.read_csv(filename1, skiprows=1, usecols=['Part #','Item #'])
- d2 = pd.read_csv(filename2, skiprows=1)
- d2['Item #'] = d2['Part #'].map(d1.set_index('Part #')['Item #'])
- In [106]: d2['Item #'] = d2['Part #'].map(d1.set_index('Part #')['Item #'])
- In [107]: d2
- Out[107]:
- Part # Item # Currency MSRP MAP Checkout MAP Selling Price Inventory Fulfillment Option Shipping
- 0 PS2-BEC-5780 9SIAFDG6V86915 USD NaN 0.0 False 26.98 37 Seller free
- Activation Mark
- 0 True
- d2.to_csv(r'/path/to/file.csv', index=False)
- #!/usr/bin/env python3
- import pandas as pd
- # use unique keys as index
- df = pd.read_csv('1.csv', index_col=0, names=['key', 'value'], header=None)
- print(df)
- # read as series
- keys = pd.read_csv('2.csv', squeeze=True, names=['key'])
- print('nKeys:', *keys)
- print('n', df.loc[keys])
- value
- key
- a 1
- b 2
- c 3
- d 4
- Keys: b d b
- value
- key
- b 2
- d 4
- b 2
Add Comment
Please, Sign In to add comment