Python pandas.plotting.table() Examples

The following are 21 code examples of pandas.plotting.table(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.plotting , or try the search function .
Example #1
Source Project: recruit   Author: Frank-qlu   File: test_frame.py    License: Apache License 2.0 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1 
Example #2
Source Project: recruit   Author: Frank-qlu   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels 
Example #3
Source Project: recruit   Author: Frank-qlu   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _conv(self, data):
        """Convert each input to appropriate for table outplot"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data 
Example #4
Source Project: recruit   Author: Frank-qlu   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _make_table(self, ax, df, title, height=None):
        if df is None:
            ax.set_visible(False)
            return

        import pandas.plotting as plotting

        idx_nlevels = df.index.nlevels
        col_nlevels = df.columns.nlevels
        # must be convert here to get index levels for colorization
        df = self._insert_index(df)
        tb = plotting.table(ax, df, loc=9)
        tb.set_fontsize(self.font_size)

        if height is None:
            height = 1.0 / (len(df) + 1)

        props = tb.properties()
        for (r, c), cell in compat.iteritems(props['celld']):
            if c == -1:
                cell.set_visible(False)
            elif r < col_nlevels and c < idx_nlevels:
                cell.set_visible(False)
            elif r < col_nlevels or c < idx_nlevels:
                cell.set_facecolor('#AAAAAA')
            cell.set_height(height)

        ax.set_title(title, size=self.font_size)
        ax.axis('off') 
Example #5
Source Project: vnpy_crypto   Author: birforce   File: test_frame.py    License: MIT License 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1 
Example #6
Source Project: vnpy_crypto   Author: birforce   File: _doctools.py    License: MIT License 5 votes vote down vote up
def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels 
Example #7
Source Project: vnpy_crypto   Author: birforce   File: _doctools.py    License: MIT License 5 votes vote down vote up
def _conv(self, data):
        """Convert each input to appropriate for table outplot"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data 
Example #8
Source Project: vnpy_crypto   Author: birforce   File: _doctools.py    License: MIT License 5 votes vote down vote up
def _make_table(self, ax, df, title, height=None):
        if df is None:
            ax.set_visible(False)
            return

        import pandas.plotting as plotting

        idx_nlevels = df.index.nlevels
        col_nlevels = df.columns.nlevels
        # must be convert here to get index levels for colorization
        df = self._insert_index(df)
        tb = plotting.table(ax, df, loc=9)
        tb.set_fontsize(self.font_size)

        if height is None:
            height = 1.0 / (len(df) + 1)

        props = tb.properties()
        for (r, c), cell in compat.iteritems(props['celld']):
            if c == -1:
                cell.set_visible(False)
            elif r < col_nlevels and c < idx_nlevels:
                cell.set_visible(False)
            elif r < col_nlevels or c < idx_nlevels:
                cell.set_facecolor('#AAAAAA')
            cell.set_height(height)

        ax.set_title(title, size=self.font_size)
        ax.axis('off') 
Example #9
Source Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_frame.py    License: Apache License 2.0 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1 
Example #10
Source Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels 
Example #11
Source Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _conv(self, data):
        """Convert each input to appropriate for table outplot"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data 
Example #12
Source Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: _doctools.py    License: Apache License 2.0 5 votes vote down vote up
def _make_table(self, ax, df, title, height=None):
        if df is None:
            ax.set_visible(False)
            return

        import pandas.plotting as plotting

        idx_nlevels = df.index.nlevels
        col_nlevels = df.columns.nlevels
        # must be convert here to get index levels for colorization
        df = self._insert_index(df)
        tb = plotting.table(ax, df, loc=9)
        tb.set_fontsize(self.font_size)

        if height is None:
            height = 1.0 / (len(df) + 1)

        props = tb.properties()
        for (r, c), cell in compat.iteritems(props['celld']):
            if c == -1:
                cell.set_visible(False)
            elif r < col_nlevels and c < idx_nlevels:
                cell.set_visible(False)
            elif r < col_nlevels or c < idx_nlevels:
                cell.set_facecolor('#AAAAAA')
            cell.set_height(height)

        ax.set_title(title, size=self.font_size)
        ax.axis('off') 
Example #13
Source Project: Splunking-Crime   Author: nccgroup   File: _doctools.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels 
Example #14
Source Project: Splunking-Crime   Author: nccgroup   File: _doctools.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def _conv(self, data):
        """Convert each input to appropriate for table outplot"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data 
Example #15
Source Project: Splunking-Crime   Author: nccgroup   File: _doctools.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def _make_table(self, ax, df, title, height=None):
        if df is None:
            ax.set_visible(False)
            return

        import pandas.plotting as plotting

        idx_nlevels = df.index.nlevels
        col_nlevels = df.columns.nlevels
        # must be convert here to get index levels for colorization
        df = self._insert_index(df)
        tb = plotting.table(ax, df, loc=9)
        tb.set_fontsize(self.font_size)

        if height is None:
            height = 1.0 / (len(df) + 1)

        props = tb.properties()
        for (r, c), cell in compat.iteritems(props['celld']):
            if c == -1:
                cell.set_visible(False)
            elif r < col_nlevels and c < idx_nlevels:
                cell.set_visible(False)
            elif r < col_nlevels or c < idx_nlevels:
                cell.set_facecolor('#AAAAAA')
            cell.set_height(height)

        ax.set_title(title, size=self.font_size)
        ax.axis('off') 
Example #16
Source Project: elasticintel   Author: securityclippy   File: test_frame.py    License: GNU General Public License v3.0 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1 
Example #17
Source Project: elasticintel   Author: securityclippy   File: _doctools.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels 
Example #18
Source Project: elasticintel   Author: securityclippy   File: _doctools.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _conv(self, data):
        """Convert each input to appropriate for table outplot"""
        if isinstance(data, pd.Series):
            if data.name is None:
                data = data.to_frame(name='')
            else:
                data = data.to_frame()
        data = data.fillna('NaN')
        return data 
Example #19
Source Project: elasticintel   Author: securityclippy   File: _doctools.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _make_table(self, ax, df, title, height=None):
        if df is None:
            ax.set_visible(False)
            return

        import pandas.plotting as plotting

        idx_nlevels = df.index.nlevels
        col_nlevels = df.columns.nlevels
        # must be convert here to get index levels for colorization
        df = self._insert_index(df)
        tb = plotting.table(ax, df, loc=9)
        tb.set_fontsize(self.font_size)

        if height is None:
            height = 1.0 / (len(df) + 1)

        props = tb.properties()
        for (r, c), cell in compat.iteritems(props['celld']):
            if c == -1:
                cell.set_visible(False)
            elif r < col_nlevels and c < idx_nlevels:
                cell.set_visible(False)
            elif r < col_nlevels or c < idx_nlevels:
                cell.set_facecolor('#AAAAAA')
            cell.set_height(height)

        ax.set_title(title, size=self.font_size)
        ax.axis('off') 
Example #20
Source Project: coffeegrindsize   Author: jgagneastro   File: test_frame.py    License: MIT License 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1 
Example #21
Source Project: twitter-stock-recommendation   Author: alvarobartt   File: test_frame.py    License: MIT License 5 votes vote down vote up
def test_table(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
        _check_plot_works(df.plot, table=True)
        _check_plot_works(df.plot, table=df)

        ax = df.plot()
        assert len(ax.tables) == 0
        plotting.table(ax, df.T)
        assert len(ax.tables) == 1