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

Issue arranging data after summarising with a new variable #93

Open
Ignaciovf opened this issue Oct 21, 2019 · 1 comment
Open

Issue arranging data after summarising with a new variable #93

Ignaciovf opened this issue Oct 21, 2019 · 1 comment

Comments

@Ignaciovf
Copy link

Hello,
I'm running the following code:

test=(diamonds>>
    group_by(X.cut)>>
    summarise(dis=n_distinct(X.price))>>
    arrange(X.dis,ascending=False))

I'm trying to create a new variable with the Summarise function and arrange according to it afterwards, but although the result is correct and no warnings or errors pop up, the output isn't arranged by my new variable.

Thank you very much

@danielsjf
Copy link

danielsjf commented Sep 7, 2020

I had the same problem. Not yet sure why but the following fixed it for me. I think the dataframe is not correctly formatted.

test = diamonds >> \
    group_by(X.cut) >> \
    summarise(dis=n_distinct(X.price))
test = pd.DataFrame(test) >> arrange(X.dis,ascending=False))

Watch out if you use count as variable as that was also causing me a headache. Count is a special function so X.count doesn't refer to the column name.

More information also in #56

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

2 participants