Beispiel #1
0
    def test_wide_repr_multiindex_cols(self):
        set_option('test.interactive', True)
        col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
        midx = pandas.MultiIndex.from_arrays([np.array(col(10, 5)),
                                              np.array(col(10, 5))])
        mcols = pandas.MultiIndex.from_arrays([np.array(col(20, 3)),
                                               np.array(col(20, 3))])
        df = DataFrame([col(20, 25) for _ in range(10)],
                       index=midx, columns=mcols)
        df.index.names = ['Level 0', 'Level 1']
        set_option('print.expand_frame_repr', False)
        rep_str = repr(df)
        set_option('print.expand_frame_repr', True)
        wide_repr = repr(df)
        self.assert_(rep_str != wide_repr)

        set_option('print.line_width', 120)
        wider_repr = repr(df)
        self.assert_(len(wider_repr) < len(wide_repr))

        self.assert_(len(wide_repr.splitlines()) == 14 * 10 - 1)

        reset_option('print.expand_frame_repr')
        set_option('test.interactive', False)
        set_option('print.line_width', 80)
Beispiel #2
0
    def test_wide_repr_multiindex_cols(self):
        with option_context('mode.sim_interactive', True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            midx = pandas.MultiIndex.from_arrays(
                [np.array(col(10, 5)),
                 np.array(col(10, 5))])
            mcols = pandas.MultiIndex.from_arrays(
                [np.array(col(20, 3)),
                 np.array(col(20, 3))])
            df = DataFrame([col(20, 25) for _ in range(10)],
                           index=midx,
                           columns=mcols)
            df.index.names = ['Level 0', 'Level 1']
            set_option('display.expand_frame_repr', False)
            rep_str = repr(df)
            set_option('display.expand_frame_repr', True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

        with option_context('display.line_width', 120):
            wider_repr = repr(df)
            self.assert_(len(wider_repr) < len(wide_repr))
            self.assert_(len(wide_repr.splitlines()) == 14 * 10 - 1)

        reset_option('display.expand_frame_repr')
Beispiel #3
0
    def test_repr_obeys_max_seq_limit(self):
        import pandas.core.common as com

        # unlimited
        reset_option("display.max_seq_items")
        self.assertTrue(len(com.pprint_thing(range(1000))) > 2000)

        with option_context("display.max_seq_items", 5):
            self.assertTrue(len(com.pprint_thing(range(1000))) < 100)
Beispiel #4
0
def barf(self, num_rows=5, max_col=None):
    """
        Keep on running into issues where in notebook, I want to just show everything.
    """
    from IPython.core.display import HTML
    import pandas.core.config as config
    config.set_option("display.max_columns", 1000)
    h = HTML(self.to_html())
    config.reset_option("display.max_columns")
    return h
Beispiel #5
0
def barf(self, num_rows=5, max_col=None):
    """
        Keep on running into issues where in notebook, I want to just show everything.
    """
    from IPython.core.display import HTML
    import pandas.core.config as config
    config.set_option("display.max_columns", 1000)
    h = HTML(self.to_html())
    config.reset_option("display.max_columns")
    return h
Beispiel #6
0
    def test_wide_repr(self):
        with option_context("mode.sim_interactive", True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            df = DataFrame([col(20, 25) for _ in range(10)])
            set_option("print.expand_frame_repr", False)
            rep_str = repr(df)
            set_option("print.expand_frame_repr", True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context("print.line_width", 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

        reset_option("print.expand_frame_repr")
Beispiel #7
0
    def test_wide_repr_unicode(self):
        with option_context('mode.sim_interactive', True):
            col = lambda l, k: [tm.randu(k) for _ in xrange(l)]
            df = DataFrame([col(20, 25) for _ in range(10)])
            set_option('display.expand_frame_repr', False)
            rep_str = repr(df)
            set_option('display.expand_frame_repr', True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context('display.line_width', 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

        reset_option('display.expand_frame_repr')
Beispiel #8
0
    def test_wide_repr_unicode(self):
        with option_context('mode.sim_interactive', True):
            col = lambda l, k: [tm.randu(k) for _ in xrange(l)]
            df = DataFrame([col(20, 25) for _ in range(10)])
            set_option('display.expand_frame_repr', False)
            rep_str = repr(df)
            set_option('display.expand_frame_repr', True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context('display.line_width', 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

        reset_option('display.expand_frame_repr')
Beispiel #9
0
    def test_wide_repr_unicode(self):
        set_option('test.interactive', True)
        col = lambda l, k: [tm.randu(k) for _ in xrange(l)]
        df = DataFrame([col(20, 25) for _ in range(10)])
        set_option('print.expand_frame_repr', False)
        rep_str = repr(df)
        set_option('print.expand_frame_repr', True)
        wide_repr = repr(df)
        self.assert_(rep_str != wide_repr)

        set_option('print.line_width', 120)
        wider_repr = repr(df)
        self.assert_(len(wider_repr) < len(wide_repr))

        reset_option('print.expand_frame_repr')
        set_option('test.interactive', False)
        set_option('print.line_width', 80)
Beispiel #10
0
    def test_wide_repr_multiindex_cols(self):
        with option_context("mode.sim_interactive", True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            midx = pandas.MultiIndex.from_arrays([np.array(col(10, 5)), np.array(col(10, 5))])
            mcols = pandas.MultiIndex.from_arrays([np.array(col(20, 3)), np.array(col(20, 3))])
            df = DataFrame([col(20, 25) for _ in range(10)], index=midx, columns=mcols)
            df.index.names = ["Level 0", "Level 1"]
            set_option("display.expand_frame_repr", False)
            rep_str = repr(df)
            set_option("display.expand_frame_repr", True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

        with option_context("display.line_width", 120):
            wider_repr = repr(df)
            self.assert_(len(wider_repr) < len(wide_repr))
            self.assert_(len(wide_repr.splitlines()) == 14 * 10 - 1)

        reset_option("display.expand_frame_repr")
Beispiel #11
0
    def test_wide_repr_named(self):
        with option_context('mode.sim_interactive', True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            df = DataFrame([col(20, 25) for _ in range(10)])
            df.index.name = 'DataFrame Index'
            set_option('display.expand_frame_repr', False)

            rep_str = repr(df)
            set_option('display.expand_frame_repr', True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context('display.line_width', 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

            for line in wide_repr.splitlines()[1::13]:
                self.assert_('DataFrame Index' in line)

        reset_option('display.expand_frame_repr')
Beispiel #12
0
    def test_wide_repr_named(self):
        with option_context('mode.sim_interactive', True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            df = DataFrame([col(20, 25) for _ in range(10)])
            df.index.name = 'DataFrame Index'
            set_option('display.expand_frame_repr', False)

            rep_str = repr(df)
            set_option('display.expand_frame_repr', True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context('display.line_width', 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

            for line in wide_repr.splitlines()[1::13]:
                self.assert_('DataFrame Index' in line)

        reset_option('display.expand_frame_repr')
Beispiel #13
0
    def test_wide_repr_multiindex(self):
        with option_context("mode.sim_interactive", True):
            col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
            midx = pandas.MultiIndex.from_arrays([np.array(col(10, 5)), np.array(col(10, 5))])
            df = DataFrame([col(20, 25) for _ in range(10)], index=midx)
            df.index.names = ["Level 0", "Level 1"]
            set_option("print.expand_frame_repr", False)
            rep_str = repr(df)
            set_option("print.expand_frame_repr", True)
            wide_repr = repr(df)
            self.assert_(rep_str != wide_repr)

            with option_context("print.line_width", 120):
                wider_repr = repr(df)
                self.assert_(len(wider_repr) < len(wide_repr))

            for line in wide_repr.splitlines()[1::13]:
                self.assert_("Level 0 Level 1" in line)

        reset_option("print.expand_frame_repr")
Beispiel #14
0
def reset_printoptions():
    import warnings
    warnings.warn("reset_printoptions is deprecated, use reset_option instead",
                          FutureWarning)
    reset_option("^print\.")
Beispiel #15
0
def reset_printoptions():
    reset_option("^print_config\.")
Beispiel #16
0
def reset_printoptions():
    reset_option("^print_config\.")
Beispiel #17
0
def reset_printoptions():
    import warnings
    warnings.warn("reset_printoptions is deprecated, use reset_option instead",
                  FutureWarning)
    reset_option("^display\.")