I am trying to group my dataframe by one of the columns and then choose a specific group. It works when I use bracket notation but when is use dot notation it returns the error unhashable type: list. My code is as follows:
import pandas as pd
census_df = pd.read_csv('data.csv')
countiespop = census_df.groupby(['STNAME']).get_group("Alabama")
Where using ['Alabama'] returns an error but "Alabama" works. I thought from this question that the two were interchangeable - where is the error coming from then?
PS: I'm relatively new to Python and asking questions on Stack Exchange. Apologies if my question is not clear or if my code snippet doesn't give enough information. Please advise me on best practices where relevant :).