Giter Club home page Giter Club logo

ipy_table's Introduction

Author: `Eric Moyer`_
Copyright: Copyright © 2012-2017 Eric Moyer <[email protected]>
license:Modified BSD

ipy_table

Build Status Coverage PyPIVersion Tag

Overview

ipy_table is a support module for Jupyter Notebooks. ipy_table is an independent project and is not an official component of the Jupyter package.

The home page for ipy_table is http://epmoyer.github.com/ipy_table/

ipy_table is maintained at http://github.com/epmoyer/ipy_table

IPython is maintained at http://github.com/ipython, and documentation is available from http://ipython.org/

Jupyter is maintained at https://github.com/jupyter, and documentation is available at http://jupyter.org/

Documentation

Documentation is provided by the documentation notebooks supplied with this package:

notebooks/ipy_table-Introduction.ipynb
notebooks/ipy_table-Reference.ipynb

The documentation notebooks can be viewed online with nbviewer at Introduction and Reference.

Dependencies and Supported Python Versions

ipy_table works with Python 2.7, 3.3, 3.4, 3.5, and 3.6

ipy_table is designed to be used within a Jupyter Notebook.

IPython qtconsole operation is not currently officially supported. ipy_table renders tables using HTML, and HTML tables render differently in the IPython qtconsole than in a Jupyter notebook for reasons which I have not yet unraveled. Particularly, cell border rendering behaves differently.

Installation

  1. Run: pip install ipy_table
  2. Copy the documentation notebooks (notebooks/ipy_table-Introduction.ipynb and notebooks/ipy_table-Reference.ipynb) to your main Jupyter notebook working directory (the directory where your Jupyter notebooks are stored).

If you don't know your Jupyter notebook working directory, start the Jupyter Notebook server, create a blank notebook, and execute the command 'pwd'.

Testing

To execute the tests, run py.test from the project root directory NumPy (numpy) is a dependency for running the tests, but is not a dependency for installing / using ipy_table

Contributors

Ordered by date of first contribution

ipy_table's People

Contributors

epmoyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipy_table's Issues

make a row or cell a hyperlink?

Is it possible to make a cell or a row a hyperlink to another URL? I tried using IPython.display.HTML() but to no effect.

Py3k support

As best I can tell, it amounts to changing the single print statement to the print function, with an appropriate import from __future__, and swapping out xrange for range.

Or perhaps simply enabling the 2to3 tool in setup.py

should html-escape contents

For example, if I have a list of Foo, and repr(foo) is <Foo at 0x49199d0>, that's what I should see in the table cell. Right now the cell gets that literally and it's interpreted as an XML tag, which isn't so great.

Objects that have specific HTML repr methods (_repr_html_ for ipython-notebook) should use those instead of being escaped.

MarkupSafe may also be of interest here.

Output formatted table after plot

From what I can see, ipy_table works best if it is the last row in a ipython notebook cell. If not, then there are some issues. I can only get a formatted table if make_table and apply_theme is the last statements.

More info:
I have a loop that will create plots. After each plot I want to have a table. The only way I got ipy_table to output anything was using:
display(make_table(table_content))

The problem is that I could not get a formatted table this way.

Display header row for a headerless table

If my table starts with a header row, I can use apply_theme('basic') to highlight it.

But if my table doesn't start with a header row, and I want to display names for the columns, I'd like to be able to specify them when calling make_table()

UnicodeEncodeError for strings with non-ascii characters

If I try to create a table with strings that contain non-ascii characters, I get a UnicodeEncodeError:

ipy_table.make_table([(u'\xe9', 1)])

This produces:

----> 3 ipy_table.make_table([(u'\xe9', 1)])

/usr/lib/python2.7/site-packages/ipy_table.pyc in make_table(array, interactive, debug)
    421     global _TABLE
    422     _TABLE = IpyTable(array, interactive=interactive, debug=debug)
--> 423     return _TABLE._render_update()
    424 
    425 

/usr/lib/python2.7/site-packages/ipy_table.pyc in _render_update(self)
    233         """Renders the table only if in interactive mode."""
    234         if(self._interactive):
--> 235             return self.render()
    236         return None
    237 

/usr/lib/python2.7/site-packages/ipy_table.pyc in render(self)
    221     def render(self):
    222         """Render the table.  Return an iPython IPython.core.display object."""
--> 223         html = self.get_table_html()
    224         if self._debug:
    225             print html

/usr/lib/python2.7/site-packages/ipy_table.pyc in get_table_html(self)
    181                     # (if it is a float)
    182                     item_html = self._formatter(
--> 183                         item, self._cell_styles[row][column])
    184 
    185                     # Add bold and italic tags if set

/usr/lib/python2.7/site-packages/ipy_table.pyc in _formatter(self, item, cell_style)
    378             text = cell_style['float_format'] % item
    379         else:
--> 380             text = str(item)
    381 
    382         # If cell wrapping is not specified

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0: ordinal not in range(128)

diverse suggestion

Please excuse the brievety I write from my phone.

May I suggest using link to nbviewer on github pages for easy viewing.

Also instead of returning an HTML object, return a dummy object having several _repr_xxx so that each frontend can choose. Also notebook will store repr then nbconvert can use repr latex or other when converting ipynb to pdf.

We will move notebook to bootstrap which have convenience css for table (alternate row color, highlight on hoover) I think you might be interested for futur update.

I will have a deeper look later.

Did you add a link to your project on ipython wiki ?

Clarify global side effects in documentation

I was surprised that a statement like

ipy_table.set_column_style(1, align='right')

would re-render a table I had worked with before. How does this work? There seems to be some sort of global state that the library is maintaining, holding on to something like the most recently-generated table.
In these days of object-oriented programming, functional programming and parallel processing I think maintaining state like that can often be problematic. What issues does it help with, and what issues does it cause?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.