Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I keep getting an error for this and not sure what I'm doing wrong. The rest of my code up until here works fine. #109

Open
MariamAmmar opened this issue Apr 7, 2020 · 3 comments

Comments

@MariamAmmar
Copy link

Screen Shot 2020-04-07 at 2 58 29 PM

@MariamAmmar
Copy link
Author

Screen Shot 2020-04-07 at 3 47 30 PM

I've since fixed part of the error, but I keep getting this syntax error and I'm not sure why..

@syed0019
Copy link

syed0019 commented Apr 24, 2020

  1. firstly do the filtering trick as below:
    dataframe[dataframe['this_column'] == 'that_value']
  2. note that .loc method filters for the column labels in the dataframe. if you have a series it already contains one column
  3. put closing square bracket in mean_price variable, as below:
    mean_price = brand_only.loc[['price']].mean()
  4. note that nested square brackets are only used in case of multiple columns, when you only need one column, it is safe to put the column label with single pair of square brackets, i.e. .loc['price']

@bsassoli
Copy link

bsassoli commented Sep 21, 2020

Screen Shot 2020-04-07 at 3 47 30 PM

I've since fixed part of the error, but I keep getting this syntax error and I'm not sure why..

@MariamAmmar: you have an extra square bracket [ in mean_price = brand_only.loc['price'].mean().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants