I Have a code:
import pandas as pd
df = pd.DataFrame({'A': ['aaa', 'bbb', 'ccc'], 'B': [1, 2, 3]}, index=[0, 2, 3])
print(df['A'][2])
print(df.loc[2, 'A'])
Output:
bbb
bbb
Question: What is diffence between print(df['A'][2])
and print(df.loc[2, 'A'])
? Does they mean exactly the same thing (just different syntax) or they can act differently in different situations? If they are different, what is exact difference?