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

Request: support DataFrame directly with Table #239

Open
nathanrboyer opened this issue Feb 15, 2024 · 1 comment
Open

Request: support DataFrame directly with Table #239

nathanrboyer opened this issue Feb 15, 2024 · 1 comment

Comments

@nathanrboyer
Copy link
Contributor

I thought that I could make a Term.Table out of a DataFrame directly since DataFrames conform to the Tables.jl interface. However, it did not work, and I have to manually redefine the header after converting.

julia> using DataFrames, Term

julia> table = DataFrame(x = 1:3, y = ["A","B","C"])
3×2 DataFrame
 Row │ x      y      
     │ Int64  String 
─────┼───────────────
   11  A
   22  B
   33  C

julia> Term.Table(
           table,
           style="red",
       )
ERROR: MethodError: no method matching Term.Tables.Table(::DataFrame; style::String)

julia> Term.Table(
           Matrix(table),
           style="red",
       )
            ╷
   Column1  │  Column2  
╺━━━━━━━━━━━┿━━━━━━━━━━━╸
      1     │     A
╶───────────┼───────────╴
      2     │     B
╶───────────┼───────────╴
      3     │     C
@FedeClaudi
Copy link
Owner

That would be nice to have - if anyone wants to submit a PR for it I'd be happy to add it.

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