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

simplify syntax associated with list operations in dataframe-modify??? #14

Open
hinkelman opened this issue Apr 16, 2021 · 0 comments
Open

Comments

@hinkelman
Copy link
Owner

hinkelman commented Apr 16, 2021

Because dataframe-modify assumes that most operations are applied to each element in a column, the syntax associated with using a procedure that takes a list is awkward within a pipe, e.g.,

(-> gapminder
    (dataframe-filter*
     (year) (= year 2007))
    (->> ((lambda (df)
           (dataframe-modify*
            df
            (percentile () (rank% ($ df 'gdpPercap)))))))
    (dataframe-sort* (> gdpPercap))
    (dataframe-display))

If not in middle of pipe, could write this...

(define gapminder2007
  (dataframe-filter*
   gapminder
   (year) (= year 2007)))

(-> (dataframe-modify
     gapminder2007
     (percentile () (rank% ($ gapminder2007 'gdpPercap))))
    (dataframe-sort* (> gdpPercap))
    (dataframe-display))
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

1 participant