# Dataframes using tabular-asa

**URL:** <https://racket.discourse.group/t/dataframes-using-tabular-asa/2854>\
**Category:** General\
**Created:** [April 5, 2024, 4:29am UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854 "2024-04-05T04:29:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [April 5, 2024, 4:29am UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/1 "2024-04-05T04:29:31Z")

</div>

I'm looking for a tables / dataframes implementation for Racket. I see tabular-asa, and a quick reading of the docs suggests that it's more or less exactly what I'm looking for. I do see a number of what appear to be documentation bugs. Have other people used this package? I have to say I'm quite pleased with it so far!

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [April 5, 2024, 6:11am UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/2 "2024-04-05T06:11:26Z")

</div>

I'm currently stuck on "appending" two frames. That is, given two frames, return a new frame containing the rows of the first followed by the rows of the second. It looks to me like I can construct an efficient implementation of this using only the built-in functionality, but I think I need to iterate over the columns of the table, and it seems a bit like something that should be built-in?

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [April 5, 2024, 6:25am UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/3 "2024-04-05T06:25:47Z")

</div>

Well, it wasn't too bad, after I made the enormous simplifying assumption that all tables have the same set of columns. Let me know if there's a nicer way to do this?

```scheme
(define (transpose lol)
  (apply map list lol))

;; hmm... shouldn't this be built-in?
;; given a list of tables with identical column names, return a new one
;; containing all of the rows of all of the tables
(define (append-tables tables)
  (define headers
    (map table-header tables))
  (unless (= 1 (length (remove-duplicates headers)))
    (error 'headers "unimplemented, headers not equal"))
  ;; things get much easier if the columns are all the same:
  (define column-lists (transpose (map table-columns tables)))
  (for/fold ([t empty-table])
            ([column-list (in-list column-lists)])
    (table-with-column t (apply sequence-append column-list) #:as
                       (column-name (first column-list)))))

```

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [April 5, 2024, 6:33am UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/4 "2024-04-05T06:33:26Z")

</div>

Hmm... also seems like maybe table equality is not defined as I would expect? Specifically,

```scheme
(equal?
 (table-read/sequence '((a 1) (b 2) (c 3)) '(name number))
 (table-read/sequence '((a 1) (b 2) (c 3)) '(name number)))

```

returns false?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [April 5, 2024, 2:38pm UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/5 "2024-04-05T14:38:43Z")

</div>

I will also mention the `data-frame` package, which I have used and liked.

---

<div class="post-metadata">

**Author:** ![hendrikboom3](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hendrikboom3/32/2748_2.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Post date:** [April 6, 2024, 1:47pm UTC](https://racket.discourse.group/t/dataframes-using-tabular-asa/2854/6 "2024-04-06T13:47:29Z")

</div>

Interesting and useful-looking package.  
But [http://docs.racket-lang.org/data-frame/index.html](http://docs.racket-lang.org/data-frame/index.html) , the link  
to the reference documentation, seems to lead to a Page not found message.

-- hendrik
