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

Pandas Exercises Solution #67

Open
devpatel2103 opened this issue Nov 4, 2023 · 4 comments
Open

Pandas Exercises Solution #67

devpatel2103 opened this issue Nov 4, 2023 · 4 comments

Comments

@devpatel2103
Copy link

devpatel2103 commented Nov 4, 2023

In[24]

This does not work anymore
car_sales.groupby(["Make"]).mean()

The mean now needs a condition in order for it to work
car_sales.groupby(["Make"]).mean(numeric_only=True)

@MikeRatcliffe
Copy link

MikeRatcliffe commented Nov 16, 2023

I can confirm this.

Also, in the Describing Data with Pandas section:

  1. You need to use car_sales.mean(numeric_only=True) as numeric_only defaults to False.
  2. car_sales["Price"] = car_sales["Price"].str.replace('[\$\,\.]', '').astype(int) now throws Invalid escape sequence '\$. You need to use car_sales["Price"] = car_sales["Price"].str.replace('[$,]', '', regex=True).astype('float') instead.

@vonstegen
Copy link

vonstegen commented Jan 10, 2024

I just wanted to add to this as well because I had similar problems starting in Section 6 - Lesson 53 and Lesson 55 with using car_sales.mean() and car_sales.groupby(["Make"]).mean().

I just wanted to post the panda link to why this "TypeError" occurs for those who come across this problem.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html

@rezanaquib
Copy link

Hi everyone,
I have tried this code, but it didn't work in my jupyter. Anyone know why and how to solve this?

This is my code:
df = pd.read_csv("heart-disease.csv")

And this is the error explaination:
AttributeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 df = pd.read_csv("heart-disease.csv")

AttributeError: module 'pandas' has no attribute 'read_csv'

@kRiShNa-429407
Copy link

Re import pandas correctly
And check have you made any mistakes

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

5 participants