I'd really appreciate some help on this.
import glob as glob
import pandas as pd
files = glob.glob('CASTp_Total/**/*.pocInfo')
pdb = pd.read_excel("C:/Users/User/Documents/Research/6 - CASTp/CASTp-outputs-v3.xlsx")
code = pdb['PDB code']
long = pdb['CASTp job name (1.4A)']
res = {long[i]: code[i] for i in range(len(long))}
for file in files:
df = pd.read_csv(file , sep ='\t') # if only the first sheet is needed.
df['PDB'].map(res)
df.to_csv(out, sep = '\t')
Basically, I've created a dictionary to map over current string in a dataframe. When I run the python script, I end up w/ the same original values, and mapping does not occur. I'm grabbing the dictionary from a very long excel files with too many values to put in this post.