pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.77k stars 17.97k forks source link

ENH: `(Styler|DataFrame).to_typst()` #57617

Open janosh opened 8 months ago

janosh commented 8 months ago

Feature Type

Problem Description

typst is a new markup language for scientific documents https://github.com/typst/typst. i think of it as latex for the 21 century.

Feature Description

i've used (df|styler).to_latex many times and would find an equivalent (df|styler).to_typst equally useful now that i've transitioned to Typst.

Alternative Solutions

export to JSON/CSV and use Typst native JSON/CSV import feature and generate table in Typst rather than in pandas. drawback: looses styling and all customization options available with Styler

Additional Context

No response

rhshadrach commented 8 months ago

Thanks for the request. I think we'll have to balance the popularity of the format vs the maintenance burden of to_typst. If adding in to_typst is not at all involved, then I think I'd be open to it. However, if it rivals the implementation to_latex while being an order of magnitude less popular (not sure - but I'd guess that's currently the case), then I think we should hold off.

pandoc now support typst - can you try converting the output of to_latex to typst using that for your use cases and let us know if any difficulties are encountered?

cc @attack68

attack68 commented 8 months ago

Agreed, nothing more to add. I think we would also need multiple developers familiar with typst to ensure that any development was pursuing the right direction.

to_latex was a huge implementation: #40422 with many follow ups and add ons. to_string was a very quick job: #44502

A compromise would be allow a PR to be submitted on the scale of to_string and see if there are any follow up issues from users.