1.5.3 Columns as Racket data🔗ℹ

dataframe->hash is DataFrame.to_dict(as_series=False): a hash from each column name to a vector of its values. dataframe->columns gives the same pairs as an association list, in column order or in the order of #:columns.

> (dataframe->hash df)

'#hash(("bar" . #("ham" "spam" "jam")) ("foo" . #(1 2 3)))

> (hash-ref (dataframe->hash df) "bar")

'#("ham" "spam" "jam")

> (dataframe->columns df)

'(("foo" . #(1 2 3)) ("bar" . #("ham" "spam" "jam")))

> (dataframe->columns people #:columns '("weight" "name"))

'(("weight" . #(57.9 72.5)) ("name" . #("Alice Archer" "Ben Brown")))