It seems that extracting values from a Pandas dataframe using attributes is inconsistent when I have a column name 'name'. When I do df.name I am expecting the value instead I am getting the index. Is this a quirk or should I not try to access the values by attributes?
See example:
>>>my_df = pd.DataFrame({'age':[10, 30, 40], 'name':['John', 'Bob', 'Alice'], 'city': ['Bangkok', 'Amsterdam', 'New York']})
>>>my_df
age name city
0 10 John Bangkok
1 30 Bob Amsterdam
2 40 Alice New York
>>>index, val = next(my_df.iterrows())
>>>index
0
>>>val.age
10
>>>val.city
'Bangkok'
>>>val.name
0 # <- had expected 'John' !
>>>val['name']
'John'