0

I have a dataframe :

import pandas as pd
data = [['Alex',10,'100k'],['Bob',12,'200k'],['Clarke',13,'300k']]
df = pd.DataFrame(data,columns=['Name','Age','Salary'])

col = ['Age','Salary']

How to get the position of columns in dataset df. for an example , position of columns present in col list are 1 and 2 respectively. I want to get the position of these columns of col in list.

KMittal
  • 602
  • 1
  • 7
  • 21

0 Answers0