#13131: Make a top-level table/Table function
----------------------------------+-----------------------------------------
Reporter: kcrisman | Owner: was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.4
Component: user interface | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: John Palmieri | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Changes (by {'newvalue': u'John Palmieri', 'oldvalue': ''}):
* status: new => needs_review
* author: => John Palmieri
Old description:
> sage: ta[tab]
> tachyon_rt tan tanh taylor
>
> I have had a number of people rant to me about Sage not having a command
> like Mma Table (I guess - I've never used it).
>
> Okay, fair enough to say that list comprehensions do this. But we have
> gotten many people over the years saying that when they finally found
> html.table, this is just what they are looking for.
>
> Question/Poll: should html.table be imported globally, so that the tab-
> completion above has an additional entry? It seems like this would help a
> lot of people find a fairly obscure function.
>
> See [https://groups.google.com/forum/?fromgroups#!topic/sage-
> devel/5Ex0erSNyKg this sage-devel thread] for more suggestions, including
> that we should have a `Table` class that `table` calls, which uses
> something like `html.table` in the notebook, but also has a `_latex_`
> method, makes ascii art in the command line, etc.
New description:
As the summary says.
See [https://groups.google.com/forum/?fromgroups#!topic/sage-
devel/5Ex0erSNyKg this sage-devel thread] for more suggestions, including
that we should have a `Table` class that `table` calls, which uses
something like `html.table` in the notebook, but also has a `_latex_`
method, makes ascii art in the command line, etc.
Just a few examples from the doctests in the patch:
{{{
sage: table([['a', 'b', 'c'], [100,2,3], [4,5,60]])
a b c
100 2 3
4 5 60
sage: table([['a', 'b', 'c'], [100,2,3], [4,5,60]], frame=True)
+-----+---+----+
| a | b | c |
+-----+---+----+
| 100 | 2 | 3 |
+-----+---+----+
| 4 | 5 | 60 |
+-----+---+----+
sage: latex(table([['a', 'b', 'c'], [100,2,3], [4,5,60]],
frame=True))
\begin{tabular}{|l|l|l|} \hline
a & b & c \\ \hline
$100$ & $2$ & $3$ \\ \hline
$4$ & $5$ & $60$ \\ \hline
\end{tabular}
}}}
You can also specify alignments of 'left', 'center', or 'right'.
--
Comment:
Okay, here's a first attempt. For some reason I find the syntax
`table(array, header=another_row)` strange, so this just allows for the
header argument to be True or False, and the actual row needs to be the
first row of `array`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13131#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.