I have been trying to find a solution to this all day. Read at least a dozen of the posts on this subject but nothing seems to work.
I have two csv files that I need to merge by ID. Both files have two columns with the same name: Org ID and Org Name. Below is my code:
First File
name_cols = ['GUID1', 'GUID2', 'Org ID', 'Org Name', 'Org Type', 'Chapter', 'Join Date', 'Effective Date', 'Expire Date']
pull_cols = ['Org ID', 'Org Name', 'Org Type', 'Chapter', 'Join Date', 'Effective Date','Expire Date']
df1 = pd.read_csv(path, header=None, encoding="ISO-8859-1", names=name_cols, usecols=pull_cols, index_col='Org ID')
Second File
name_cols = ['GUID1', 'Org ID', 'Org Name', 'Transaction Date', 'Product Name', 'Sales Price', 'Invoice Code', 'Payment Amount', 'Add Date']
pull_cols = ['Org ID', 'Org Name', 'Transaction Date', 'Product Name', 'Sales Price', 'Invoice Code', 'Payment Amount', 'Add Date']
df2 = pd.read_csv(path, header=None, encoding="ISO-8859-1", names=name_cols, usecols=pull_cols, index_col='Org ID')
I am still exploring pandas and any clues to how I should approach this would be much appriciated.