I have two lists in one there are columns names which will be dynamic and another list values too. how I can map that map to my dataframe df. so for this I have give those list as static. but in my program will be dynamic.
df = pd.DataFrame(columns = ['ABC', 'LMN', 'XYZ','PQR']
columns = ['LMN','PQR']
values = ['234','654']
So far I have tried this
for i in range(len(values)):
df[columns[i]] = np.where(df[columns[i]] == columns[i], values[i], 0)
Expected output: -
Id ABC LMN XYZ PQR
0 0 234 0 654