I have this dataframe,
import pandas as pd
one = pd.DataFrame({
'id':[1,2,3,4,5],
'Name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'],
'subject_id':['sub1','sub2','sub3','sub4','sub5'],
'Marks_scored':[98,90,87,69,78],
'Rank': [1,1,2,10,7]})
two = pd.DataFrame({
'id':[1,2,3,4,5],
'Name': ['Billy', 'Brian', 'Bran', 'Bryce', 'Betty'],
'subject_id':['sub1','sub2','sub3','sub7','sub8'],
'Marks_scored':[89,80,79,97,88],
'Rank': [1,2,5,1,2]})
I have concatenated these two dataframes like this.
df = pd.concat([one,two],keys=['x','y'])
Now I want only the values from key 'x'
only. How can I achieve that?