News for hackers. Stuff that matters.
Re:Show HN: Tably – Python script for converting .csv to LaT... by gregod on Monday October 09, 2017 @11:43AM (#15434803)
If you have the csvsimple [1] latex package available this can be done as latex macro. This allows for easy integration with other latex packages (drawing stuff with tikz for example [2]).

Python and a makefile might perform better for larger data sets though.

[1] https://ctan.org/pkg/csvsimple [2] http://www.godberit.de/2016/01/31/Keeping-documentation-up-t...

Re:Show HN: Tably – Python script for converting .csv to LaT... by lorey on Monday October 09, 2017 @10:20AM (#15433983)
If you have pandas installed, you can also use something like:

  pd.DataFrame.from_csv(path_csv).to_latex(path_latex)
More information at http://pandas.pydata.org/pandas-docs/stable/generated/pandas...
Re:Show HN: Tably – Python script for converting .csv to LaT... by narimiran on Monday October 09, 2017 @10:42AM (#15434174)
> If you have pandas installed, ...

I'll just copy my Reddit comment when somebody notified me about `to_latex()`:

> To be honest, I didn't know this exists (and I use pandas for lots of things). If I did, I probably wouldn't even start making tably.

> Thanks for letting me know about it, I might use it as an inspiration to maybe add some more functionality in the future....

Re:Show HN: Tably – Python script for converting .csv to LaT... by fiatjaf on Monday October 09, 2017 @08:55PM (#15438562)
See also http://stevecat.net/table-magic/ for in-browser table conversion between CSV/TSV, HTML, Markdown, SQL (the output format) and an editable table-form.
Re:Show HN: Tably – Python script for converting .csv to LaT... by tmalsburg2 on Monday October 09, 2017 @03:21PM (#15436639)
In R:

  read_csv("file.csv") %>% xtable
p.s: I don't want to suggest the the Python program is inferior. This is just an illustration showing how easy it is to manipulate table data in R. R is basically a language designed for that purpose.
Re:Show HN: Tably – Python script for converting .csv to LaT... by _Wintermute on Tuesday October 10, 2017 @10:07AM (#15441858)
about as easy in python:

   pd.read_csv("file.csv").to_latex()
Re:Show HN: Tably – Python script for converting .csv to LaT... by narimiran on Monday October 09, 2017 @06:16AM (#15432651)
I know this is very basic and not comparable with most of the stuff posted here, but anyway...

If you have some feature suggestion, bug report, or some general (coding) advice, please let me know. Thank you in advance!

Re:Show HN: Tably – Python script for converting .csv to LaT... by bflesch on Monday October 09, 2017 @10:17AM (#15433954)
Thank you, this looks very useful to me. Saying that as someone who has spent several hours converting csv data to latex tables in the past ;)
Re:Show HN: Tably – Python script for converting .csv to LaT... by narimiran on Monday October 09, 2017 @10:55AM (#15434278)
> Thank you, this looks very useful to me.

I'm glad to hear that! :)

> someone who has spent several hours converting csv data to latex tables in the past

Hopefully, tably will save you some hours in the future. If you find anything that could be improved, contact me and I'll see what I can do about it.

Re:Show HN: Tably – Python script for converting .csv to LaT... by horatatata on Monday October 09, 2017 @07:52PM (#15438332)
either way! im going to use Latex tables more because they are so easy and so damn good lookin'
Re:Show HN: Tably – Python script for converting .csv to LaT... by cup-of-tea on Monday October 09, 2017 @10:09AM (#15433896)
Why? Is CSV easier to write than LaTeX? I prefer something like org-mode tables which are actually easy to write.
Re:Show HN: Tably – Python script for converting .csv to LaT... by narimiran on Monday October 09, 2017 @10:19AM (#15433973)
> Why? Is CSV easier to write than LaTeX?

1. When it comes to tables, yes - CSV is easier to write than LaTeX. Everything is easier than LaTeX tables :)

2. More serious reason - I have some lab equipment which outputs its results as CSV files, so this tool is used to convert those 'automatically' created .csv files.

Re:Show HN: Tably – Python script for converting .csv to LaT... by cup-of-tea on Thursday October 12, 2017 @03:56AM (#15456370)
But isn't it just a character substitution? TeX uses & and \\ for column and row separators, CSV uses , and newline. There's no way I'm writing either of them by hand, so why do I need to convert from CSV?