Skip to content

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

@hinkelman

Description

@hinkelman

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions